PanasonicTV / OH3

Good afternoon. I tried to implement the event listening mechanism. Please set the binding’s log-level to TRACE and show me the complete log starting with the thing initialization. Please turn off/on the device and switch some channels etc. I would like to see if this creates events we can use.

Latest is working in OH3 M3

I got a conflict error when the Binding was not running but it is all working now the conflict looks like.

For those following to fix you start the bundle DOC

openhab> update org.openhab.binding.panasonictv https://janessa.me/esh/org.openhab.binding.panasonictv-3.0.0-SNAPSHOT.jar
openhab> list org.openhab.binding.panasonictv
START LEVEL 100 , List Threshold: 50
 ID β”‚ State    β”‚ Lvl β”‚ Version            β”‚ Name
────┼──────────┼─────┼────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────
275 β”‚ Resolved β”‚  80 β”‚ 3.0.0.202011221150 β”‚ openHAB Add-ons :: Bundles :: Panasonic TV Binding


openhab> bundle:start 275


openhab> list org.openhab.binding.panasonictv
START LEVEL 100 , List Threshold: 50
 ID β”‚ State  β”‚ Lvl β”‚ Version            β”‚ Name
────┼────────┼─────┼────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────
275 β”‚ Active β”‚  80 β”‚ 3.0.0.202011221150 β”‚ openHAB Add-ons :: Bundles :: Panasonic TV Binding

@J-N-K So it shows up in the inbox with a UDN and is controllable tested with the HDMI. As expected from you it is working perfectly thankyou for migrating this to OH3.

You may use any port number, that doesn’t matter. The only events I ever got was On/Off. Also you need to periodically re-register the callback.

I’m currently working on my migration to OH3, I have about 800 legacy MQTT items that need rewriting. Takes quite some time and I won’t make any other changes before I’m done with that, otherwise that’d be a sure way to cause a huge mess.

1 Like

Openhab 3.0.0.M3

openhab> list org.openhab.binding.panasonictv                                                                                                                                            
START LEVEL 100 , List Threshold: 50
 ID β”‚ State  β”‚ Lvl β”‚ Version            β”‚ Name
────┼────────┼─────┼────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
217 β”‚ Active β”‚  80 β”‚ 3.0.0.202011221150 β”‚ openHAB Add-ons :: Bundles :: Panasonic TV Binding

Summary: binding does not work after switching tv off and on again.

OK: Discovery successful. Thing was in inbox.
OK: Added items for all channels was successful.
Improovments:

  • mute item should get category β€œsoundvolume_mute”

thing code:

UID: panasonictv:tv:4D454930_0100_1000_8001_A813742A3472
label: 40CX680_Series
thingTypeUID: panasonictv:tv
configuration:
  hostName: 192.168.178.30
  refreshInterval: 1000
  udn: 4D454930-0100-1000-8001-A813742A3472

Sent some commands to the keyCode item.
OK: HMDI1, HDMI3 switching successful
OK: sourceName changes also
OK: changing the volume from the item
OK: muting / unmuting from the mute item
OK: volume changes from the tv remote are detected and volume item is updated
OK: mute changed from the tv remote are detected and mute item is updated
OK: waitet ~3 Minutes and the binding is working
OK: switched tv off via remote: thing is offline
OK: swtiched tv on via remote: thing is online
NOT OK: after switching the tv on the items are not working: tried volume, mute, keyCode with hmdi switching; no volume events in logfile; tried to disable/enable thing and stop/start binding; still no item is working; had to restart openhab to get thing working
OK: sending power keyCode switches off the tv but same problem as above
NOT OK?: found some warnings in the logfile

Logfiles:
events.log (18.5 KB) openhab.log (427.4 KB)

