I am an integrator that has turned on to Loxone as the automation system of choice.The system is able to communicate very easily with a number of brands and devices via what they call virtual outputs. I could control via a secondary system, however, I would really like to remove as many moving parts as possible.
Could anyone help shed some light on this? Here is the documentation on the Loxone virtual outputs.
From the documentation, sounds like you should be able to integrate over http API commands with Bond directly.
A virtual output connector is used to control network devices. The device should be controlled using a Miniserver master server compatible protocol (tcp, udp, http, wol).
Everyone agrees it should work. Can’t seem to get there though. It would be great if the API integration commands were simplified similar to controlling an AVR for example.
The API is flexible enough to adapt to a wide variety of platforms, each with their own limitations. The Bond team has also helped the community when a certain new limitation is found. I haven’t found this API to be harder than other ones out there; in fact, it is easier than some systems.
The security aspect of it requires a little more detail than, say, some non-secure devices like AVRs or projectors that assume a locally issued command is automatically to be trusted - maybe that’s what is seeming more complicated than some other devices you’ve integrated.
What have you tried so far with http commands?
I, and others on the team, could try to help get at least ON and OFF for a device figured out for your platform.
It will help if you have access to a Windows Command Prompt or Mac / 'nix Terminal on the same network as a Bond Bridge for troubleshooting and initial design. Then we can take what works there and ‘translate’ it within the bounds of Loxone.
Hey @nausser.
We’ve been able to get a Virtual Output in Loxone to connect to a Bond Home API endpoint running firmware v2.17.4. As a simple test we used the /v2/sys/reboot API endpoint to reboot the Bond Home. We’ve yet to setup any Bond API Device Commands as Virtual Outputs however as a first step we’ve at least been able to get Loxone passing the token and interacting with the Bond API.
Below is the configuration we used for the Virtual Output in the Loxone config.
Virtual Output properties:
Address: http://bondipaddress
Close Connection after sending: ticked
Virtual Output Command properties:
Command for ON: /v2/sys/reboot
HTTP extensions for ON: leave blank
HTTP Post command for ON: {"_token": “bondtoken”}
HTTP Method for ON: PUT
I hope this helps.
Simon
Hello,
I was very hopeful. Still no response from the device yet. The primary function I’d like to get working is the light portion. I can work on fan speed/on/off secondary.
I’ve tried breaking up the command a few different ways so far.
These are the attributes and then a couple commands I can execute successfully from the cmd directly…
{“name”:“Nico’s Ceiling Fan”,“type”:“CF”,“location”:“Nico’s Room”,“template”:“C2”,“actions”:[“SetSpeed”,“StartDimmer”,“TurnOff”,“ToggleLight”,“Stop”,“TogglePower”,“TurnOn”,“IncreaseSpeed”,“DecreaseSpeed”,“TurnLightOn”,“TurnLightOff”],"":“af169cc9”,“commands”:{"":“128d3fab”},“state”:{"":“2f5107bf”},“properties”:{"":“a235efb6”},“skeds”:{"_":“15d90f76”}}
Command examples that work on cli:
curl -H “BOND-Token: BONDTOKEN” -i http://IPADDRESS/v2/devices/DEVICEID/actions/SetSpeed -X PUT -d “{“argument”: 2}”
curl -H “BOND-Token: BONDTOKEN” -i http://IPADDRESS/v2/devices/DEVICEID/actions/TurnOff -X PUT -d “{}”
In Loxone, I’ve tried, in the Command for ON:
/v2/devices/DEVICEID/actions/TurnLightOn -X -d
/v2/devices/DEVICEID/actions/TurnLightOn
/v2/devices/DEVICEID/actions/TurnLightOn -X PUT -d
/v2/devices/DEVICEID/actions/TurnLightOn -X PUT -d “{}”
Hopefully this may trigger a helpful thought! Thank you thus far! I’m trying to will a way here…
Hi @nausser,
The fan Virtual Output properties should be:
Address: http:// bondipaddress
Close Connection after sending: ticked
For the “lights on” Virtual Output Command properties try the following configuration:
Command for ON: /v2/devices/DEVICEID/actions/TurnLightOn
HTTP extensions for ON: leave blank
HTTP Post command for ON: {"_token": “ bondtoken ”}
HTTP Method for ON: PUT
For the “lights off” Virtual Output Command properties try the following configuration:
Command for ON: /v2/devices/DEVICEID/actions/TurnLightOff
HTTP extensions for ON: leave blank
HTTP Post command for ON: {"_token": “ bondtoken ”}
HTTP Method for ON: PUT
For the “fan speed” Virtual Output Command properties try the following configuration
Command for ON: /v2/devices/DEVICEID/actions/SetSpeed
HTTP extensions for ON: leave blank
HTTP Post command for ON: {"_token": “ bondtoken ”,“argument”: 2}
HTTP Method for ON: PUT
Hope this works.
I sure wish any of those would work, however, they do not. Other ideas?
Have you tried the reboot config I posted earlier? Does that work?
Hi @nausser ,
Looking at the command, appears you are attempting to triggering an action, not a device command which is what I’ve been testing.
I’ve managed to get blinds working through a Loxone Virtual Output however I’m using bond device commands for this, not actions.
What devices commands are available if you run:
curl -H “BOND-Token: BONDTOKEN” -i http://IPADDRESS/v2/devices/DEVICEID/commands -X GET
And run the below for each device command id?
curl -H “BOND-Token: BONDTOKEN” -i http://IPADDRESS/v2/devices/DEVICEID/commands/DEVICECOMMANDID -X GET
Thank you again.
Here is the output from the commands request from one of the device IDs.
{"":“acf60c25”,“1b0c25c3”:{"":“1c5fc224”},“1b3c51f9”:{"":“e0b4dfa4”},“2a6a9f02”:{"":“172bb1a9”},“529c2ffa”:{"":“9b981f01”},“33779f7d”:{"":“dcb344e8”},“287c6e83”:{"_":“193b6eec”}}
Not a whole lot of explanation though…
Sorry. Just now understanding the latter part of what to do… Funny thing though is the reboot command is not working either. Should the device do a full shut down and reboot with that?
Going into each of the commands that has a {} linked to it will give you more information.
As in:
curl -H "BOND-Token: BONDTOKEN" -i http://IPADDRESS/v2/devices/DEVICEID/commands/1b0c25c3 -X GET
would say more details about what that command is / does / parameters.
This is kind of like a tree structure you’re traversing.
How would I test the command after? I tried via cli with no luck. here is the command I tried and the return I get.
curl -H “BOND-Token: TOKEN” -i http://IPADDRESS/v2/devices/DEVICEID/commands/1b3c51f9 -X PUT
curl: (52) Empty reply from server
I also noticed I don’t have a dedicated on and off command for the light like I have available with the actions. I only have a light toggle command.
At some point in time it may be easier to do some sort of Zoom / Google Meet screenshare and call to help you through the initial testing and background understanding.
Meanwhile, in answer to your direct question - whenever you PUT a device command, you need a data payload (in some cases it will be empty, in other cases it will have parameters).
It also requires a “/tx” at the end.
curl -H "BOND-Token: TOKEN" -i http://IPADDRESS/v2/devices/DEVICEID/commands/1b3c51f9/tx -X PUT -d {}
As that documentation states, executing device commands rather than actions has a less desirable outcome in that it does not track state.
As far as your device having On / Off in Actions but not in Commands, that plays into the Bond’s State Belief - behind the scenes, the Action of Light Off will send a light power toggle command if the Bond thinks the light is on, and an Action of Light On will send a light power toggle command if the Bond thinks the light is off.
The preferred way would then be Actions like so:
curl -H "BOND-Token: TOKEN" -i http://IPADDRESS/v2/devices/DEVICEID/actions/TurnLightOn -X PUT -d {}
/
curl -H "BOND-Token: TOKEN" -i http://IPADDRESS/v2/devices/DEVICEID/actions/TurnLightOff -X PUT -d {}
Yes. And those work fine from the computer cli. Just transferring that to how Loxone breaks it up I guess is the challenge.
Thank you for all your help. Do you happen to have time today? I have a 1pm eastern call scheduled with a Loxone tech to try to work through getting this online. It’s been sitting on the back burner for a few months at this point. There have been several attempts in the past. Seems I’m not getting communication from Loxone at all though. Maybe there should be a space somewhere so when Loxone strings the command fragments back together, it is correct for the Bond to receive properly?
Let me know your schedule and thank you so very much for all your engagement on this!
I have time after 5:30 PM Eastern today if you are unable to get enough help from Loxone in translating.
One major difference is in CLI, you can put -H to pass the authentication token in the Header; the Loxone integration method needs to embed the _token parameter in the data / body of the request as it seems Loxone doesn’t support headers (from what I see in this thread).
So we somewhat quickly got everything working perfectly with the help of your advise of course. The reason I wasn’t getting any communication through was because the token was never being transmitted correctly with the quotes. It was an issue of copying and pasting from the web I guess.
" vs ”
As soon as that was changed. your instructions worked perfectly!! So thank you for all your help! This I’m sure will help hundreds of people if not more.
Those copy paste " symbols are so easy to forget.
I’m glad you’re all set now!
Additional thanks to Simon ( @uha )!
Good to hear @nausser.
Can you confirm if the Loxone Virtual Output Command configuration I posted above for the “Lights On”, “Lights Off” and “Fan Speed” Actions was what you managed to get working, or was there a different configuration you had to use?
It is as above here except when copying, the quotes have to be the correct format. I changed them here so I hope they stay the correct format and not “italicized“.
Thank you so very much! Now we can put the word out that it’s finally up and working perfectly!
After posting, I see they changed back again so just be sure the quotes around the bond token and argument is " and not “.