Closed optmax closed 4 years ago
@sprehn : do previous and next commands exist in the API? I don't see these commands in the code. Is the webOS API public or was it reverse engineered?
It is all reverse engineered based on connectsdk.
option A) These are the events we can send via the API. "ssap://media.controls/play"; "ssap://media.controls/pause"; "ssap://media.controls/stop"; "ssap://media.controls/rewind"; "ssap://media.controls/fastForward";
we could simply give it a try, for example with "ssap://media.controls/next"
No access to my TV at the moment, so cannot try.
option B) TV_Player.sendCommand( RIGHT )
@sprehn: Thank you for getting back to me and indeed for all your work on the lgwebos binding.
I am self-isolating due to the coronavirus at the moment and set myself a project to get to grips with openHAB to control my entertainment system. It is proving to be a most enjoyable way to isolate :-)
Option A Any pointers as to how to implement ssap within my project?
Option B
I have tried
TV_Player.sendCommand( RIGHT )
from inside a rule called "skip"
It generates this error
2020-04-03 23:40:14.540 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'skip': The name 'RIGHT' cannot be resolved to an item or type
But...
For the PLEX app on my webOSTV
TV_RCButton.sendCommand("RIGHT")
via a rcButton channel works :-)
Thanks for the pointer.
I updated the code to use ssap://media.controls/previous
and ssap://media.controls/next
but it does not work:
10:35:44.447 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'TvPlayer' received command PREVIOUS
10:35:44.499 [DEBUG] [webos.internal.handler.LGWebOSHandler] - handleCommand(lgwebos:WebOSTV:tv:mediaPlayer,PREVIOUS)
10:35:44.511 [TRACE] [ebos.internal.handler.LGWebOSTVSocket] - Message [out]: {"type":"request","id":15,"uri":"ssap://media.controls/previous"}
10:35:44.539 [TRACE] [ebos.internal.handler.LGWebOSTVSocket] - Message [in]: {"type":"error","id":15,"error":"404 no such service or method","payload":{}}
10:35:44.556 [DEBUG] [ebos.internal.handler.LGWebOSTVSocket] - Error: {"type":"error","id":15,"error":"404 no such service or method","payload":{}}
10:35:44.565 [DEBUG] [g.lgwebos.internal.BaseChannelHandler] - MediaControlPlayer received error response: 404 no such service or method
10:35:50.442 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'TvPlayer' received command NEXT
10:35:50.512 [DEBUG] [webos.internal.handler.LGWebOSHandler] - handleCommand(lgwebos:WebOSTV:tv:mediaPlayer,NEXT)
10:35:50.522 [TRACE] [ebos.internal.handler.LGWebOSTVSocket] - Message [out]: {"type":"request","id":16,"uri":"ssap://media.controls/next"}
10:35:50.542 [TRACE] [ebos.internal.handler.LGWebOSTVSocket] - Message [in]: {"type":"error","id":16,"error":"404 no such service or method","payload":{}}
10:35:50.553 [DEBUG] [ebos.internal.handler.LGWebOSTVSocket] - Error: {"type":"error","id":16,"error":"404 no such service or method","payload":{}}
10:35:50.562 [DEBUG] [g.lgwebos.internal.BaseChannelHandler] - MediaControlPlayer received error response: 404 no such service or method
Failing too with ssap://media.controls/nextTrack
PS: I tested for the first time play/pause when the Music app is running and it works as expected.
Now that I checked the code and tested the media player feature, I can see that something is missing in the code, the state of the channels mediaPlayer
and mediaStop
is never updated.
As an example, when PLAY command is pushed by the user and you receive a positive feedback, you should update the state of these 2 channels accordingly.
I will try to improove that.
@lolodomo: Thank you for investigating. I am of no help looking at the source code side of things but if there is any testing I can help with in openHAB then do let me know.
@optmax : unfortunately, this is clearly not obvious to guess what are the SSAP commands to be used for PREVIOUS/NEXT commands. We are not sure they even exist. I just tried the most probable ones but without any success.
@lomodomo: I have just tried the Next and Previous buttons in the LG TV Plus app on Android and they don’t work! So maybe LG never implemented the code? Thanks for investigating.
@sprehn : if sendRCButton is working with LEFT and RIGHT, we could simply use it as commands for the player item. I am going to test that.
Tested but not really "reliable" because it depends on what was the previous mouse position.
I've been experimenting with an RCButton sequence and find that its slightly more reliable if you also have a sequence to step back through the PLEX App to the Home page before changing to another input.
I found that starting the 'escape sequnce' with
TV_RCButton.sendCommand("BLUE")
helps if the screensaver is active
Hi, I've connected my LG today via Alexa V3 skill and openhab. I found out, that if i say "NEXT" it's not working, but if i say "FASTFORWARD" it is working! Two different commands are send to openhab:
Item 'TV_Bed_Player' received command NEXT Result: Only accept PlayPauseType, RewindFastforwardType, RefreshType.........
Item 'TV_Bed_Player' received command FASTFORWARD Result: TV_Bed_Player predicted to become FASTFORWARD TV_Bed_Player changed from PLAY to FASTFORWARD
The Player item in openhab sends "NEXT". If it would send "FASTWORDWARD" the buttons will work. Regards, Olli
This simple workarourd will do the job:
rule "Set working Player FASTFORWARD Command"
when
TV_Player received command NEXT
then
TV_Player.sendCommand(FASTFORWARD)
end
rule "Set working Player PREVIOUS Command"
when
TV_Player received command PREVIOUS
then
TV_Player.sendCommand(REWIND)
end
The normal commands for the openHAB player widget are play/pause, previopus and next.
Expected Behavior
Within a mediaPlayer clicking the Next icon should move to the next track Similarly clicking Previous icon should move to the previous track (Pause and Play work as PlayPauseType input is accepted)
Current Behavior
==> /var/log/openhab2/openhab.log <== 2020-04-02 21:25:18.529 [DEBUG] [ebos.internal.handler.LGWebOSHandler] - handleCommand(lgwebos:WebOSTV:a3c77ba0-654a-0982-c480-f726662f05b8:mediaPlayer,NEXT) 2020-04-02 21:25:18.534 [INFO ] [.lgwebos.internal.MediaControlPlayer] - Only accept PlayPauseType, RewindFastforwardType, RefreshType. Type was class org.eclipse.smarthome.core.library.types.NextPreviousType.
Possible Solution
Steps to Reproduce (for Bugs)
Context
Control apps on webOS TV
Your Environment
Raspberry Pi 3 ARMv7 Raspbian GNU/Linux 9 (stretch)
openHAB 2.5.4 Build #74
LG web OS Binding 2.5.4.202004020414
Item Player TV_Player { channel="lgwebos:WebOSTV:a3c77ba0-654a-0982-c480-f726662f05b8:mediaPlayer"}
Wihin a Rule TV_Player.sendCommand( NEXT )
==> /var/log/openhab2/openhab.log <== 2020-04-02 21:25:18.529 [DEBUG] [ebos.internal.handler.LGWebOSHandler] - handleCommand(lgwebos:WebOSTV:a3c77ba0-654a-0982-c480-f726662f05b8:mediaPlayer,NEXT) 2020-04-02 21:25:18.534 [INFO ] [.lgwebos.internal.MediaControlPlayer] - Only accept PlayPauseType, RewindFastforwardType, RefreshType. Type was class org.eclipse.smarthome.core.library.types.NextPreviousType.