I have a Viera TC-P65VT60 plasma that I have working through OH 2.5.9. No Issues. I am attempting to transition to OH 3.0.0M3 and have installed this binding. It is Active in the bundle:list and I am able to see the binding but when I attempt to Scan for the TV I am unsuccessful in adding the TV as a Thing. If I manually create a Thing for the Panasonic TV using it’s IP address it is created but the status is UNKNOWN and I am unable to control the TV through linked Items. Also I do not know what UDN is. When I check the TV menu I have an ESN which I take to be the same thing. How critical is it to have a correct UDN/ESN for the binding to function properly? Is this binding compatible with model of Panasonic TV?

Thanks for any help and guidance you can provide.

If discovery is not working, manually adding will not work either. You can ignore the UDN at the moment. Please show the log during discovery.

Very helpful. I have fixed two bugs, could you try again? Many thanks.

These are my log entries during a scan. This just repeats many, many times.

020-11-25 15:19:07.968 [DEBUG] [very.PanasonicTvDiscoveryParticipant] - Ignoring (RemoteDevice) Identity: (RemoteDeviceIdentity) UDN: uuid:3c1a39fc231c448b9e8c2f0842829173, Descriptor: http://192.168.0.100:8096/dlna/3c1a39fc231c448b9e8c2f0842829173/description.xml, Root: true: No thing UID created, probably not a Panasonic TV
2020-11-25 15:19:07.970 [DEBUG] [very.PanasonicTvDiscoveryParticipant] - Ignoring (RemoteDevice) Identity: (RemoteDeviceIdentity) UDN: uuid:3c1a39fc231c448b9e8c2f0842829173, Descriptor: http://10.253.0.1:8096/dlna/3c1a39fc231c448b9e8c2f0842829173/description.xml, Root: true: No thing UID created, probably not a Panasonic TV
2020-11-25 15:19:08.067 [DEBUG] [very.PanasonicTvDiscoveryParticipant] - Ignoring (RemoteDevice) Identity: (RemoteDeviceIdentity) UDN: uuid:3c1a39fc231c448b9e8c2f0842829173, Descriptor: http://10.253.0.1:8096/dlna/3c1a39fc231c448b9e8c2f0842829173/description.xml, Root: true: No thing UID created, probably not a Panasonic TV
2020-11-25 15:19:08.067 [DEBUG] [very.PanasonicTvDiscoveryParticipant] - Ignoring (RemoteDevice) Identity: (RemoteDeviceIdentity) UDN: uuid:3c1a39fc231c448b9e8c2f0842829173, Descriptor: http://192.168.0.100:8096/dlna/3c1a39fc231c448b9e8c2f0842829173/description.xml, Root: true: No thing UID created, probably not a Panasonic TV
2020-11-25 15:19:08.068 [DEBUG] [very.PanasonicTvDiscoveryParticipant] - Ignoring (RemoteDevice) Identity: (RemoteDeviceIdentity) UDN: uuid:3c1a39fc231c448b9e8c2f0842829173, Descriptor: http://172.17.0.1:8096/dlna/3c1a39fc231c448b9e8c2f0842829173/description.xml, Root: true: No thing UID created, probably not a Panasonic TV

.EDIT/UPDATE: I have found the issue that is preventing auto-discovery of the Panny TV. I am running OH3 in a Docker and with the Network connection in Bridge Mode and ports remapped -p 8090:8080. If I switch the Network to HOST and remove the remapped ports, then the TV is discovered. However, I then have a conflict running OH2 on the same port as Federation. I’m going to have spend time on this but I didn’t want you wasting your time to chase a problem that is mine. Thanks.

1 Like

Same as last time. After switching the tv off the binding does not receive volume events and any command failes.

Switched of via tv remote
A remoteDeviceRemoved event was immediately in the logfile.
Even after ~3 minutes later the thing was still online. see 08:18 to 08:21
The thing went offline on the first try at 08:15 but not on the second at 08:18.

START LEVEL 100 , List Threshold: 50
 ID β”‚ State  β”‚ Lvl β”‚ Version            β”‚ Name
────┼────────┼─────┼────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
217 β”‚ Active β”‚  80 β”‚ 3.0.0.202011251835 β”‚ openHAB Add-ons :: Bundles :: Panasonic TV Binding

found a null URL after startup

