Open BlackandBlue1908 opened 2 years ago
I am trying to achieve the same thing, but it seems that this project is missing something for those endpoints.
I am able to send the picture commands from a standalone installation of bscpylgtv via my system’s terminal and they work as expected (switch from Standard to Cinema, etc.)
However, in Home Assistant w/ aiopylgtv, the endpoint “com.webos.settingsservice/setSystemSettings” always fails regardless of its payload with “aiowebostv.exceptions.WebOsTvServiceNotFoundError: 404 no such service or method”
Its seems that many of the endpoints that begin with “com.webos” are this way.
I am trying to achieve the same thing, but it seems that this project is missing something for those endpoints.
I am able to send the picture commands from a standalone installation of bscpylgtv via my system’s terminal and they work as expected (switch from Standard to Cinema, etc.)
However, in Home Assistant w/ aiopylgtv, the endpoint
“com.webos.settingsservice/setSystemSettings”
always fails regardless of its payload with
“aiowebostv.exceptions.WebOsTvServiceNotFoundError: 404 no such service or method”
Its seems that many of the endpoints that begin with “com.webos” are this way.
Interesting, I wonder if it would be easy enough to slot bscpylgtv into a custom component replacing aiopylgtv.
I am trying to achieve the same thing, but it seems that this project is missing something for those endpoints.
I am able to send the picture commands from a standalone installation of bscpylgtv via my system’s terminal and they work as expected (switch from Standard to Cinema, etc.)
However, in Home Assistant w/ aiopylgtv, the endpoint
“com.webos.settingsservice/setSystemSettings”
always fails regardless of its payload with
“aiowebostv.exceptions.WebOsTvServiceNotFoundError: 404 no such service or method”
Its seems that many of the endpoints that begin with “com.webos” are this way.
Interesting, I wonder if it would be easy enough to slot bscpylgtv into a custom component replacing aiopylgtv.
Also pretty sure it's possible to run CLI commands via HA so could probably just install the package and run those commands via scripts or automations, since it's just picture modes would only need to setup a couple of static commands.
It is. That’s how I solved it. But I’d prefer it to be part of the integration. Now I have to reinstall bscpylgtv manually every time the python environment is updated on my dietPi.
Would you mind providing some details on how you set that up? I think I have some kind of fundamental misunderstanding of how to use python scripts with HA.
It is. That’s how I solved it. But I’d prefer it to be part of the integration. Now I have to reinstall bscpylgtv manually every time the python environment is updated on my dietPi.
Maybe as bscpylgtv as a requirement to a custom component with nothing else in it? Should install itself at startup each time if not present. But yet built in would be better.
I installed bscpylgtv as per instructions, and added this to configuration.yaml:
# lg modes
shell_command:
set_dark_mode_sdr: bscpylgtvcommand 192.168.1.102 set_picture_mode expert2 hdmi2 sdr
set_dark_mode_hdr: bscpylgtvcommand 192.168.1.102 set_picture_mode hdrCinema hdmi2 hdr
set_dark_mode_dolby: bscpylgtvcommand 192.168.1.102 set_picture_mode dolbyHdrCinema hdmi2 dolbyHdr
set_light_mode_sdr: bscpylgtvcommand 192.168.1.102 set_picture_mode expert1 hdmi2 sdr
set_light_mode_hdr: bscpylgtvcommand 192.168.1.102 set_picture_mode hdrCinemaBright hdmi2 hdr
set_light_mode_dolby: bscpylgtvcommand 192.168.1.102 set_picture_mode dolbyHdrCinemaBright hdmi2 dolbyHdr
set_game_mode_sdr: bscpylgtvcommand 192.168.1.102 set_picture_mode game hdmi2 sdr
set_game_mode_hdr: bscpylgtvcommand 192.168.1.102 set_picture_mode hdrGame hdmi2 hdr
set_game_mode_dolby: bscpylgtvcommand 192.168.1.102 set_picture_mode dolbyHdrGame hdmi2 dolbyHdr
This allows me to call set_dark_mode_sdr
as a service in automations.
Again, I feel like I have some kind of fundamental misunderstanding about this.
Are you installing via "pip install bscpylgtv" in the Home Assistant CLI? Because that works for me, and I can issue the commands from the CLI and they work.
But, adding the shell commands to configuration.yaml and calling them from an automation always returns error code 127.
Here is my shell_command entry:
shell_command:
dolby_standard: bscpylgtvcommand 192.168.4.147 set_current_picture_mode dolbyHdrStandard
dolby_game: bscpylgtvcommand 192.168.4.147 set_current_picture_mode dolbyHdrGame
vol_up: bscpylgtvcommand 192.168.4.147 volume_up
Again, these commands work when directly typed into the CLI, but do NOT work when calling a shell command from an automation.
@DeLub Any advice on this?
Before installing you should probably activate the Python environment. On my Pi I do this by
sudo -u homeassistant bash . /home/homeassistant/pyenv-activate.sh
does this help you?
Thanks for the reply 🍻
Unfortunately, that directory doesn’t exist for me, and the find
command doesn’t find a pyenv-activate.sh
anywhere on the system. There doesn’t appear to be homeassistant
user either, just hassio
.
I run HAOS in a Hyper-V VM, if that makes any difference.
Sorry, can’t help you with that. I guess bscpylgtv needs to be added to the container. But I don’t know how you should do that.
This is actually a quite funny hack to access the internal "luna" api of webos.. idk if the maintainer of this project would like to implement it: https://github.com/chros73/bscpylgtv/blob/8267636a991bacbb581bca57b6b461adf1df05a2/bscpylgtv/webos_client.py#L1097
This is actually a quite funny hack to access the internal "luna" api of webos.. idk if the maintainer of this project would like to implement it: https://github.com/chros73/bscpylgtv/blob/8267636a991bacbb581bca57b6b461adf1df05a2/bscpylgtv/webos_client.py#L1097
So in theory something like this should do the trick, but it doesn't:
set_picture_mode:
sequence:
- service: webostv.command
target:
entity_id: media_player.lg_webos_smart_tv
data:
command: system.notifications/createAlert
payload:
message: " "
buttons:
- label: ""
onClick": luna://com.webos.settingsservice/setSystemSettings
params:
category: picture
settings:
pictureMode: cinema
onclose:
uri: luna://com.webos.settingsservice/setSystemSettings
params:
category: picture
settings:
pictureMode: cinema
onfail:
uri: luna://com.webos.settingsservice/setSystemSettings
params:
category: picture
settings:
pictureMode: cinema
//Edit: Also it opens up a dialog that you need to close manually on the TV, which is otherwise handled by the bscpylgtv script.
I am using the linuxserver homeassistant image. As a workaround which is probably not recommended, I have set the PUID and PGID to root as when I tried my own user, I could see permission errors in the logs.
/path/to/store/custom/scripts/homeassistant:/custom-cont-init.d:ro
#!/bin/bash
echo " installing bscpylgtv via pip" pip install --no-cache-dir bscpylgtv
- Then I had to use the environment variables PGID and PUID for root.
```yml
...
environment:
- PUID=0
- PGID=0
- ...
...
Cannot watch for dhcp packets without a functional packet filter: libpcap is not available. Cannot compile filter !
Apologies if this is the wrong place to ask this but I'd like to set the picture mode via homeassistant automations. I don't need to adjust picture settings necessarily just change between modes that are already configured. Any guidance would be appreciated.