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


mazzurra

Question

Hello,

 

I need help automating my A/C. Currently it communicates wireless over a cloud service (ninja).

 

I've inspected the web service 

Please login or register to see this link.

and it has all the information needed to communicate with the device. My question is can Fibaro mimic this operation in a virtual device?

 

When I put this address

Please login or register to see this link.

xxxx?user_access_token=xxxx in my browser i receive the following information:

{"result":1,"error":null,"id":0,"data":{"vid":2,"did":4,"device_type":"airconditioner","default_name":"Air Conditioner Settings","tags":"aircon","is_sensor":1,"is_actuator":1,"is_silent":0,"has_time_series":0,"has_subdevice_count":0,"has_state":0,"gid":"0","guid":"xxxx","node":"xxxx","meta":{},"shortName":"","subDevices":{},"last_data":{"DA":{"amOn":false,"tempTarget":24,"mode":1,"fanSpeed":2,"enabledZones":[0,0,0,0,0,0,1,0]},"timestamp":1466147822827}}}

 

Can anyone help me or have any examples of something similar?

 

Cheers

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • SUCCESS!

     

    So for anyone that would like to know you can't use HTTPS in "virtual devices" only "scenes". The following worked for me to turn the Actron ON:

     

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0

    Don't see why not. That looks like a status request. You can use a HTTP request to get the JSON string in your virtual device.

     

    Create HTTP connection variable and set authentication if required

    Please login or register to see this code.

    Build JSON data and convert to string using json.encode().  Send data to REST interface using HTTP POST request

    Please login or register to see this code.

    Decode the JSON response and do stuff

    Please login or register to see this code.

    May also work using a HTTP GET request

    Please login or register to see this code.

    Hope that helps!!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks,

     

    So is this something that I connect to a button in a virtual device?

     

    Sorry I've done some programming before but this is all new to me. Can I copy and paste what you've done or do I need to find out more information (port number etc)

     

    I want to start off with turning the device on and off then go from there. 

     

    Cheers

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • This seems to be the snipped of code preforming actuation:

    Please login or register to see this code.

    How do I implement? There is no local service so what do I enter when creating the virtual device?

    Link to comment
    Share on other sites

    • 0

    So is this something that I connect to a button in a virtual device?

     

    Yep, can copy that into a button and select the LUA code radio button.

     

    My suggestion would be to use fibaro:debug(response) after each HTTP request to see what is getting returned and go from there.

    Please login or register to see this code.

    Good luck!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
      1. Thanks for your help so far but I can't seem to get it working. Does anything look wrong with the code below?

        Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • also do I have to put in "headers" some how? The below snipet is taken from the website used to control the A/C.

         

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0

    Excellent ! Did you manage to get any additional information out of the Actron ?

    I've got the connect thingywatzit, but find the app absolutely unreliable 99% of the time .. have thought about implementing something in Fibaro, but not gotten around to it.

     

    Cheers,

    al.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Actron are no real help at all. The only issue about my implementation is it still works over the cloud, so it's slightly delayed, but doesn't bother me at all. 

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