2020-11-26 08:12:28.545 [TRACE] [nt.PanasonicEventListenerServiceImpl] - Trying subscription: SUBSCRIBE /nrc/event_0 HTTP/1.1
User-Agent: OpenHAB/PanasonicTV/1.0
Host: 192.168.178.30:55000
CALLBACK: <http://null/nrc>
NT: upnp:event
TIMEOUT: Second-300

events.log (8.2 KB) openhab.log (83.5 KB)

I’m sorry. That was a silly mistake. I re-used a string for something different…

I also added some additional debugging around the shutdown.

Almost the same behavior as last time. After switching the tv off and on again the binding does not receive volume events and any command fails.

Switched of via tv remote
OK: A remoteDeviceRemoved event was immediately in the logfile and the thing went offline.
NOT OK: after switching the tv on the items are not working: tried volume, mute, keyCode with hmdi switching; no volume events in logfile
OK: the URL mentioned in the last post has now the ip of the openhab server.

START LEVEL 100 , List Threshold: 50
 ID β”‚ State  β”‚ Lvl β”‚ Version            β”‚ Name
────┼────────┼─────┼────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
217 β”‚ Active β”‚  80 β”‚ 3.0.0.202011261704 β”‚ openHAB Add-ons :: Bundles :: Panasonic TV Binding

events.log (6.0 KB) openhab.log (63.0 KB)

I wonder why the subscription always fails. I have changed that again and also reworked the thing status and power channel updates.

START LEVEL 100 , List Threshold: 50
 ID β”‚ State  β”‚ Lvl β”‚ Version            β”‚ Name
────┼────────┼─────┼────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
217 β”‚ Active β”‚  80 β”‚ 3.0.0.202011281621 β”‚ openHAB Add-ons :: Bundles :: Panasonic TV Binding
  1. scenario: tv was off around 09:00
    tv is off, start openhab and wait to be initialized; thing is unknown
    switch tv on; thing stays unknown
    waiting ~3 minutes; no changes
    disable and enable thing around 09:05
    items do not work

  2. scenario: tv was on around 09:08
    tv is on; start openhab and wait to be initialized; thing is online
    items are working ok
    switch tv off via remote control around 09:09
    thing stays online, could not find a remoteDeviceRemoved event in the logfile
    switching tv on via remote control around 09:10
    strange: immediately got an remoteDeviceRemoved event in the log
    items do not work
    disable and enable thing around 09:12
    items do not work

some thoughts:
Is there a scheduled task that checks if the thing is online and registers the event listeners?
Offline detection could be like a regular call to the device; maybe a ping or a get status call, or service discovery. How is this done in other bindings? A hue bridge might be online 24/7 but not a tv.
Is there a way I can debug this? Where can I find the source code?

events.log (4.9 KB) openhab.log (66.3 KB)

That seems to be even worse than before.

The problem is that the MediaRenderer is removed and not added back. This is needed for the items to work. I’ll check what I can do about that.

The subscription to the event should be the on/off detection, but it doesn’t seem to work. I have no idea why. I used exactly the code from @Flole but it always results in β€œ400 Bad Request”. @Flole, do you have an idea why this is the case?

Hi and thanks for you work.
I tested the binding Version 3.0.0.202011281621 and it works very good. I have a (pretty old) TX-50ASW654 and the tv was detected automatically by the binding.
What I really like is that the status of the thing is showing when the tv is on or off. I think this was not possible with the 1x binding.

Now i am struggling with the item handling in OH3. How do I add a keycode-command? I think I have to link a new item with the keycode channel and add metadata? But how is the syntax? Maybe someone can show a sample? Thank you. BR

Apparently it is working for @Tuny?

Maybe not all TV Models support it and that produces the 400 error. I am still not done with my migration so I can’t test yet, really sorry that it’s taking so long. I hope that I’ll finally get it done within the next 2 weeks, then I can have a look at how my TV reacts with your binding.

