Jump to content
Guides for the Forum Read more... ×
Poradniki na Forum Read more... ×
FIBARO Home Center App 1.0.0 - release Read more... ×
FIBARO Home Center App 1.0.0 - wydanie Read more... ×
  • 0
Teza

[Solved] Is it possible to import an JSON string into a virtual device?

Question

I get the following JSON string from my device in a browser by typing the IP of my device:

 {"data":{ "id":"8200007A","type":"8","detector":"SI29BG","voltage":382,"cpm":14,"temperature":9.45,"humidity":48.29,"pressure":100281,"voc":12800000,"co2":399,"noise":39,"ch2o":0.00,"pm25":3,"uptime": 107787}}

 

is it possible to import these values into a virtual device in HC2?

 

 

The closest I have found is:

Please login or register to see this code.

 

but these will not get the json string

 

 

 

This is a part question for my thread:

 

Edited by Teza
Solved

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi @Teza,

 

Try this code:

 

Please login or register to see this code.

 

If IP address and TCP ports are correct and also path "/j" then you should get answer in 'response'. If you get nothing then status and error should give you a clue what is wrong. If request is correct then status should be 200 and _error = 0

Share this post


Link to post
Share on other sites
  • 0
  • Inquirer
  • Thank you for replying!

     

    Please login or register to see this image.

    /monthly_2018_04/Skjermbilde1.PNG.24163c771c9a9a3da1127dd073e9b98d.PNG" />

    Skjermbilde2.PNG.054debe05e57c742637f20955b1d766b.PNG

     

     

    Skjermbilde3.PNG.0d97f4abcf0ae9c661de3c45fac15c46.PNG

     

     

    Have also tried with only the IP in the VD setup.

     

     

     

    This is what I get when typing the IP192.168.8.106  in a browser:

     

    uRADMonitor 8200007A
    type:8 hw:105 sw:126 SI29BG


    radiation:14CPM
    temperature:6.10C
    pressure:100307Pa
    humidity:52.37RH
    VOC:11434000
    noise:40dBA
    CH2O:0.01ppm
    PM2.5:3ug/m^3
    CO2:422ppm
    voltage:382V
    duty:18%
    frequency:15.50kHz
    uptime:192094s wdt:26s/350s

    ip:192.168.8.106
    status:connected
    interval:60 http:200 3035/3200


    Please login or register to see this link.

     

    Please login or register to see this link.

     [376]

     

     

     

    and by typing the path http://192.168.8.106/j:

     

    Please login or register to see this code.

     

     

    Edited by Teza

    Share this post


    Link to post
    Share on other sites
    • 0

    I have a HC2 getting json files from a raspberry PI.

     

    In a VD I have this code in main part of the VD

    Please login or register to see this code.

     

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • @robd Amazing, thank you very much!

     

    By slightly changing the code to: 

    Please login or register to see this code.

    It now return the following in the debug window:

     

    [DEBUG] 14:32:38: status 200; errorCode 0; res {"data":{ "id":"8200007A","type":"8","detector":"SI29BG","voltage":379,"cpm":24,"temperature":19.64,"humidity":45.75,"pressure":100902,"voc":11987133,"co2":505,"noise":43,"ch2o":0.02,"pm25":3,"uptime": 63678}}
    [ERROR] 14:32:38: line 19: attempt to concatenate field 'supplyAirTemp' (a nil value)
     
     
    This is a huge step forward for me.
    I can now focus on how to be able to use these values in HC2.
     
     

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • Solved

     

    Please login or register to see this code.

     

    Share this post


    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

    ×