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

Enigma2 integration leave the media_player state on after having turned the receiver off with deep_standby enabled #107449

Closed
KennethLavrsen opened this issue Jan 7, 2024 · 4 comments · Fixed by #107462

Comments

@KennethLavrsen
Copy link

The problem

The integration is still broken. Better but broken

The integration now survives setting the receiver in deep sleep and starting up HA while receiver in deep sleep

But when you use the integration to turn off the receiver with deep_standby enabled the receiver itself turns off in deep sleep mode but the integration leaves the state of its media_player entity "on". Once in this mode it even loads this state when HA starts even though the receiver is in deep standby. This means that I cannot use the media_player entity in automations to decide if the receiver is already on or it is off/unavailable. The automations need this information to decide if they most send it the Power toggle from my IR blaster. The media_palyer entity also shows the last program and everything like it was when the player turned off.

What version of Home Assistant Core has the issue?

core-2024.1.2

What was the last working version of Home Assistant Core?

core-2024.12.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Enigma2

Link to integration documentation on our website

https://www.home-assistant.io/integrations/enigma2/

Diagnostics information

No response

Example YAML snippet

media_player:
  - platform: enigma2
    host: 192.168.1.9
    #source_bouquet: 'DianeKenneth'
    name: 'Vuplus2'
    deep_standby: true
    mac_address: "00:1d:ec:05:82:2d"

Anything in the logs that might be useful for us?

No response

Additional information

For info. This is the sniplet from my scripts that turn the VU Duo + on and off

I need to check that the receiver is really off because there are cases where I may have watched Satellite TV and then changed to another source and then back to TV. My advanced automations leave the receiver on in this case because it is annoying to wait for a full boot. When I then hit the remote control off to turn all my AV equipment off, the receiver is put in deep_standby to save power. The IR blast power is a toggle code so I cannot blindly send a power command via IR because it quickly gets out of sync so when I change from Chromecast to Satellite TV the box is turned off instead of left on. All this info is not important for fixing the bug. I am just explaining why the correct state is important.

I cannot remember what the state was when the satellite receive was deep sleeping vs being normal off. But as you can see the script I made checks for "not on" so it was probably not off but unavailable or unknown. I cannot remember

        - if:
            - condition: template
              value_template: "{{ not is_state('media_player.vuplus2', 'on') }}"
          then:
            - service: remote.send_command
              target:
                entity_id: remote.broadlink_remote
              data:
                device: VU Plus 2
                command: Power
@home-assistant
Copy link

home-assistant bot commented Jan 7, 2024

Hey there @autinerd, mind taking a look at this issue as it has been labeled with an integration (enigma2) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of enigma2 can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign enigma2 Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


enigma2 documentation
enigma2 source
(message by IssueLinks)

@KennethLavrsen
Copy link
Author

There are additional issues.

I also have many of these in the log.

It still does not handle the normal condition that we turn the receiver completely off (deep standby).

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:894
First occurred: 14:16:06 (64 occurrences)
Last logged: 14:49:16

Update for media_player.vuplus2 fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 668, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.1.9', 80)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 894, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1212, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/enigma2/media_player.py", line 191, in async_update
    await self._device.update()
  File "/usr/local/lib/python3.11/site-packages/openwebif/api.py", line 148, in update
    self.status.status_info = await self._call_api(PATH_STATUSINFO)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/openwebif/api.py", line 501, in _call_api
    async with self._session.get(path, params=params) as response:
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1187, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 574, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 911, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1235, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1204, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1000, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.9:80 ssl:default [Connect call failed ('192.168.1.9', 80)]

@KennethLavrsen
Copy link
Author

I had to give up on this integration and write my own solution. Sad the PR does not get any attention

@cjcr
Copy link

cjcr commented Feb 11, 2024

I can confirm this situation even without the deep_standby option, but turning off the device with the remote IR. The integration keeps the status on, so you cannot turn on with wake on lan with this integration because it is already in "On" state.

Regards.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants