Git Product home page Git Product logo

Comments (10)

DonutEspresso avatar DonutEspresso commented on May 24, 2024 1

Dug a bit more, but it doesn't appear the HDMI CEC details are exposed via the WS APIs. I ended up taking a different path here and was able to get my receiver exposed through homebridge to achieve the same outcomes. I'll close out the issue for now. Appreciate your patience and guidance!

from homebridge-webos-tv.

merdok avatar merdok commented on May 24, 2024

Would you mind providing me an example as which name exactly you mean? You could enable the deepDebugLog and start homebridge in debug mode, that way you also should be able the inputs retrieved from the TV with all the information., then you could just paste a sniped from an input here which has the property which you seek for.

from homebridge-webos-tv.

DonutEspresso avatar DonutEspresso commented on May 24, 2024

OK, looks like this may be related to HDMI CEC (SIMPLINK) capabilities. Here's the retrieved service list from the TV:

[1/2/2024, 5:18:43 PM] [homebridge-webos-tv] [LG CX 77] Retrieved service list
[1/2/2024, 5:18:43 PM] [homebridge-webos-tv] [LG CX 77] Message from TV
[1/2/2024, 5:18:43 PM] [homebridge-webos-tv] [LG CX 77] {
"returnValue": true,
"devices": [
...
{
"id": "HDMI_2",
"label": "Apple TV 4K",
"port": 2,
"connected": true,
"appId": "com.webos.app.hdmi2",
"icon": "",
"forceIcon": false,
"modified": false,
"spdProductDescription": "AVR-X4800H",
"spdVendorName": "DENON",
"spdSourceDeviceInfo": "Unknown",
"lastUniqueId": 8,
"hdmiPlugIn": true,
"subList": [
{
"id": "SIMPLINK",
"portId": 2,
"uniqueId": 4,
"vendorId": 4346,
"physicalAddress": 8704,
"depth": 2,
"osdName": "Apple TV zzz",
"cecpDevType": 4,
"cecpNewType": 9
},
{
"id": "SIMPLINK",
"portId": 2,
"uniqueId": 5,
"vendorId": 1485,
"physicalAddress": 8192,
"depth": 1,
"osdName": "AVR-X4800H",
"cecpDevType": 5,
"cecpNewType": 9
},
{
"id": "SIMPLINK",
"portId": 2,
"uniqueId": 8,
"vendorId": 2495,
"physicalAddress": 9472,
"depth": 2,
"osdName": "NintendoSwitch",
"cecpDevType": 4,
"cecpNewType": 9
}
],
"subCount": 3,
"favorite": false
}
...

A couple of notes on this:

  • I don't currently have an inputs option specified in my config, but I recognize all the osdName values. The Apple TV's osdName is being pulled from the device itself (from Apple TV's settings > general > about > name). If I change it, this values updates. The AVR's osdName is one I set in the LG TV itself. Same with the Switch.
  • It seems if the devices are on/live/detected by the AVR, they'll show up in the above list, as well as on the TV too - in fact the LG TV HDMI UI will show two HDMI2 inputs, each input using the osdName, and you can actually switch between them, which somehow tells the AVR to switch it's source port too. It's a bit magical but also quite janky, AFAICT. If a device turns off, it'll disappear from the above list and from the TV's UI.
  • The "label": "Apple TV 4K" field at the top level is misleading. I'm not sure where this value is being pulled from. Maybe an older value cached by the LG TV at some point before I had the AVR? In any case this value seems to stay static no matter what source is being used.

When I was switching between the two live HDMI2 sources using the TV's UI, nothing shows up in the logs, just picture setting changes:

[1/2/2024, 5:28:17 PM] [homebridge-webos-tv] [LG CX 77] Message from TV
[1/2/2024, 5:28:17 PM] [homebridge-webos-tv] [LG CX 77] {
type: 'utf8',
utf8Data: '{"type":"response","id":"f0816f76000d","payload":{"category":"picture","settings":{"brightness":"50","contrast":"85","backlight":"80","color":"50"},"returnValue":true}}'
}
[1/2/2024, 5:28:17 PM] [homebridge-webos-tv] [LG CX 77] {
"category": "picture",
"settings": {
"brightness": "50",
"contrast": "85",
"backlight": "80",
"color": "50"
},
"returnValue": true
}
[1/2/2024, 5:28:17 PM] [homebridge-webos-tv] [LG CX 77] Picture settings changed. Current picture settings: {"brightness":50,"backlight":80,"contrast":85,"color":50}

The TV itself does show the osdName value on the screen when switching between the two possible HDMI2 inputs - I think this would be the value I'm looking for, if at all possible. Let me know if there's anything else that might be helpful here.

from homebridge-webos-tv.

merdok avatar merdok commented on May 24, 2024

So are you saying that when you turn off the device itself then it will disappear from the sub-list of the HDMI input? That is quite problematic as i would probably need to poll the whole input list on interval just to check if something changed and the input list is quite huge... Also it would make your automations trigger with a delay.
I am not sure if the TV sends events when the sub-lists change, and i am not able to verify or check that as i do not use that feature.

You would need to do some investigation and try to subscribe to specific events from the tv and check what comes back. Maybe even the correct events already arrive now? Do any logs appear when you turn off the external device?
Other then that, not sure how familiar you are with code, but you would need to do some manual adjustments and check if the TV responds with anything meaningful. A wild guess would be in LgTvController.js to subscribe to the WEBOS_URI_EXTERNAL_INPUT_LIST url and check if that gives any result when the external device turn on/off.

from homebridge-webos-tv.

DonutEspresso avatar DonutEspresso commented on May 24, 2024

So are you saying that when you turn off the device itself then it will disappear from the sub-list of the HDMI input?

For the first question, yes, that appears to be the case.

That is quite problematic as i would probably need to poll the whole input list on interval

I don't think you need to know when a device turns on/off, but rather when a new device in the subList of a given port becomes the active source for the TV. Ideally we could capture this event like any other appId or port change, but the TV didn't appear to broadcast any information - at least not that I could see in the logs, likely because it's the same HDMI port. So I'm not sure if this is a TV limitation or something that could be added to the current plugin. I haven't had a chance to dig through the code yet but happy to do so - any pointers on where I can hook into the input source change event?

from homebridge-webos-tv.

merdok avatar merdok commented on May 24, 2024

There is a section for event subscription, you would need to similarly as the subscription already there, try to subscribe to the WEBOS_URI_EXTERNAL_INPUT_LIST events. But as i mentioned, this particular event is only a guess, it also might be another event, so you would have to try them out.
An example would be

async subscribeToForegroundAppChange() {

from homebridge-webos-tv.

DonutEspresso avatar DonutEspresso commented on May 24, 2024

The only event that appears to trigger when swapping between sources on the same HDMI port is the picture setting event - so it doesn't look like the info we currently have as-is will be sufficient. I think the only possible way to do this would be via the CEC service's activeSource and osd fields - would probably have to create an internal pointer to track the active device, and update this field on every app launch or picture setting change event. However, when I tried hitting the CEC service using the controller's existing patterns, I get a 404.

[1/3/2024, 6:30:21 PM] [homebridge-webos-tv] [LG CX 77] com.webos.service.cec service - listAdapters requested.
[1/3/2024, 6:30:21 PM] [homebridge-webos-tv] [LG CX 77] Message from TV

[1/3/2024, 6:30:21 PM] [homebridge-webos-tv] [LG CX 77] {
type: 'utf8',
utf8Data: '{"type":"error","id":"475970cb0007","error":"404 no such service or method","payload":{}}'
}
[1/3/2024, 6:30:21 PM] [homebridge-webos-tv] [LG CX 77] com.webos.service.cec service - listAdapters response
[1/3/2024, 6:30:21 PM] [homebridge-webos-tv] [LG CX 77] {} // < trying to log the res
[1/3/2024, 6:30:21 PM] [homebridge-webos-tv] [LG CX 77] Unknown error while requesting listAdapters from service com.webos.service.cec

Any context you can share on the services available via WS? I'm not sure where/how I might be able to discover what other services are available, but given that the osd field appears to be a CEC specific thing, this might be end of the road if CEC service isn't accessible.

from homebridge-webos-tv.

merdok avatar merdok commented on May 24, 2024

All the services available are listed on the top of the controller file. I am not aware of any CEC service, did you try to guess that one? You would need to use one of the existing ones, also tvRequest will basically not help out here as for that polling would need to be used, you should be looking at tvSubscribe

from homebridge-webos-tv.

DonutEspresso avatar DonutEspresso commented on May 24, 2024

I found the CEC service via the webOS OSE documentation - I assume that is the full documentation and API for application developers building software on the TV, but likely only a subset of those APIs is exposed via WS. Interestingly not all of the WS services you use are in the OSE documentation so maybe it's a different cross section of APIs?

I tried to hit the name of the CEC service com.webos.service.cec, but no luck. My thinking was we could grab the active CEC device at init, save it, then make updates to it whenever an app launch or picture event change happened. But if the CEC service isn't available via WS we're out of luck. Unfortunately none of the existing services return any information about the currently active source device, and the current foreground app isn't sufficient as that only returns the HDMI port, not any of the CEC information, which is what is responsible for the osdName value.

from homebridge-webos-tv.

merdok avatar merdok commented on May 24, 2024

This is different, those are services on the so called "luna" bus which can be used internally by app developers. The WS API which allows to communicate with the TV from outside exposes different services, some might be the same but are more limited. You have to work with what is already available (and documented) in the controller...

from homebridge-webos-tv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.