In current 2.4 snapshots the Tellstick Binding seems to be completely broken. Since I haven’t been able to solve the Binding (and haven’t got any response for my requests for help) I’ve instead done some workarounds, thought I’d share them if anyone else has the same problem. Please note that this is not a solution for the problem, just a temporary workaround. Has worked fine for me last week though
Also note that my setup is kinda simple. Most of my house uses Z-Wave, I’ve only got some old stuff that’s still using 433. So if you’ve got more complicated setup you obviously have to think a bit longer than me
Device events from OH to Tellstick
When an Item in OH changes state you could simply call tdtool using executeCommandLine() to also change it’s state there. The syntax for this is either "tdtool --on " or "tdtool --off " (assuming you haven’t got any dimmers which I haven’t. Guess that’s possible as well but surely more complicated).
I simply wrote one rule per device, haven’t got that many. The rules ended up like this:
rule "Tellstick workaround 16"
when
Item Utebelysning received command
then
executeCommandLine("tdtool --" + receivedCommand.toString.toLowerCase + " 16")
end
Device events from Tellstick to OH
When a key is pressed on a Tellstick device you also want to change the corresponding OH Item. The easiest way to do that is using the scripts in /usr/local/share/telldus/scripts that the Telldus service executes (for more info on this see here). Note that this only works on Linux and also that after you’ve created a script you need to restart the telldusd service so it picks up the new script. Also make sure the script is executable (ie has the x flag set).
My script (/usr/local/share/telldus/scripts/deviceevent/whatever.sh) looks something like the below. The METHOD argument is kinda backwards, hence the case stuff. I’ve only got the one doorbell device I’m interested in, you’ll have to manually add your devices in the same fashion:
#!/bin/bash
case ${METHOD} in
1)
status="ON"
;;
2)
status="OFF"
;;
esac
if [ ${DEVICEID} = "20" ] ; then
curl -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "${status}" "http://cube:8080/rest/items/RingklockaYtterdorr/state"
fi
Sensor events from Tellstick to OH
Sensor readings works about the same way as device events, it’s just another script being called and some other input variables. It’s a tiny bit more complicated checking for the right sensor though, since there can be more sensors with the same id. Just run a “tdtool --list” from the console to check your sensor’s protocol, model and id.
My script (/usr/local/share/telldus/scripts/sensorevent/whatever.sh). Again just add more rows if you’ve got more sensors:
#!/bin/bash
#For sensors that only send one kind of value you can do the following
if [ ${PROTOCOL} = "fineoffset" ] && [ ${MODEL} = "temperature" ] && [ ${SENSORID} = "203" ] ; then
curl -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "${VALUE}" "http://cube:8080/rest/items/Utetemp_verandan/state"
fi
#For sensors sending different kinds of values (for example temperature and humidity) you'd have to take the type of date into account:
if [ ${PROTOCOL} = "fineoffset" ] && [ ${MODEL} = "temperature" ] && [ ${SENSORID} = "203" ] ; then
case ${DATATYPE} in
1)
device="mytempsensor"
;;
2)
device="myhumiditysensor"
;;
4)
device="myrainratesensor"
;;
8)
device="myraintotalsensor"
;;
16)
device="mywinddirectionsensor"
;;
32)
device="mywindaveragesensor"
;;
64)
device="mywindgustsensor"
;;
esac
curl -X PUT --header "Content-Type: text/plain" --header "Accept: application/json" -d "${VALUE}" "http://cube:8080/rest/items/${device}/state"
fi