Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lgwebos] channel number not always updated in case you switch between sources #7243

Closed
lolodomo opened this issue Mar 28, 2020 · 5 comments
Closed
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@lolodomo
Copy link
Contributor

lolodomo commented Mar 28, 2020

If you use only the tuner source of your LG TV, the channel channel is updated as expected when your TV channel is changed.
But after switiching between sources and then coming back to the TV tuner, it can happen that the channel channel is no more updated.
I am not yet sure whether the trigger of the problem is the TV source not being the TV tuner when the binding is started.

@lolodomo lolodomo added the bug An unexpected problem or unintended behavior of an add-on label Mar 28, 2020
@lolodomo
Copy link
Contributor Author

lolodomo commented Mar 28, 2020

I finally found how to reproduce this bug. It happens if I switch to HDMI3 and then come back to TV tuner. Note that I have no device connected to HDMI3.
Here are the logs:

18:44:58.200 [INFO ] [smarthome.event.ItemStateChangedEvent] - TvApplication changed from com.webos.app.hdmi3 to com.webos.app.livetv
18:44:58.211 [DEBUG] [g.lgwebos.internal.BaseChannelHandler] - LauncherApplication received: org.openhab.binding.lgwebos.internal.handler.core.LaunchSession@cf4382.
18:44:58.267 [TRACE] [ebos.internal.handler.LGWebOSTVSocket] - Message [in]: {"type":"response","id":3,"payload":{"subscribed":true,"appId":"com.webos.app.livetv","returnValue":true,"windowId":"","processId":""}}
18:44:58.277 [DEBUG] [webos.internal.handler.LGWebOSHandler] - postUpdate channelId appLauncher state com.webos.app.livetv
18:44:58.301 [TRACE] [ebos.internal.handler.LGWebOSTVSocket] - Message [out]: {"type":"unsubscribe","id":11}
18:44:58.313 [DEBUG] [g.lgwebos.internal.BaseChannelHandler] - Unsubscribed org.openhab.binding.lgwebos.internal.TVControlChannel on Thing: lgwebos:WebOSTV:tv
18:44:58.323 [TRACE] [ebos.internal.handler.LGWebOSTVSocket] - Message [out]: {"type":"subscribe","id":16,"uri":"ssap://tv/getCurrentChannel"}
18:44:58.335 [DEBUG] [g.lgwebos.internal.BaseChannelHandler] - Subscribed org.openhab.binding.lgwebos.internal.TVControlChannel on Thing: lgwebos:WebOSTV:tv
18:44:58.425 [TRACE] [ebos.internal.handler.LGWebOSTVSocket] - Message [in]: {"type":"response","id":16,"payload":{"returnValue":true}}
18:44:58.433 [INFO ] [ing.lgwebos.internal.TVControlChannel] - retrieving channel: ChannelInfo [channelId=null, channelNumber=null, channelName=null, channelType=null].

As you can see, the subscribe message is leading to an answer that does not include the expected channel information (values are null) and without the field subscribed in the payload.
Then if I change the channel with my remote control, no message is received and so of course the channel is not updated.

Here are the logs when it works:

18:42:05.325 [TRACE] [ebos.internal.handler.LGWebOSTVSocket] - Message [out]: {"type":"subscribe","id":11,"uri":"ssap://tv/getCurrentChannel"}
18:42:05.336 [DEBUG] [g.lgwebos.internal.BaseChannelHandler] - Subscribed org.openhab.binding.lgwebos.internal.TVControlChannel on Thing: lgwebos:WebOSTV:tv
18:42:05.444 [TRACE] [ebos.internal.handler.LGWebOSTVSocket] - Message [in]: {"type":"response","id":11,"payload":{"subscribed":true,"channelId":"1_25_15_15_2_515_8442","physicalNumber":25,"isScrambled":false,"channelTypeName":"Terrestrial Digital TV","isLocked":false,"dualChannel":{"dualChannelId":null,"dualChannelTypeName":null,"dualChannelTypeId":null,"dualChannelNumber":null},"isChannelChanged":false,"channelModeName":"Terrestrial","channelNumber":"15","isFineTuned":false,"channelTypeId":1,"isDescrambled":false,"isReplaceChannel":false,"isSkipped":false,"isHEVCChannel":false,"hybridtvType":null,"isInvisible":false,"favoriteGroup":null,"channelName":"BFM TV","channelModeId":0,"signalChannelId":"2_515_8442"}}

It looks like we could check whether the field subscribed is present and equal to true in the response. If not, we could implement a retry mechanism ?

If I switch to HDMI4 which is connected to a device and then again to the TV tuner, the problem is solved (the subscription is working).

@lolodomo
Copy link
Contributor Author

