• Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. thirawad

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website
    T
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 15
    • Best 0
    • Controversial 0
    • Groups 0

    thirawad

    @thirawad

    0
    Reputation
    720
    Profile views
    15
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    thirawad Unfollow Follow

    Latest posts made by thirawad

    • RE: Using REST API to PUT point-values by Python code

      @phildunlap Thank you very much for your code and advice.
      this is the result:

      1. i'm using your code by replace DP_setme to my Xid and
      2. change the data point type in data source from binary to alphanumeric,
      3. It done, i'm receive response code: <201>

      for the next i will try to change the way for put as a boolean.
      thank you again. you very please me.

      posted in How-To
      T
      thirawad
    • RE: Using REST API to PUT point-values by Python code

      @phildunlap , Hi phildunlap, Thank you for your reply.
      for now my request PUT still had code 403 (Forbidden). i found some content miss match in header about set-cookie, MANGO8080 and XSRF-TOKEN, there follow with Path=/;HttpOnly, , i'm not sure. please advice me for correcting the code.
      [my device: window10, 64bit , python2.7.14 and Mango REST API V3.2.2]

      #--- code  
      print r.headers['Set-Cookie']
      
      #-- output 
      MANGO8080=nq3nbgdw1qymm6btf374f6wb;Path=/;HttpOnly, XSRF-TOKEN=63164c0e-4353-40dc-9591-30d129580c87;Path=/
      
      import requests
      import json
      
      
      s = requests.Session()
      s.headers.update({'Cookie':'MANGO8080=1mk606ffnwaxywwielclj4ck2; XSRF-TOKEN=dc1d54de-fab1-4405-8ccb-ea677aadf7ca','X-Xsrf-Token':'dc1d54de-fab1-4405-8ccb-ea677aadf7ca','Accept': 'application/json', 'Content-Length': '39', 'Accept-Encoding': 'gzip', 'Content-Type': 'application/json;charset=UTF-8'});
      url3 = 'http://localhost:8080/rest/v2/login'
      js = {"username": "admin", "password": "admin"}
      r = s.post(url3, data=json.dumps(js));
      
      ##STEP [1]-----------------------------
      print "After post login the status code is:", r.status_code
      print r.headers['Set-Cookie']
      
      ###----- Renew Cookie Token generate in cookie content
      s.headers.update({'Cookie' : r.headers['Set-Cookie']})
      
      ##------ Renew X-Xsrf-Token
      s.headers["Content-Type"] = "application/json"
      s.headers["X-Xsrf-Token"] = s.cookies["XSRF-TOKEN"]
      
      dd = {"dataType":"BINARY","value":"false","timestamp": "","annotation":"Rest by admin"}
      url2 = 'http://localhost:8080/rest/v1/point-values/DP_6bcc108f-faa1-47fb-b310-1acc8b047fd2?unitConversion=false'
      r = s.put(url2, data=json.dumps(dd));
      
      ##STEP [2]-----------------------------
      print(r)
      print(s.headers)
      
      

      Best regard.
      Thirawad

      posted in How-To
      T
      thirawad
    • Using REST API to PUT point-values by Python code

      Hi all,
      this is the first time for me to using REST API . i'm start learning from SWAGGER, everything in swagger page working good. i can get value or put value in to the data point via Xid, it easy to use and power full. in figure below show for detail of PUT point-values/{Xid} had success.

      after that i'm try to get and put value from point-values via Python code. The Cookie issue for request header are solve in help forum. i'm trying several time. so it working only for request get() value, but when using request put() i receive response of request status code is 403. maybe the code is not correct, i don't know how to declare the body content of payload. i wish someone help. i have the code in below

      0_1515669082562_rest2.png
      0_1515669115056_rest1.png

      import requests
      import json
      
      ## STEP [1]-------------------------------------------------------------------------
      s = requests.Session()
      s.headers.update({'Cookie':'MANGO8080=1mk606ffnwaxywwielclj4ck2; XSRF-TOKEN=dc1d54de-fab1-4405-8ccb-ea677aadf7ca','X-Xsrf-Token':'dc1d54de-fab1-4405-8ccb-ea677aadf7ca','Accept': 'application/json', 'Content-Length': '39', 'Accept-Encoding': 'gzip', 'Content-Type': 'application/json;charset=UTF-8'});
      
      url3 = 'http://localhost:8080/rest/v2/login'
      js = {'username': "admin", 'password': "admin"}
      r = s.post(url3, data=json.dumps(js));
      
      s.headers.update({'Cookie' : r.headers['Set-Cookie']})
      del s.headers["Content-Length"]
      del s.headers["Content-Type"]
      del s.headers["Cookie"]
      del s.headers["X-Xsrf-Token"]
      
      ## STEP [2]-- get device name -----------------------------------------------------------------------
      r = s.get('http://localhost:8080/rest/v1/device-names', timeout=5);
      print ('\n device name')
      print( r.text)
      
      ## STEP [3]-- get Point value by {Xid} ---------------------------------------------------------------
      r = s.get('http://localhost:8080/rest/v1/point-values/DP_6bcc108f-faa1-47fb-b310-1acc8b047fd2/latest?useRendered=false&unitConversion=false&limit=1&useCache=true', timeout=5);
      print ('\n Point value')
      print( r.text)
      
      ## STEP [4]------ put Point value by {Xid} ---------------------------------------------------------
      dd = {'dataType': "BINARY",  'value': "true",  'timestamp': 0,  'annotation': "rest by TST 12"}      
      url2 = 'http://localhost:8080/rest/v1/point-values/DP_6bcc108f-faa1-47fb-b310-1acc8b047fd2?unitConversion=false'
      r = s.put(url2, data=json.dumps(dd));
      print ('\n post')
      print(r)
      print( r.text)
      

      the request status code in step 1 - 3 is <200> but step 4 is <403> please help !

      Best regard.

      posted in How-To
      T
      thirawad
    • SSH data source & Python Programming

      Hi all :)
      How to learn to using SSH data source. where the example to beginner use and apply.

      refer to the Topic post:
      Raspberry Pi (or clone) GPIO into Mango
      https://forum.infiniteautomation.com/topic/2562/raspberry-pi-or-clone-gpio-into-mango
      How to making clearly understanding, step by step.

      I wish to get the CUP status (CPU Temperature, battery voltage, ... ) and put it in to the SSH data source. and show in dash board.

      best regard
      Thirawad

      posted in How-To
      T
      thirawad
    • RE: How to Publisher data point type HTTP Image to another mango.

      Hi Phildunlan
      it is very well, you are clever and make me happy.
      so the mango persistent working good!
      for clearly the step to publish HTTP image as below

      step1: (mango in raspberry pi) add mango persistent TCP for get publish xid and setting Host, Port and Authorization key. this step we can add all data point except image

      0_1511349919916_d5_1.png

      step2 (need only for add image to persistent) if we have data point xid of image already. go to Administration/configuration import/export and export.

      0_1511350868871_d5_4.png

      setp3 copy code to text edit and insert xid of image directly with the same format.

      0_1511351261353_d5_3.png

      copy all code and paste back to the configuration and import.

      step4 modifying or replacing Mango/web/WEB-INF/snippet/imageValueThumbnail.jsp to be the same as the latest in the repository: https://github.com/infiniteautomation/ma-core-public/blob/main/Core/web/WEB-INF/snippet/imageValueThumbnail.jsp

      with 4 step mango in raspberry pi well published to the host.

      step5 (on PC) setup mango persistent TCP data source to receive. set some port and authorization same as on sender setting (raspberry pi) and test get status.

      0_1511351815472_d5_5.png

      all data point form sender side add automatically in to your PC and we got image :)

      0_1511352063002_d5_6.png

      Thank you Mr.Phildunlap again for your help.

      Thank you for read, help and share.

      posted in How-To
      T
      thirawad
    • RE: How to Publisher data point type HTTP Image to another mango.

      Hi phildunlap
      clever! and thank you very much for your tried.
      so, because of your mango is very well, i'm very interesting.
      let me checking by your suggestions.

      Thank you for read, help and share.

      posted in How-To
      T
      thirawad
    • RE: Can i change localhost port in Mango?

      Hi Nikospps
      Please try edit on environment properties , like this
      0_1511275261553_d4_2.png
      for example the file in
      C:\Program Files\Mango\classes\env.properties

      posted in User help
      T
      thirawad
    • RE: How to Publisher data point type HTTP Image to another mango.

      @joelhaggar
      Thank your very much for your support.
      let me prepare and send GUIDs for request a trial licese.

      So back in to the main topic about Publisher data point type HTTP image
      for now , i'm try to checking in publisher -> Mango Persistent TCP
      on my mango unlicensed type :
      modules core version 3.2.2+20171009170034
      modules persistent version 3.2.1
      I see the data source type numeric, binary but don't have image type to publish.
      Let me show in picture below
      0_1511238875533_d4_1.png
      Is depend on license or not?
      or Mango persistent TCP still can't send the data point type image.

      Thank you for read, help and share.

      posted in How-To
      T
      thirawad
    • RE: How to Publisher data point type HTTP Image to another mango.

      Thank you very much.

      posted in How-To
      T
      thirawad
    • RE: How to Publisher data point type HTTP Image to another mango.

      @phildunlap

      posted in How-To
      T
      thirawad