Controlling Fibaro Home Center scenes from Vera

Hello

i just received my HCL a couple of days ago , even though it’s interface is better and it’s faster but it’s limited since it’s without LUA and doesn’t support all the devices . I got it to control my veralite scenes using this command

GET /data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=42 HTTP/1.10x0D0x0A0x0D0x0A

But i wanted to do other stuff like

  • Controlling devices in vera not just scenes ( ON / OFF command should be enough ) i’ll use it for my XBMC

  • Do the same with HCL , i would like to control it’s devices or scenes via HTTP from vera , is that possible ?

Thanks
Rami

Controlling devices in vera not just scenes ( ON / OFF command should be enough ) i'll use it for my XBMC

See: Luup Requests: action.

Do the same with HCL , i would like to control it's devices or scenes via HTTP from vera , is that possible ?

You may need to ask that question on the Fibaro forum.

@RexBeckett

It worked perfectly , thank you so much

@RexBeckett

I found the command on the forum , do you know how i can send an http command from vera ?

it’ll be like this

http://admin:admin@hc2_ip/api/callAction?deviceID=60&name=setValue&arg1=100

Thanks
Rami

local status, response = luup.inet.wget("http://admin:admin@hc2_ip/api/callAction?deviceID=60&name=setValue&arg1=100")

If successful, this will return numeric 0 in status otherwise it will be an error code.

@RexBeckett

Sorry for asking too much , but where so i test this ? in scenes ?

[quote=“Ramiii, post:6, topic:180412”]@RexBeckett

Sorry for asking too much , but where so i test this ? in scenes ?[/quote]

Well I would recommend using LuaTest but I am rather biased. ;D This would allow you to have print statements to show what happened:

local status, response = luup.inet.wget("http://admin:admin@hc2_ip/api/callAction?deviceID=60&name=setValue&arg1=100") print("status: " .. status) print("response: " .. response)

You could also just run the wget call in APPS → Develop Apps → Test Luup code (Lua) (Click GO to execute it).

Rex,

I gather from the previous question, it may not be completely clear how LuaTest is utilised.

Phase 1 load files.
Phase 2 launch script or add to start up.
Phase 3 test via LuaTest html page.

Being :3480/data_request?id=lr_LuaTest.

If you want to generate a specific file name as per your instructions

:3480/data_request?id=lr_LuaTest&file=<filename.lua>

If <filename.lua> starts with a / it is assumed to be a full pathname otherwise it will be located in /etc/cmh-ludl/. If you do not provide a filename, the default luatest.lua will be used.

I believe once they have the concept, they will no doubt thank you for the tool you have provided. Of course the ability to quickly get SID without jumping in and out or additional restarts that most users do modifying scene will become memories…

Thanks again @RexBeckett

Tried it but it doesn’t seem to work , my next question would be how do i make use of it ,

I have no experience in programming and just got my veralite couple of month ago , i don’t even know what LUA is , i just got familiar with it from the forums here

HTTP command works fine in the browser though

[quote=“Ramiii, post:9, topic:180412”]Thanks again @RexBeckett

Tried it but it doesn’t seem to work , my next question would be how do i make use of it ,

I have no experience in programming and just got my veralite couple of month ago , i don’t even know what LUA is , i just got familiar with it from the forums here

HTTP command works fine in the browser though[/quote]
If you don’t want to learn how to write Lua, just use Vera’s built-in test facility. Select the APPS tab, select the Develop Apps sub-tab, select the Test Luup code (Lua) menu item. Now copy paste the code below into the Code box and click GO.

If it works correctly, you can paste the code into the LUUP tab of a scene and set the trigger(s) as required.

luup.inet.wget("http://admin:admin@hc2_ip/api/callAction?deviceID=60&name=setValue&arg1=100")

[quote=“Brientim, post:8, topic:180412”]Rex,

I gather from the previous question, it may not be completely clear how LuaTest is utilised.[/quote]

You are almost certainly right, my friend, but I’m not sure how to explain it in a better way…

@RexBeckett

It’s working now , looks like the problem was the HCL authentication . I don’t know what went wrong though , changed the password and it’s not good .

As far as i understand these are the only actions i can perform , right ? http://wiki.micasaverde.com/index.php/Luup_Requests#action

So i can’t lock and unlock doors or is it the same as ON / OFF COMMAND ?

As far as i understand these are the only actions i can perform , right ?

As long as you specify the appropriate serviceID, action name and argument, you should be able to perform any action.

If you managed to install LuaTest, the Device Action List button will give you a list of all available actions for your devices.

Rex, a couple of beers for the work you do…

Thanks for the beers. I haven’t had a Newkie Brown in years. :smiley: I like your approach to documenting LuaTest. That would no doubt help a lot.

Rex , found the commands using LuaTest , will try to figure out how to utilize them .

Thanks for all your help , i believe the beer should be on me

Sorry for reviving an old thread…
I have a Fibaro Home Center 2 to do some tests. First I want to switch a light conected to the HC2 from my Vera.
via http request in my browser works as a charm (very fast)

http://192.168.1.8/api/callAction?deviceID=11&name=turnOff

But from my vera using:

luup.inet.wget("http://192.168.1.8/api/callAction?deviceID=11&name=turnOff")

It does not work…
Who can help me out here?

Anyone that can help me?

By doing some googling (not on this forum…) I found the solution.
The right code is:

luup.inet.wget("http://xxxxxx%40xxxxx:passw@<ip-adress HC2>/api/callAction?deviceID=nn&name=turnOff") 

where “xxxxxxx%40xxxxx” = the username of the HC2 this is an e-mail adress, you have to use "%40"in stead of “@”.
passw = the password used to login to the HC2
speaks for it self…
nn = the deviceID nr of the device you want to switch in the HC2 from the Vera

THIS WORKS !!