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

REST API and HVAC


EduardoPica
 Share

Question

Im trying to turn on my AC using a http request. I am able to turn lights on and off as well as other things no worries, but turning the AC on isn't working.

 

I have a remotec ZXT-600, I am assuming it has to do with not having the right arguments in there.

The back end of the url is

Please login or register to see this code.

with the arguments as blank

 

{
  "args": [
    "{}",
    "{}"
  ],
  "delay": 0,
  "integrationPin": "1234"
}

 

My question is how and where do I pass in an argument with an action for it to turn to cool or heat.

Below is the device data. Any help is appreciated.

 

Please login or register to see this code.

 

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

I think it is something like 

api.post("/devices/58/action/setThermostatMode", {args = {"Heat"}})

I am not using API for heating, so i did not tested this, so please test it. I think it can work.

Edited by Neo Andersson
Link to comment
Share on other sites

  • 0

Eduardo, Here is the answer using Jgabs help

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0

Jgab also recommended the fromula that I told you.

 

Please login or register to see this code.

or

 

Please login or register to see this code.

 

 

I can confirm that it is working.

The formula that I showed you and what Jan also suggested is working.

api.post("/devices/58/action/setThermostatMode",{args={"Heat"}})  -- I have tested it and its working

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thank you very much, I'll try it when I get home and update on results. To clarify, I am trying to communicate through a python program and not a quick app, not sure if that changes much.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Posted (edited)

    @Neo Andersson@jgab  This is what I'm testing with, nothing I put into the args works, be it Heat, Cool, or any of the other functions. Any input?

    Please login or register to see this attachment.

     

    This is what the history looks like when the device is called from the dashboard.

    Please login or register to see this attachment.

     

    Although when "Cool" is passed through the args the history will only show the action with no Mode to follow and also no results.

    Please login or register to see this attachment.

    Edited by EduardoPica
    deleted photo with password
    Link to comment
    Share on other sites

    • 0

    This works in swagger on my system, when controlling an FGT-001 Fibaro Heat Controller

     

    This command makes it run "according to schedule".

     

    Please login or register to see this code.

     

    This command makes it turn off and disable the schedule:

     

    Please login or register to see this code.

     

    Mind the subtle difference when using swagger or curl compared to Lua, the number of braces, quotes changes in manner that might make it difficult to spot an error.

     

    The return body of those commands:

     

    Please login or register to see this code.

     

    BTW you might want to blur that "-H 'Authorization: Basic  ....." on your screenshots. We now know your password.

    Link to comment
    Share on other sites

    • 0

    BTW, in 2022, running latest version of HC3, the canonical form to do that in Lua would be:

     

    Please login or register to see this code.

     

    The HC is moving away from the "fibaro." syntax because the same firmware is running on different platforms, eg "yubii", so the "hub." syntax is more... neutral I guess.

    Edited by petergebruers
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks Peter, I deleted the picture for now.

    Hmm, could it be that because it's not a fibaro device it cannot be controlled through the api?

    I've tried all combinations of the braces, quotation marks and brackets but most just spit out a Json error.

    I'll have another crack this afternoon.

    Link to comment
    Share on other sites

    • 0

    Okay, to be on the safe side, this is what I copy/paste on my MAC to send the Heat command

     

    Please login or register to see this code.

     

    Curl then returns

     

    Please login or register to see this code.

     

    4 hours ago, EduardoPica said:

    Hmm, could it be that because it's not a fibaro device it cannot be controlled through the api?

    Maybe, but not likely and we can test that.

     

    Mae a (dummy) BLOCK SCENE. in the right pane, drag a device block and select the room of the remotec ZXT-600 and the remotec ZXT-600. Then, in the next dropdown select "Set hhermostat mode". The next dropdown shows in my case "Heat", "Off", "Manufacturer Specific" Save it then click the button "Copy and convert to Lua.

     

    Have a peek at the Lua, eg

     

    Please login or register to see this code.

     

    Now you have the correct ID (1899), the correct action (setThermostatMode) and the right argument for this thermostat setting (ManufacturerSpecific - without a space between the words)

     

    4 hours ago, EduardoPica said:

    I've tried all combinations of the braces, quotation marks and brackets but most just spit out a Json error.

    every comma, single or double quote counts. When you copy paste, it is easy the get something that is "unbalanced", or you have comma where you should have none.

     

    I have also seen people cope/paste this in a word processor, which then changes dashes and quotes eg

     

    '    becomes     ` or ’

    "   becomes    “ or ”

     

    That change can be hard to spot as well

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Posted (edited)

    Looking at what you have below, I've take the args and put that into it through swagger, works perfectly.

    On 4/5/2022 at 12:59 PM, petergebruers said:

    Please login or register to see this code.

    The default arguments being what is below compared to your is slightly different.

    Please login or register to see this code.

    I took away the curly braces in the args array and it worked, seems like they are just there as a place holder for the string. Thanks again @petergebruers@Neo Andersson

    Edited by EduardoPica
    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.

     Share

    ×
    ×
    • Create New...