Then I linked a switch Item with REGEX like it is described above.
Now, when the TV is ON, the string item value has the content of the xml file. This is good I think. But after turning the TV OFF, the switch item value does not change and I get this error in the logs.
You’re up against the problem that you can’t ask the TV if it is off or stolen etc.
The binding rightly complains that it cannot perform the connection that you asked it to do.
You can ignore the warn,and could use expire to set the associated Item state to OFF if updates stop coming.
Or use a rule to do the HTTP request, where you can handle a connect failure yourself.
Or consider an alternate method,like network binding ping, depending how much of the TV actually turns off.
I linked a string item to the channel (see above).
REGEX looks like this: .*<major>(.*?)</major>.*
Expiration Timer is set to 3s,command=0.
So when the tv is on the item has the value “1”.
When turing the tv off the value is not updated again and after 3s the value of the item is = 0.
This is all I need
Another way, for me, is to use the UPnP control binding.
After installing the binding, there are two things in my inbox:
upnpcontrol: upnpserver and upnpcontrol: upnprenderer
The thing upnpcontrol: upnprenderer is only visible when the TV is on.
In a rule, I ask the status of the thing upnpcontrol: upnprenderer every 10 seconds and change the status of my item tvistanaus
rule "Tvzustand"
when
Time cron '0/10 * * ? * * *'
then
var thingStatusInfo = getThingStatusInfo("upnpcontrol:upnprenderer:1E939897-0700-0000-8001-30B7CGG81LLK")
if ((thingStatusInfo !== null) && (thingStatusInfo.getStatus().toString() == "ONLINE")) {
tvistanaus.sendCommand (ON)
//logInfo("ThingStatus", "The thing TV is online.")
} else {
tvistanaus.sendCommand (OFF)
// logInfo("ThingStatus", "The thing TV is offline or doesn't exist.")
}
end