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

json table help


Question

Posted
below i am trying to set all 6 devices to the value of 12 by using '/api/panels/heating' rather than a specific heating panel id '/api/panels/heating?id=1396' for example... to save having lots of similar code. Could someone be kind enough to advise please. I can get it to work on a one to one basis but not all of them at once.

 

----

 

HC2 = Net.FHttp("127.0.0.1",11111);

 

-- get harmonogram

response ,status, errorCode = HC2:GET("/api/panels/heating");

jsonTable = json.decode(response);

 

-- change tabele in Lua

jsonTable[1].properties.vacationTemperature = 12;

jsonTable[2].properties.vacationTemperature = 12;

jsonTable[3].properties.vacationTemperature = 12;

jsonTable[4].properties.vacationTemperature = 12;

jsonTable[5].properties.vacationTemperature = 12;

jsonTable[6].properties.vacationTemperature = 12;

 

-- send back

json = json.encode(jsonTable);

HC2:PUT("/api/panels/heating",json);

2 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • Posted

    or something via api to enable holiday mode with a certain temp?

    • 0
    Posted (edited)

    I did some checking in the FGHC REST API (

    Please login or register to see this link.

    ), looks to me you can only use the search-filter (type)

      "baseType": "com.fibaro.hvac" and change the "properties": "value", not holiday mode.

    Edit: My mistake, your checking "/api/panels/heating".

    Please login or register to see this image.

    /emoticons/default_icon_redface.gif" alt=":oops:" />

    Looks to me id's are necessary for some reason. Can you do a fibaro:debug("Response: "..response) ?

     

    If your code is not working for some reason it's maybe an idea to write some code to get the ID of your heating devices (or manually put them in a Table) and create a loop to change them one by one.

    Edit: you can get the ID's by checking the rooms (/api/rooms), "defaultThermostat"

     

     

    I use this method (ID table with manually added devices), for example, for different Alarm-modus (sleep, away, at home, summer). Just an idea....

    Edited by Lambik

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