I really like the panasonic tv binding, but i’m missing a way to get the current state of the tv (on/off). I tried network binding and fritzbox tr064, but it’s not very accurate because my tv seems to get active in the middle of the night (getting updates, ???).
Is there a way to get the state (on/off) of my tv reliably?
I finally found out how to turn on my tv (55AS750-Series) using panasonic tv binding. I had to enable the following setting (in german):
“Netzwerk > TV Remote Einstellungen: Einschalten per App”
(In english maybe: network > TV remote settings: switch on by app)
The binding command {panasonictv=“tv:POWER”} is just a toggle button, so I don’t know if I switched the tv on or off.
thanks for sharing your solution! I’m doing it your way now.
I just liked the idea of powering on my tv using an openhab rule. But to do this I have to enable “Power On by App” in my tv settings. Unfortunately this means that my tv is always “pingable” and therefor is Online in openhab even if it is not running.
I measured power usage of the tv: when “Power On by App” is enabled and the tv is off, it draws 13.3W! (in running mode it is ~48W) So I don’t need/want to power on my tv by rule any more When I disable “Power On by App” it uses 0.0W (Model TX-55ASW754)
If someone is interested, I found a nice python script to control a panasonic tv: https://github.com/florianholzapfel/panasonic-viera
With this script it was possible to power on and off the tv (“Power On by App” was enabled) and it returned an error if you sent a command and the tv was switched off. The openhab binding always returns “200 OK” even if the tv is not running. Maybe someone wants to dig deeper.
Hi Andy,
Some panasonic TV’s send data to a multicast group. I assume it is part of the Discovery function for the Android and iOS apps. When the TV is turned on, it immediately sends out a multicast to port 1900 as below.
If the binding matched the source address and multicast to port 1900 then it could provide status. Not sure how to do this, may be there is a feature request for the binding.
Possible Solution to get current state (on/off) of Panasonic TV
Expected Behavior
Some kind of Switch to see the actual state
Current Behavior
You can‘t see if the TV is running or not
Possible Solution (works with my TX-55ASW654 )
If the TV is running, there is an XML Structure at Port 55000 of your TV IP Adress. If it‘s not running the structure is missing. And so you can check if a part of the xml File, for example 1 is available.
I don’t have a Panasonic TV, but here’s a more generic solution.
We recently purchased a TCL Roku TV. It has a fairly robust API, but I wasn’t happy with any of the available methods for getting timely status updates. On the Roku TV, the board seems to stay awake (and therefore pingable) for about 15 minutes after turning it off. That means that the network binding by itself isn’t a reliable way to get status.
The API has a method for returning information about the TV, including the power state, but that means two things. First, I would have to rely on at least two different items and some rules to get the status; information from the API as well as the network binding since the API obviously won’t be accessible once it goes into deep sleep. Second, I would have to be hitting the API quite a bit to get timely updates.
What I ended up doing is attaching a an ESP8266 with a photoresistor to the LED on the bottom of the TV that is on when it is powered off. With ESPEasy, this was pretty trivial and I get instant updates with no polling. I hate polling.
Also, as far as having to keep the TV in a higher power mode to turn it on remotely, you might see if sending a WOL packet before the power on command. On the TCL, after the 15 minutes when the board goes to sleep I have to send a WOL to get it to a state where the API is accessible again. This means you will probably have to hard wire the TV.
Thanks for your input, an interesting solution. You also can control the state of your TV by measuring the power consumption with a Z Wave wall plug.
I was looking for a „built in“ software solution.
Here is my log, what I dont understand is the question mark “?”
2019-01-27 11:23:09.041 [vent.ItemStateChangedEvent] - tvzustand changed from ? to
2019-01-27 12:00:41.636 [vent.ItemStateChangedEvent] - tvzustand changed from to ?
My config:
http.cfg
# timeout in milliseconds for the http requests (optional, defaults to 5000)
timeout=1000
# the interval in milliseconds when to find new refresh candidates
# (optional, defaults to 1000)
granularity=1000
# whether to substitute the current time or state value into the URL
# (optional, defaults to true)
format=true
# configuration of the first cache item
panazustand.url=http://192.168.10.136:55000/dmr/ddd.xml
panazustand.updateInterval=1000
# configuration of the second cache item
#<id2>.url=
#<id2>.updateInterval=
xxx.items
//Panasonic TV Alex Zimmer
String tvzustand {http="<[panazustand:30000:REGEX(.?(.?).*)]"}
Switch tvistanaus
Panasonicrefresh.rules
rule "Panasonicrefresh"
when
Item tvzustand changed
then
if (tvzustand.state.toString === null) {
logInfo("FILE","TV is off R:Panasonicrefresh" )
postUpdate(tvistanaus, OFF)
}
else if (tvzustand.state.toString == "1") {
logInfo("FILE","TV is on R:Panasonicrefresh" )
postUpdate(tvistanaus, ON)
}
end
I think it is doing what you tell it to. Try improving the Item definition - Switch tvistanaus "My TV [%s]"
Me neither. Something that doesn’t display properly, like an XML fragment.
I’m no good with REGEX, but I suspect it is not giving the string you expect.
You can find out by adding a logInfo to your rule logInfo ("testing", "mystery response " + tvzustand.state.toString)
Is the intention just to see if you get a response or not?
You could change your if-elseif to if-else
So I assume I get at least a response right? And the response is “?” ?
The intention in fact is to get a response or not, bcause the dedicated “ddd.xml” is only available in my browser when the TV is on, when TV is of i get HTTP ERROR 400.
So I changed the .rules file to:
rule "Panasonicrefresh"
when
Item tvzustand changed
then
logInfo ("testing", "mystery response " + tvzustand.state.toString)
if (tvzustand.state.toString === null) {
logInfo("FILE","TV is off R:Panasonicrefresh" )
postUpdate(tvistanaus, OFF)
}
else (tvzustand.state.toString == "1") {
logInfo("FILE","TV is on R:Panasonicrefresh" )
postUpdate(tvistanaus, ON)
}
end
But now I get always TV is on, doesnt matter if TV is ON or not.
2019-01-27 14:38:39.431 [INFO ] [lipse.smarthome.model.script.testing] - mystery response
2019-01-27 14:38:39.448 [INFO ] [.eclipse.smarthome.model.script.FILE] - TV is on R:Panasonicrefresh
That part is a nonsense; else is just else, with no condition.
OK, so this part is never satisfied. I think that’s because an empty string is not null. Try == "" instead, or change your if-else around to look for “?” for ON.
The [%s] part should give you string version of the Item’s value in your UI, for a switch that would be ON or OFF (or - for NULL)
But that behaviour could be overridden by your sitemap that we can’t see.
you followed my instructions and it should work. Your http.cfg and your rule looks fine. Have a look at your transformations in the Paper UI, maybe somethings missing?
The MAP Transformation is not necessary. Try to install Xpath and XSLT to solve the problem.
Its about a year ago and I dont remember everything exactly There was a lot of OpenHAB things to do in the meantime…
2019-02-03 02:34:30.257 [vent.ItemStateChangedEvent] - tvzustand changed from 1 to
2019-02-03 07:13:19.405 [vent.ItemStateChangedEvent] - tvzustand changed from to 1
But still
Maybe something with the rule is wrong?
rule "Panasonicrefresh"
when
Item tvzustand changed
then
if (tvzustand.state.toString === null ) {
logInfo ("FILE","TV is off R:Panasonicrefresh")
logInfo ("testing", "mystery response " + tvzustand.state.toString)
postUpdate(tvistanaus, OFF)
}
else if (tvzustand.state.toString == "?") {
logInfo("FILE","TV is on R:Panasonicrefresh" )
logInfo ("testing", "mystery response " + tvzustand.state.toString)
postUpdate(tvistanaus, ON)
}
end
Well, yes, you’ve changed what states the Item takes, but not what the rule is looking for.
Discussed earlier that tvzustand.state.toString === null is not the same as empty string “”
rule "Panasonicrefresh"
when
Item tvzustand changed
then
if (tvzustand.state.toString == "1") {
logInfo("FILE","TV is on R:Panasonicrefresh" )
tvistanaus.postUpdate(ON)
} else {
logInfo ("FILE","TV is off or stolen")
tvistanaus.postUpdate(OFF)
}
end