Get current state (on/off) of panasonic tv

Anyone got this working with oh3?

I created a new “HTTP URL Thing” like this:

UID: http:url:1ac62f82a2
label: HTTP URL Thing TV
thingTypeUID: http:url
authMode: BASIC
ignoreSSLErrors: true
baseURL: http://x.x.x.x:55000/dmr/ddd.xml
refresh: 2
commandMethod: GET
contentType: text/xml
timeout: 3000
bufferSize: 2048

  • id: “1”
    channelTypeUID: http:string
    label: Test
    description: “”
    mode: READONLY

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.

2021-02-14 17:59:33.643 [WARN ] [p.internal.http.HttpResponseListener] - Requesting ‘http://x.x.x.x:55000/dmr/ddd.xml’ (method=‘GET’, content=‘null’) failed: 400 Bad Request

Anyone got an idea?

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.

Thanks for the tip. Now it is working.

I linked a string item to the channel (see above).

REGEX looks like this:

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 :slight_smile:

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"
	Time cron '0/10 * * ? * * *' 

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.")