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

    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

    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
    • RE: How to Publisher data point type HTTP Image to another mango.

      Hi Phildunlap
      Mango Persistent, it available in mango license version.
      I need to try it. How can i get the license for 30 days for 2 GUID.
      if you please me :)

      posted in How-To
      T
      thirawad
    • RE: How to force data bi-direction between HTTP Sender and HTTP Receiver

      Thank you for your advice and checking about publisher's format.

      yes, i'm worry about the secure too.

      Thank you again Mr. Phildunlap

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

      what the idea of send out data point type HTTP Image from one mango to another mango in the normally way. i can't find them.

      0_1510839275410_d3_1.png
      some idea is setup inside config of the camera about FTP and send data direct to another place by itself. but i don't know the solution to get the image from the place to data point or show in dashboard by refresh the new coming image every time.

      I hope somebody need to know or need help like me.
      Thank you for read, help and share.

      posted in How-To
      T
      thirawad
    • RE: How to force data bi-direction between HTTP Sender and HTTP Receiver

      Thank you very much for your support reply.
      Good idea for settable binary 2-way (PC and raspberry) by set
      Raspberry : HTTP sender and receiver by HTTP receiver + Point Link
      PC : HTTP receiver
      from my experiment in the HTTP receiver getting the data to the data point have only one format http://<ip arress:port>/httpds?param1=value1
      yes it is enough. as show below.
      0_1510830530331_d2_2.png
      i have set point url and set point name and i can set a binary data back from our PC to Raspberry, that having HTTP receiver waiting for data. Let me show you for another experiment.
      0_1510830580645_d2_3.png
      It mean impossible to get correct binary data with another name except value for now is name. bad idea for use this.
      forget the HTTP for 2 way settable (i'm give up)

      the best solution for 2 way settable data by using Modbus I/P set (Modbus server) on PC (Data source -> Modbus I/P) and (Modbus Client) on Raspberry (Publisher -> Modbus Publisher) but need some modbus protocol skill for setting like a port , slave id etc..
      0_1510832063981_d2_4.png

      Hope this post help, who need to settable binary data by 2 way (mango1 and mango2)
      Thank.

      posted in User help
      T
      thirawad
    • How to force data bi-direction between HTTP Sender and HTTP Receiver

      I'm using Mango Automation V3.3.2
      so My project have 2 mango, the first run in raspberry pi (IP address:10.62.41.189) and another one run in PC (IP adress:10.62.41.121).
      It is every well to send data point from raspberry pi by HTTP Sender (Publish) and the PC using HTTP Receiver (Data Source) to get the data point into it. The picture below are some setting of mango run in raspberry pi. Screenshot 1 Screenshot 2
      and this picture below are some setting of mango run in PC.
      p1 p3
      p2
      I'm got the data by check in the watch list as show below
      p4
      for now i can settable data name SW1 only 1 way raspberry pi (sender) -> to PC (receiver) as show in below the left hand side is PC and the right hand side is raspberry pi
      sender4
      I need help i want to settable data name SW1 force back from PC to raspberry pi, but for now i can't do. it have no response. i will show in below
      sender5
      something wrong
      Q1: Set point URL setting correct or not?
      Q2: Set point name setting correct or not?

      PS. apologize for very long post.

      posted in User help
      T
      thirawad