FORUM FIBARO
Forum systemu FIBARO

| FAQ |  Search |  Memberlist |  Usergroups |  Statistics |
| Register |  Log in |  Album |  Download |

Previous topic «» Next topic
Beta API - http Commands (3.341)
Author Message
Adv.Usr.deraaij 

Age: 34
Joined: 19 Jul 2012
Posts: 295
Location: Netherlands
Posted: 2013-01-13, 13:33   Beta API - http Commands (3.341)

Hi all,

Just to share for those who did not figure it out already, the following http commands work with the beta version:

Devices:
ID = device ID
name = action
arg1 = (e.g. value dimmer)
http://<HC2 ip address>/api/callAction?deviceID=4&name=turnOff
http://<HC2 ip address>/api/callAction?deviceID=7&name=setValue&arg1=39

Virtual Devices
ID = device ID
arg1 = button ID
arg2 = slider value (only for slider)
http://<HC2 ip address>/api/callAction?deviceID=15&name=pressButton&arg1=2
http://<HC2 ip address>/api/callAction?deviceID=51&name=setSlider&arg1=8&arg2=30

Notification
ID = Device (Iphone, e-mail et cetera)
arg1 = Notification template
http://<HC2 ip address>/api/callActiondeviceID=9&name=sendDefinedPushNotification&arg1=1

Scene
ID = SceneID

http://<HC2 ip address>/api/sceneControl?id=14&action=start
http://<HC2 ip address>/api/sceneControl?id=14&action=stop

Get json status from api:

http://<HC2 ip address>/api/rooms
http://<HC2 ip address>/api/scenes
http://<HC2 ip address>/api/devices
http://<HC2 ip address>/api/devices?id=316 # Specific value of a device
http://<HC2 ip address>/api/virtualDevices
http://<HC2 ip address>/api/globalVariables
http://<HC2 ip address>/api/weather
http://<HC2 ip address>/api/sections
http://<HC2 ip address>/api/users
http://<HC2 ip address>/api/energy/now-3600/now/single/devices/power/58

etc.

change variabele example:

Unfortunately will not trigger scene (yet):

curl -X PUT -d '{"name": "Test", "value": "122"}' http://admin:admin@192.16...globalVariables

Regards,

Mark
Last edited by deraaij on 2013-03-29, 21:24; edited 4 times in total  
 
     
ARIAS

Joined: 17 Jul 2012
Posts: 66
Location: Leon
Posted: 2013-01-14, 00:54   

thank you very much, I note for later
 
     
Adv.Usr.sztywniak 
Nie odpowiadam na pw

Joined: 31 Oct 2011
Posts: 363
Location: Poland
Posted: 2013-01-14, 01:54   Re: Beta API - http Commands

del
 
     
Adv.Usr.deraaij 

Age: 34
Joined: 19 Jul 2012
Posts: 295
Location: Netherlands
Posted: 2013-01-14, 08:44   Re: Beta API - http Commands

sztywniak wrote:
del


Sorry, I don't get what you mean?
 
     
Adv.Usr.sztywniak 
Nie odpowiadam na pw

Joined: 31 Oct 2011
Posts: 363
Location: Poland
Posted: 2013-01-14, 10:42   

I don't delete my post ;-)
 
     
Adv.Usr.deraaij 

Age: 34
Joined: 19 Jul 2012
Posts: 295
Location: Netherlands
  Posted: 2013-01-14, 10:45   

hahahah, sorry....
 
     
jompa68 

Age: 44
Joined: 14 Jan 2013
Posts: 87
Location: Sweden
Posted: 2013-01-17, 19:54   

Is it possible to set variable value with json instead of curl like you did describe?
I have search on doc.fibaro.com but i could not find anything.
 
     
Adv.Usr.deraaij 

Age: 34
Joined: 19 Jul 2012
Posts: 295
Location: Netherlands
Posted: 2013-01-17, 21:52   

jompa68 wrote:
Is it possible to set variable value with json instead of curl like you did describe?
I have search on doc.fibaro.com but i could not find anything.


I don't get exactly what you mean, the payload is json encoded. With which language do you want to do it?

Regards,

Mark
 
     
jompa68 

Age: 44
Joined: 14 Jan 2013
Posts: 87
Location: Sweden
Posted: 2013-01-17, 22:14   

deraaij wrote:
jompa68 wrote:
Is it possible to set variable value with json instead of curl like you did describe?
I have search on doc.fibaro.com but i could not find anything.


I don't get exactly what you mean, the payload is json encoded. With which language do you want to do it?

Regards,

Mark


if it is possible to set a globalvariable in HC2 with a http://machine/setglobalV...value=somevalue command
I working with siriproxy :)
 
     
Adv.Usr.deraaij 

Age: 34
Joined: 19 Jul 2012
Posts: 295
Location: Netherlands
Posted: 2013-01-17, 22:32   

jompa68 wrote:
deraaij wrote:
jompa68 wrote:
Is it possible to set variable value with json instead of curl like you did describe?
I have search on doc.fibaro.com but i could not find anything.


I don't get exactly what you mean, the payload is json encoded. With which language do you want to do it?

Regards,

Mark


if it is possible to set a globalvariable in HC2 with a http://machine/setglobalV...value=somevalue command
I working with siriproxy :)


In siriproxy you could use httparty.put. You could also kick of a scene which updates the value, in that case you can use a normal get.

Regards,

Mark
 
     
jompa68 

Age: 44
Joined: 14 Jan 2013
Posts: 87
Location: Sweden
Posted: 2013-01-18, 07:09   

deraaij wrote:
jompa68 wrote:
deraaij wrote:
jompa68 wrote:
Is it possible to set variable value with json instead of curl like you did describe?
I have search on doc.fibaro.com but i could not find anything.


I don't get exactly what you mean, the payload is json encoded. With which language do you want to do it?

Regards,

Mark


if it is possible to set a globalvariable in HC2 with a http://machine/setglobalV...value=somevalue command
I working with siriproxy :)


In siriproxy you could use httparty.put. You could also kick of a scene which updates the value, in that case you can use a normal get.

Regards,

Mark


Scene that updates the variable did the trick :mrgreen:
Thanks Mark!
 
     
Adv.Usr.deraaij 

Age: 34
Joined: 19 Jul 2012
Posts: 295
Location: Netherlands
Posted: 2013-01-18, 09:03   

jompa68 wrote:

Scene that updates the variable did the trick :mrgreen:
Thanks Mark!


You are welcome! If you have anything to share with regard to siriproxy, please do!

Regards,

Mark
 
     
Lockzi

Joined: 15 Sep 2012
Posts: 23
Location: Stockholm
Posted: 2013-02-23, 02:05   

Does HC2 also ACCEPT JSON input?
 
     
richo 

Joined: 02 Nov 2012
Posts: 222
Location: Gdynia
Posted: 2013-02-27, 17:46   

Anyone knows how to get the status i.ex. of just dead devices?
_________________
richo
_________
HC2 v3.545
---------------------------------------------
Devices:160 Rooms:27 Scenes:65
 
     
A.Socha 
FIBAR GROUP

Joined: 26 Oct 2012
Posts: 683
Location: Poznan
Posted: 2013-02-27, 17:52   

richo,
Code:
--[[
%% properties
%% globals
--]]
local status = fibaro:getValue(371, "dead");
fibaro:log(status);


1 dead
0 live
 
     
Display posts from previous:   
Reply to topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
Add this topic to your bookmarks
Printable version

Jump to:  

Powered by phpBB modified by Przemo © 2003 phpBB Group
Theme created by kemustek from Forum PC
Page generated in 0.05 second. SQL queries: 13