Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

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


Teza

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
Link to comment
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

Link to comment
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
    Link to comment
    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.

     

    Link to comment
    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.
     
     
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Solved

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...