This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
[how to] Domoticz to Homey (using httplink)
techniman
Member
Because I'm not yet ready to leave my current system, also because of historical data .. but I do want to utilize Homey as much as possible, I created some scripts to update data/switches in Homey, because I want this to be accurate I opted for a push model,
which I recently tweaked to use the httplink instead , I'll describe the whole thinngjust in case someone was looking for (part of) the information.
Initially I created a separate folder in the domoticz/scripts/ folder named homey
and I added a script to each switch, for example the front door..
Since I do not want to create and maintain this for all my switches I tried to use the httplink,
this was unfortunately not working properly in domoticz, but is now fixed in one of the newer builds
Next I could not get it to work from domoticz to homey>betterlogic directly, i'm getting errors related to variables not being found ..
Anyway the setvars script worked so i decided to utilize that;
First install a webserver, if you have one already use that, for the Pi I used the lightweight Lighttpd, instructions here :
https://raspberrytips.nl/lighttpd-php-webserver-raspberry-pi/
Drop the following code in a php file and save in the www directory (alternatively in the www/html/ directory)
(do not forget to update the location of the .sh script )
which I recently tweaked to use the httplink instead , I'll describe the whole thinngjust in case someone was looking for (part of) the information.
Initially I created a separate folder in the domoticz/scripts/ folder named homey
and I added a script to each switch, for example the front door..
script:///home/pi/domoticz/scripts/homey/setvar.sh frontdoor openThe script is :
#!/bin/bash BEARER="Bearer <YOUR BEARER KEY HERE>" # notice the space between Bearer and the key HOMEY_IP="192.168.1.XX" URL="http://${HOMEY_IP}/api/app/net.i-dev.betterlogic/${1}/${2}" curl -H "Content-Type: application/json" -H "Authorization: ${BEARER}" -X PUT ${URL}Do not forget to mark it as executable
sudo chmod +x ./setvar.sh
Since I do not want to create and maintain this for all my switches I tried to use the httplink,
this was unfortunately not working properly in domoticz, but is now fixed in one of the newer builds
Next I could not get it to work from domoticz to homey>betterlogic directly, i'm getting errors related to variables not being found ..
Anyway the setvars script worked so i decided to utilize that;
First install a webserver, if you have one already use that, for the Pi I used the lightweight Lighttpd, instructions here :
https://raspberrytips.nl/lighttpd-php-webserver-raspberry-pi/
Drop the following code in a php file and save in the www directory (alternatively in the www/html/ directory)
(do not forget to update the location of the .sh script )
<?php $variable = $_GET['variable'] ; $val = trim($_GET['val']) ; $cmd = shell_exec ( '/home/pi/domoticz/scripts/homey/setvar.sh '.$variable.' '. $val.' ' ); echo "200" ; ?>
Now go to Domoticz >Setup>More options>Data push>HTTP
and add the URL to the proper field under the "General Settings", i'm pretty sure you can use the localhost instead of the IP address,
but i have the IP address of the domoticz server..
Next create the "better logic variables" e.g. the ones that are in your homey, it does not matter if you create them before or afterwards
This is done under the "Edit Link" header on the left, make sure you include or exclude the unit based on the Better Logic variable type!
Note, personally I try not to use any spaces, but this might work (not tested)
and add the URL to the proper field under the "General Settings", i'm pretty sure you can use the localhost instead of the IP address,
but i have the IP address of the domoticz server..
http://192.168.1.XX/httplink.php?variable=%V&val=%v
Next create the "better logic variables" e.g. the ones that are in your homey, it does not matter if you create them before or afterwards
This is done under the "Edit Link" header on the left, make sure you include or exclude the unit based on the Better Logic variable type!
Note, personally I try not to use any spaces, but this might work (not tested)
Comments
You’re the best!
I would be very grateful.
Thanks in advance.
Have a nice one.
Great that I could be of help.
Hardware is a mixture of
- Z-wave => mainly Fibaro relays, Aeotec multi sensors and NEO Powerplugs
- ZigBee => mainly Xiaomi doorsensors
- Philips Hue strips/bulbs.
- and some KlikAanKlikUit that I hope to replace soon.
These used to be controlled by Domoticz running on my Synology NAS via a Z-wave usb stick (KaKu was controlled separately).
I still use Domoticz, but it only logs electricity and gas usage from my 'slimme meter' via a P1 cable into the Synology NAS.