cinzas / homeassistant-enigma-player

This is a custom component for the media_player and notify platforms of Home Assistant. Integrates with enigma2 images running OpenWebIf
58 stars 23 forks source link

Changes for custom components made in Home Assistant 0.88 #2

Closed sechsbug closed 5 years ago

sechsbug commented 5 years ago

Home Assistant made some changes in Version 0.88 for custom components.

Fixes this error:

Traceback (most recent call last): File “/usr/local/lib/python3.7/site-packages/homeassistant/loader.py”, line 147, in _load_file module = importlib.import_module(path) File “/usr/local/lib/python3.7/importlib/init.py”, line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File “<frozen importlib._bootstrap>”, line 1006, in _gcd_import File “<frozen importlib._bootstrap>”, line 983, in _find_and_load File “<frozen importlib._bootstrap>”, line 962, in _find_and_load_unlocked ModuleNotFoundError: No module named ‘custom_components.enigma.media_player’; ‘custom_components.enigma’ is not a package

Further information: New file structure New Location of media_player constants

onkelbeh commented 5 years ago

Thanks, i renamed the two files and applied the lib changes by hand, looks much better, but with v0.88.1 it logs:

2019-02-22 17:14:09 WARNING (MainThread) [homeassistant.loader] You are using a custom component for enigma.media_player which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-02-22 17:14:10 WARNING (MainThread) [homeassistant.loader] You are using a custom component for enigma which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-02-22 17:14:10 ERROR (MainThread) [homeassistant.setup] Error during setup of component enigma
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/homeassistant/setup.py", line 151, in _async_setup_component
    hass, processed_config)
  File "/etc/homeassistant/custom_components/enigma/__init__.py", line 91, in async_setup
    configured_devices = config[DOMAIN].get(CONF_DEVICES)
KeyError: 'enigma'

2019-02-22 17:14:10 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of enigma.media_player. Setup failed for dependencies: enigma
2019-02-22 17:14:10 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform enigma.media_player: Could not set up all dependencies.
2019-02-22 17:14:10 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of enigma.media_player. Setup failed for dependencies: enigma
2019-02-22 17:14:10 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform enigma.media_player: Could not set up all dependencies.

My /etc/homeassistant/media_player/enigma.yaml looks like this:


- platform: enigma
  host: 172.16.2.149
  port: 80
  name: dream_wz
  icon: mdi:satellite-variant
  timeout: 20
  username: root
  password: !secret enigma_password

- platform: enigma
  host: 172.16.2.150
  port: 80
  name: dream_k
  icon: mdi:satellite-variant
  timeout: 20
  username: root
  password: !secret enigma_password

The Dreamboxes show up in red boxes: grafik

Sorry, but i didn't try it with v0.88.0.

custom_components/
├── enigma
│   ├── __init__.py
│   ├── media_player.py
│   └── __pycache__
│       ├── __init__.cpython-36.pyc
│       └── media_player.cpython-36.pyc
├── notify
│   └── enigma.py
└── samsungtv
    ├── media_player.py
    ├── __pycache__
    │   └── media_player.cpython-36.pyc
    ├── samsungtv.0810
    ├── samsungtv.off
    └── samsungtv.off2
adrianmihalko commented 5 years ago

There is problem with volume control, on the device itself the volume is set correctly, but in Home Assistant:

https://www.youtube.com/watch?v=JwpVO49V-WY

adrianmihalko commented 5 years ago
screenshot 2019-02-22 at 19 26 07
adrianmihalko commented 5 years ago

Maybe this is related?

2019-02-22 19:27:56 WARNING (MainThread) [homeassistant.loader] You are using a custom component for enigma.media_player which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-02-22 19:27:57 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 344, in _async_add_entity
    raise HomeAssistantError(msg)
sechsbug commented 5 years ago

@onkelbeh I think your problem is in the config of your devices. Set it up like its mentioned in the readme and you should be good to go

Like this:

enigma: 
  devices:
    - host: 172.16.2.149
      port: 80
      name: dream_wz
      timeout: 20
      username: root
      password: !secret enigma_password

    - host: 172.16.2.150
      port: 80
      name: dream_k
      icon: mdi:satellite-variant
      timeout: 20
      username: root
      password: !secret enigma_password

@adrianmihalko I think there is just a little delay until Home Assistant displays the correct volume. I didn´t change anything than the file structure and the new libaries, so the volume control should not got broken by this change.

adrianmihalko commented 5 years ago

I must check what cause the delay, because it was worked perfectly before. 🤷‍♂️

onkelbeh commented 5 years ago

@sechsbug Yes, i moved the config into configurations.yaml. No loads and works.