Hi,
I’m having a problem trying to program a python script. I have openhab 2.5 with openhabian and using the Rule Engine.
I have an item from my tado binding linked to a zone thing (tado° - Bindings | openHAB). This item is of type Number and dimension Temperature. When using the paper UI it shows its value as 20.0 ºC.
Now, I’m trying to make an example rule to alert me the value. My code is:
from core.actions import NotificationAction
item = itemRegistry.getItem("CalefacciN_TargetTemperature")
msg = u"Salón programado a " + str(item.getState())
NotificationAction.sendLogNotification(msg)
The problem is that whenever I run this rule I get the error:
2020-01-02 16:47:15.510 [ERROR] [internal.handler.ScriptActionHandler] - Script execution failed: UnicodeEncodeError: 'ascii' codec can't encode character u'\xb0' in position 5: ordinal not in range(128) in <script> at line number 4
I think it’s related with the º character.
I have tried different ways to fix it, but I can’t find the correct way to get the value of the item.
Any help? Thanks.