@sprehn : WDYT about a retry mechanism for the subscriptions ?

Do you think it could be due to the subscription being requested too early after switching to tuner ? We could wait a little before requesting it in this case ?

@sprehn
Copy link
Contributor

sprehn commented Mar 29, 2020

we could try it with a delay, it seems like a bug in webos to me. I did not get this to work for my setup, even with the recent fix provide. It only works when I start the tv on the tuner, even without delay.

@lolodomo
Copy link
Contributor Author

I just tried again and now it work well !
But I think we should at least check the content of the subscription command response.

@lolodomo
Copy link
Contributor Author

lolodomo commented Apr 4, 2020

There is apparently no response to the unsubscribe request.
One idea: the unsubscribe and the subscribe rerquests are sent in a short sequence (around 20 ms).
Maybe we should add a little sleep in removeAnySubscription after the call to unsubscribe ?

@lolodomo lolodomo changed the title [lgwebos] channel number not updated in case you switch between sources [lgwebos] channel number not always updated in case you switch between sources Apr 17, 2020
sprehn added a commit to sprehn/openhab-addons that referenced this issue Apr 17, 2020
Signed-off-by: Sebastian Prehn <sebastian.prehn@gmx.de>
cpmeister pushed a commit that referenced this issue Apr 17, 2020
* Delay subscription of channel. Addresses issue #7243.
* Calling stopChannelSubscriptionJob() in dispose()

Signed-off-by: Sebastian Prehn <sebastian.prehn@gmx.de>
yfre pushed a commit to yfre/openhab-addons that referenced this issue Apr 27, 2020
* Delay subscription of channel. Addresses issue openhab#7243.
* Calling stopChannelSubscriptionJob() in dispose()

Signed-off-by: Sebastian Prehn <sebastian.prehn@gmx.de>
Signed-off-by: Eugen Freiter <freiter@gmx.de>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this issue May 29, 2020
* Delay subscription of channel. Addresses issue openhab#7243.
* Calling stopChannelSubscriptionJob() in dispose()

Signed-off-by: Sebastian Prehn <sebastian.prehn@gmx.de>
LoungeFlyZ pushed a commit to LoungeFlyZ/openhab2-addons that referenced this issue Jun 8, 2020
* Delay subscription of channel. Addresses issue openhab#7243.
* Calling stopChannelSubscriptionJob() in dispose()

Signed-off-by: Sebastian Prehn <sebastian.prehn@gmx.de>
J-N-K pushed a commit to J-N-K/openhab-addons that referenced this issue Jul 14, 2020
* Delay subscription of channel. Addresses issue openhab#7243.
* Calling stopChannelSubscriptionJob() in dispose()

Signed-off-by: Sebastian Prehn <sebastian.prehn@gmx.de>
CSchlipp pushed a commit to CSchlipp/openhab-addons that referenced this issue Jul 26, 2020
* Delay subscription of channel. Addresses issue openhab#7243.
* Calling stopChannelSubscriptionJob() in dispose()

Signed-off-by: Sebastian Prehn <sebastian.prehn@gmx.de>
Signed-off-by: CSchlipp <christian@schlipp.de>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this issue Aug 31, 2020
* Delay subscription of channel. Addresses issue openhab#7243.
* Calling stopChannelSubscriptionJob() in dispose()

Signed-off-by: Sebastian Prehn <sebastian.prehn@gmx.de>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this issue Aug 31, 2020
* Delay subscription of channel. Addresses issue openhab#7243.
* Calling stopChannelSubscriptionJob() in dispose()

Signed-off-by: Sebastian Prehn <sebastian.prehn@gmx.de>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this issue Aug 31, 2020
* Delay subscription of channel. Addresses issue openhab#7243.
* Calling stopChannelSubscriptionJob() in dispose()

Signed-off-by: Sebastian Prehn <sebastian.prehn@gmx.de>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this issue Aug 31, 2020
* Delay subscription of channel. Addresses issue openhab#7243.
* Calling stopChannelSubscriptionJob() in dispose()

Signed-off-by: Sebastian Prehn <sebastian.prehn@gmx.de>
DaanMeijer pushed a commit to DaanMeijer/openhab-addons that referenced this issue Sep 1, 2020
* Delay subscription of channel. Addresses issue openhab#7243.
* Calling stopChannelSubscriptionJob() in dispose()

Signed-off-by: Sebastian Prehn <sebastian.prehn@gmx.de>
Signed-off-by: Daan Meijer <daan@studioseptember.nl>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this issue Sep 19, 2020
* Delay subscription of channel. Addresses issue openhab#7243.
* Calling stopChannelSubscriptionJob() in dispose()

Signed-off-by: Sebastian Prehn <sebastian.prehn@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

No branches or pull requests

3 participants