Hello everyone,
at the moment I am building my items and python scripts to read the status and also set new ones.
In first instance I am trying to read the power status (is the ac unit on or is it off?) and also set the power status to ON with a switch.
I created two exec things because in the http binding I was not able to add e.g. my token beaver which is needed to authenticate.
The first one is switching the AC unit on with a Rest API code which is stored in the python script file:
The second exec is getting the status every 10 seconds. It could be that the AC unit was turned on by the remote control…
In this case I also mapped the returned value to an Item.
These are my defined items -
First one: a Switch (which gets triggered every 10 seconds to receive the updates)
Second one: Displays the actual status:
Third one: The switch which triggers the Rest API to power on the AC unit.
Switch Klima_Essbereich_Switch_Akt "Klima Essbereich Status aktualisieren" {channel="exec:command:170d6e6a:run"}
String Klima_Essbereich_Switch "Klima Essbereich Status" {channel="exec:command:170d6e6a:output"}
Switch Klima_EG_Switch "Klima EG Switch" {channel="exec:command:1625dcdf:run"}
The actual value of the Status Item looks like this:
So I get back the whole string which I want to parse to display only the value “ON” or “OFF” in my sitemap / habpanel.
Any ideas how to do this? I tried some mapping with an *.js mapping file with no success.
Also when I hit the Switch to switch on my AC unit the device turns on - but as soon as the python script ends the switch get´s back to it´s initial status “OFF”.
Summarized I think I´m almost heading into right direction but I´m asking myself is this could be done easier than I am planning to do?
At least I will need lots of (dummy) items for holding status information. I guess also many rules are necessary to get this fully working.
Any input is much appreciated.
Thanks and best regards,
Mario