jomwells / ambihue

ON/OFF Abilight+Hue (Switch) component for Philips Ambilight TV's
9 stars 9 forks source link

Menu layout change after TV firmware update #6

Open michielton opened 3 years ago

michielton commented 3 years ago

After installing latest firmware update the menu layout has changed because of new Ambisleep options.

TV: 58PUS7304/12 (and probably other TV's supporting the new Ambisleep functionality)
Firmware: TPM191E_R.101.001.079.005
Country: NL

After inspecting the new menu layout and id's I found the correct id in this case should be 2131230789.

switch:
  - platform: philips_ambilight+hue
    name: Ambilight+Hue
    host: 192.168.1.XXX
    username: !secret philips_username
    password: !secret philips_password
    id: 2131230789
    scan_interval: 5
Clooos commented 3 years ago

Hi, how did you found the correct id? I try to find the good one for my TV 😄

michielton commented 3 years ago

Hi, how did you found the correct id? I try to find the good one for my TV 😄

Hi @Quentin-Cloos,

Assuming the TV is running Jointspace v6 you can open the following URL:

https://[tv-ip]:1926/6/menuitems/settings/structure

Authenticate with the same username/password you would use for this component and search for ambilight_hue_off. There should be a node_id within the same JSON node, that's the one you're looking for.

I found the correct id in this part of the structure:

{"node_id":2131230789,"context":"ambilight_hue_off","data":{},"type":"TOGGLE_NODE"}

Cheers!

Clooos commented 3 years ago

Thank you!!! That information should be explained on the main page, it's working now! I just have an error message when I turn on/off the switch but I can live with that 😛

michielton commented 3 years ago

Hi @Quentin-Cloos,

Glad to help. 😊

What error are you getting, can you post the full error from the HA log (Configuration / Logs / Load full HA log)?

Clooos commented 3 years ago

Here is my log (for some reason I have replaced the name of the component with philips_ambihue):

Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 125, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1308, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1343, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 208, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 454, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 485, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 618, in async_turn_off
    await self.hass.async_add_executor_job(ft.partial(self.turn_off, **kwargs))
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/philips_ambihue/switch.py", line 74, in turn_off
    self._postReq('menuitems/settings/update', {"values":[{"value":{"Nodeid":self._nodeId,"Controllable":"true","Available":"true","data":{"value":"false"}}}]} )
  File "/config/custom_components/philips_ambihue/switch.py", line 113, in _postReq
    return json.loads(resp.text)
  File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
michielton commented 3 years ago

Hi @Quentin-Cloos,

I forgot about this, I also got this error a while ago and made some modifications to switch.py. You can try the attached version, please unzip, overwrite switch.py and restart HA. The error should be gone 😊.

switch.py.zip

Cheers! 👍🏼

michielton commented 3 years ago

New firmware for my TV again.

TV: 58PUS7304/12
Firmware: TPM191E_R.101.001.123.008
Country: NL

After inspecting the new menu layout and id's I found the correct id in this case should be 2131230783.

switch:
  - platform: philips_ambilight+hue
    name: Ambilight+Hue
    host: 192.168.1.XXX
    username: !secret philips_username
    password: !secret philips_password
    id: 2131230783
    scan_interval: 5
Clooos commented 3 years ago

Hi @Quentin-Cloos,

I forgot about this, I also got this error a while ago and made some modifications to switch.py. You can try the attached version, please unzip, overwrite switch.py and restart HA. The error should be gone 😊.

switch.py.zip

Cheers! 👍🏼

No more error with your switch.py ! Thank you (a while later 😛 ).