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

Update virtual device labels with one JSON post, possible?


Question

Posted

I automated my two Xiaomi Roborock S50 vacuum cleaning robots with Node-RED and Uni-Fi presence detection. If my wife or I are not at home in the morning the robot's start cleaning.

Now I read the robots state with Node-RED and want to push this to a Fibaro Virtual Device. I use the Fibaro app as default GUI for my automation information, but I don't want to port the Roborock and Unifi nodes to the HC2 and LUA. Node-RED just works and I want to have the logic on that machine.

 

In HC2 I created an empty Virtual Device and I found out I can change one label with the HTTP call:

Please login or register to see this code.

But I have a lot of labels, and I have to fire this GET URL 6 times. Does someone know if it is possible to create a JSON object and send the Virtual Device update in 1 HTTP POST call? How is the JSON structure and HTTP URL for that, if it is possible?

 

 

Please login or register to see this attachment.

11 answers to this question

Recommended Posts

  • 0
Posted

I don't think it is possible.. but I think the follow scenario could work for you:

1. Create extra label

2. Update this extra label with JSON table that includes all your necessary information for all other labels.

3. In VD main loop scan this extra label (lets say every 20 seconds).

4. If label has data, decode JSON table and update other labels accordinagly

5. Clear extra label.

 

By the way what exactly the purpose of updating the labels, it might be easier way to accomplish your needs.

 

 

  • 0
Posted

or do this by HTTP POST with send XML VD data  with all new labels at ones.

 

  • 0
  • Inquirer
  • Posted

    XML is okay. But what is the XML scheme? Can you give me a hint. I'm searching al lot but do not find the good keyword to find it :)

     

    @cag014 I want to update the values of the labels, not the label itself. So I get status informstion in the fibaro app.

    • 0
    Posted

    Sorry no xml but json (when I wrote message I worked on another things in xml ;-)

    for changing by external request by REST API:

    • take json by http GET (ex http://192.168.1.222/api/devices/988)
    • change in json all interesting label or button name
    • put json by http PUT ((ex http://192.168.1.222/api/devices/988 {xml string}  )

    the example of VD scheme (generally the label and button is stored in 3th level "rows" section {root.properties.rows{....} } 

    more information http://HC2IP/docs and 

    Please login or register to see this link.

     

     

    Please login or register to see this code.

     

    • 0
  • Inquirer
  • Posted

    Thank you very much. But I'm trying this and get a http 200 okay back, and the label values are not changed. The log property is changing, very strange. This means the HC2 accepts it.

    I tried sending the whole json back that I got with GET and only updated the values of the properties field. Only the log changes, but not the label values. You have any clue?

     

    Please login or register to see this code.

     

    • 0
    Posted
    11 hours ago, Joep said:

     

    @cag014 I want to update the values of the labels, not the label itself. So I get status informstion in the fibaro app.

    That's exactly what I meant ... changing the label value.

    Have tested the idea and it works.

    • 0
  • Inquirer
  • Posted

    That looks promising. I'll try that.

    But @drboss's solution is the better one, if I get it working. Because that doesn't use a 20 second loop at the controller and that is CPU/MEM. I'll try to keep that as low as possible.

    • 0
    Posted

    Hi,

     

    pls program it. Only the log changes, but not the label values. hc2 ver 4.532beta

     

    thx

    • 0
    Posted

    no answer and no solution for this great feature?

    • 0
    Posted

    @stafil were you able to integrate your S50 into Fibaro  ?

    I am having an S6 and really looking for a solution to integrate it into the HC2 (and HC3 in the near future)

    • 0
    Posted (edited)

    I please integrate tino hc2. I'm trying this and get a http 200 okay back, and the label values are not changed. I have update watermeter in 1 POST HTTP call. thx

    Edited by stafil

    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...