My implementation also has a small issue: When the connection is interrupted it doesn’t always re-subscribe and then the status is no longer updated. Just so you’re aware that this does happen and you might want to implement some kind of retry attempts if the code itself works.

I changed the service registration, please check if the thing status now changes to online after you received a value. I still need to figure out how to use the event registration, but I found a way to at least test a little bit with my Samsung TV (which uses UPnP, too).

Items should work and also control.

Openhab 3.0.0.M3 will test M4 later.

START LEVEL 100 , List Threshold: 50
 ID β”‚ State  β”‚ Lvl β”‚ Version            β”‚ Name
────┼────────┼─────┼────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
217 β”‚ Active β”‚  80 β”‚ 3.0.0.202011291818 β”‚ openHAB Add-ons :: Bundles :: Panasonic TV Binding
  1. scenario: tv was off around 07:55
    tv is off, start openhab and wait to be initialized; thing is unknown
    switch tv on; thing keeps unknown; keeps polling
    disable and enable thing around 07:56
    items do not work
    but there is a interesting log at this time
2020-11-30 07:56:00.613 [DEBUG] [very.PanasonicTvDiscoveryParticipant] - Ignoring DeviceInformation{thingUID=null, manufacturer='Panasonic', serviceType='MediaServer', udn='4D454930-0000-1000-8001-A813742A3472', host='192.168.178.30', friendlyName='40CX680_Series', modelName='Panasonic VIErA', serialNumber=''}: No thing UID created, probably not a Panasonic TV

restarted openhab

  1. scenaio: tv was on around 07:57
    tv is on; start openhab and wait to be initialized; thing is online
    items are working ok
    switch tv off via remote control arond 07:58
    thing stays online, could not find a remoteDeviceRemoved event in the logfile
    switching tv on via remote control before 07:59
    items do not work

events.log (5.5 KB) openhab.log (63.9 KB)

Ok. The new version has a completely rewrittem service handling and allows subscriptions to events. This should at least recover if the connection was lost. The thing status changes to OFFLINE if a communication error occurs and changes to ONLINE when the first value is successfully received. After I’ve seen the log, I can probably improve that with the newly added event subscription.

Openhab 3.0.0.M4

START LEVEL 100 , List Threshold: 50
 ID β”‚ State  β”‚ Lvl β”‚ Version            β”‚ Name
────┼────────┼─────┼────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
217 β”‚ Active β”‚  80 β”‚ 3.0.0.202011301450 β”‚ openHAB Add-ons :: Bundles :: Panasonic TV Binding

I use gupnp on fedora to discover upnp devices. It seems to not update if devices changes or it polls in long intervals. I don’t know. Restarting gupnp seems the only way to discover new services.

start gupnp
shows no panasonic device

first scenario: tv is off
10:32:21 restart openhab
thing is β€œerror: comm”

10:33 switch tv on via remote
thing is still β€œerror: comm”
gupnp shows
urn:panasonic-com:device:p00ProAVController:1
urn:schemas-upnp-org:device:MediaServer:1
restart gupnp shows
urn:schemas-upnp-org:device:MediaServer:1
urn:schemas-upnp-org:device:MediaRenderer:1
urn:panasonic-com:device:p00RemoteController:1
urn:panasonic-com:device:p00ProAVController:1

10:35 shutdown openhab

second scenario : tv is on
10:37:38 restart openhab
thing is online
volume changes are working
changing input to hdmi1 NOT working
I decompiled the jar and the polling method in RemoteControllerService is empty. This may be the reason for this not working, as the service is not registered.
10:39 switch tv off via remote
thing is β€œerror: comm”
gunpn shows no panasonic device
10:40 switch tv on via remote
restart gupnp
gupnp shows
urn:schemas-upnp-org:device:MediaServer:1
urn:schemas-upnp-org:device:MediaRenderer:1
urn:panasonic-com:device:p00RemoteController:1
urn:panasonic-com:device:p00ProAVController:1
thing is β€œerror: comm”
volume changes are NOT working

events.log (4.3 KB) openhab.log (425.8 KB)