I’ve install the 2.5.0 version of the tabo binding in openhab2.
Reading and persisting tado item values works like a breeze, not problem.
I have defined the tado things and items in text files.
Problem: when I change an item state, it is reset to its previous value after some time. Below is a typical example in the Karaf interface, the same happens when I try to write a rule.
It looks like the changes are not writting back all the way to the tado server and get updated back from the server to openhab at the next polling cycle.
Anyone can help ?
223 │ Active │ 80 │ 2.5.0.201903171839 │ Tado Binding
openhab> bundle:restart 223
openhab> smarthome:update badkamer_tado_opmode “MANUAL”
Update has been sent successfully.
openhab> smarthome:status badkamer_tado_opmode
SCHEDULE
openhab> smarthome:update badkamer_tado_opmode “MANUAL”
Update has been sent successfully.
openhab> smarthome:status badkamer_tado_opmode
MANUAL
openhab> smarthome:status badkamer_tado_opmode
SCHEDULE
openhab>
When you post and update to an Item, it only changes the Item’s state within openHAB. To cause that new state to be sent to the device, you need to use a command.
What is happening here is you are updating the state of the Item within openHAB. Then the binding polls the device and restores the state of the Item to the state of the device.
@rlkoshak, thanks for your help, your suggestion did the trick for that one rule, however, it broke another rule. It’s some problem with QuantityTypes which I can’t solve even after hours of searching through the documentation
The rule that is now working
rule “Update tado badkamer”
when
Item badkamerOpwarming changed
then
if (badkamerOpwarming.state == ON){
logInfo(“Badkamer”, “Badkamerverwarming AAN”)
badkamer_tado_target_raw.sendCommand(20.0|°C)
badkamer_tado_opmode.sendCommand(“TIMER”)
badkamer_tado_timerDuration.sendCommand(20)
}
else{
logInfo(“Badkamer”, “Badkamerverwarming UIT”)
badkamer_tado_opmode.send(“SCHEDULE”)
}
end
The rule that broker is this one (I tried solving the QuantityType issue without success)
var QuantityType<Number> offset = 2.0|°C
var QuantityType<Number> target
rule “Compenseert voor de temperatuur offset op de temperatuur meting in de badkamer door Tado”
when
Item badkamer_tado_target_raw changed
then
logInfo(“Badkamer”, ">>> Badkamer TADO temp RAW changed to " + badkamer_tado_target_raw.state)
logInfo(“Badkamer”, ">>> offset " + offset)
target = badkamer_tado_target_raw.state as QuantityType<Number> + offset
logInfo(“Badkamer”, ">>> Calculated target temperature is " + target )
postUpdate(badkamer_tado_target, target)
end
The error message is
21:46:16.449 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule ‘Compenseert voor de temperatuur offset op de temperatuur meting in de badkamer door Tado’: Could not cast 25.0 to org.eclipse.smarthome.core.library.types.QuantityType; line 11, column 14, length 54
I don’t do much with quantity types so I can’t say I know what the error means. But just from reading it it looks like you have something that is 25 and not 25|°C. Is your badkamer_tado_target_raw Item defined as a Number:Temperature?
@rlkoshak
Do you know of any decent explanation about adding QuantityType<Temperature> values ? Or do you know anyone who’s knowledgeable in the field of calculating with temperatures ?
@rlkoshak
I meant an operator that prints the type of a variable like typeof myVariable. I have a c# background, it exists there and it’s a very handy operator.
OK, found the solution,
Define the items as Number, NOT as Number.Temperature and cast everything in the rue to Number.
// sets the counter to the value of a received command
rule "Compenseert voor de temperatuur offset op tado"
when
Item badkamer_tado_target_raw changed
then
var rawTemp = badkamer_tado_temp_raw.state as Number
var offset = 3.0 as Number
badkamer_tado_temp.postUpdate(rawTemp + offset)
var rawTarget = badkamer_tado_target_raw.state as Number
badkamer_tado_target.postUpdate(rawTarget + offset)
logInfo("Badkamer", "Badkamer temperatures offset was as SUCCES !!!!")
end