Enigma2 receivers integration

hi, all works fine:

enigma:
devices:
- host: 10.0.0.10
port: 80
name: Solo2
timeout: 20
username: root
password: xxxxxxxxxx
bouquet: ‘1:7:1:0:0:0:0:0:0:0:FROM BOUQUET “userbouquet.dbe03.tv” ORDER BY bouquet’
picon: screenshot

bajki:
sequence:
- service: homeassistant.turn_on
entity_id: media_player.solo2
- service: media_player.play_media
data:
entity_id: media_player.solo2
media_content_id: “341”
media_content_type: “channel”
- service: script.turn_on
entity_id: script.yamahazone1

in info log i see every 0 seconds:

2019-02-10 08:42:40 INFO (SyncWorker_4) [custom_components.enigma] Enigma: [update] - request for host 10.0.0.10 (Solo2)
2019-02-10 08:42:51 INFO (SyncWorker_2) [custom_components.enigma] Enigma: [update] - request for host 10.0.0.10 (Solo2)
2019-02-10 08:43:02 INFO (SyncWorker_2) [custom_components.enigma] Enigma: [update] - request for host 10.0.0.10 (Solo2)
2019-02-10 08:43:13 INFO (SyncWorker_1) [custom_components.enigma] Enigma: [update] - request for host 10.0.0.10 (Solo2)
2019-02-10 08:43:24 INFO (SyncWorker_1) [custom_components.enigma] Enigma: [update] - request for host 10.0.0.10 (Solo2)
2019-02-10 08:43:35 INFO (SyncWorker_3) [custom_components.enigma] Enigma: [update] - request for host 10.0.0.10 (Solo2)
2019-02-10 08:43:46 INFO (SyncWorker_0) [custom_components.enigma] Enigma: [update] - request for host 10.0.0.10 (Solo2)
2019-02-10 08:43:57 INFO (SyncWorker_0) [custom_components.enigma] Enigma: [update] - request for host 10.0.0.10 (Solo2)
2019-02-10 08:44:08 INFO (SyncWorker_2) [custom_components.enigma] Enigma: [update] - request for host 10.0.0.10 (Solo2)
2019-02-10 08:44:19 INFO (SyncWorker_0) [custom_components.enigma] Enigma: [update] - request for host 10.0.0.10 (Solo2)

what is this?

hi,

I’ve try setup again but i’ve same problem… :frowning:

I’ve this error:

2019-02-17 12:06:49 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform enigma
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/urllib/request.py", line 1318, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/local/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/usr/local/lib/python3.6/http/client.py", line 936, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/local/lib/python3.6/socket.py", line 724, in create_connection
    raise err
  File "/usr/local/lib/python3.6/socket.py", line 713, in create_connection
    sock.connect(sa)
OSError: [Errno 113] Host is unreachable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/config/custom_components/media_player/enigma.py", line 156, in request_call
    return self._opener.open(uri, timeout=self._timeout).read()
  File "/usr/local/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/local/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.6/urllib/request.py", line 1346, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/local/lib/python3.6/urllib/request.py", line 1320, in do_open
    raise URLError(err)
urllib.error.URLError: 
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/config/custom_components/media_player/enigma.py", line 70, in async_setup_platform
    devices.append(EnigmaMediaPlayer(device))
  File "/config/custom_components/media_player/enigma.py", line 97, in __init__
    self.load_sources()
  File "/config/custom_components/media_player/enigma.py", line 125, in load_sources
    reference = urllib.parse.quote_plus(self.get_bouquet_reference())
  File "/config/custom_components/media_player/enigma.py", line 145, in get_bouquet_reference
    bouquets_xml = self.request_call('/web/getallservices')
  File "/config/custom_components/media_player/enigma.py", line 160, in request_call
    HTTPError.code)
AttributeError: type object 'HTTPError' has no attribute 'code'

This error is because have this configuration:

devices:
  - host: 172.16.1.110
    port: 80
    name: GM
    timeout: 20
    username: root
    password: xxxx
    picon: picon
  - host: 172.16.1.9
    port: 80
    name: Dm800
    timeout: 20
    username: root
    password: xxxxx
    picon: picon
  - host: 172.16.1.159
    port: 80
    name: Wetek
    timeout: 20
    username: root
    password: xxxx
    picon: picon

The problem is on restart HA, if one device is disconnect from AC (220V), the python script give me error and the custom component is not setup on HA. I’ve have my box enigma always disconnect from AC less view tv and connect box + tv to AC.

If i restart HA with one or three device configured on enigma and this device connected to AC, the component enigma works 5*****

It’s possible resolve this?

Thank you.

ImportError with v0.88.0b2

Since v0.88 i am running into the following problem, seems they changed a lot at the interface & libraries… perhaps someone can help. This happens with the latest version from “https://github.com/cinzas/homeassistant-enigma-player

2019-02-17 19:55:41 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.enigma.media_player. Make sure all dependencies are installe  d
Traceback (most recent call last):
File "/usr/lib64/python3.6/site-packages/homeassistant/loader.py", line 147, in _load_file
module = importlib.import_module(path)
File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/etc/homeassistant/custom_components/enigma/media_player.py", line 26, in <module>
from custom_components.enigma import _LOGGER, DOMAIN as ENIGMA_DOMAIN
ImportError: cannot import name '_LOGGER'
2019-02-17 19:55:41 ERROR (MainThread) [homeassistant.loader] Unable to find platform enigma

Hi

Sorry, I did not try against the latest beta.
I will wait until 0.88 stable is released and then change accordingly (if needed).

Cheers

1 Like

Hi

Honestly, i don’t know if that is possible.
The device is configured on HA boot, where I check the states and I try to load the sources, then it only checks every 10 secs for device updates.

I would have the read if that is possible, but I’m afraid not.
Have you tried with any other components if this works ?

Txs

Could it be because of this?

Note for custom component developers: We are moving to a new file structure. Platforms now live embedded in components. Custom platforms will have to be updated to follow this pattern. This is a breaking change in case your custom platform overrides a built-in platform. Rename your custom platform from, ie light/hue.py to hue/light.py .
Source

Damm … So probably it will change to enigma/media_player and enigma/notify.

I will have to look in to that, but will be travelling next week :frowning:

yes, the update made an error pop:

Error loading custom_components.enigma.media_player. Make sure all dependencies are installed

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

I´ve made a pull request on GitHub, should resolve it.

1 Like

Hi @sechsbug, thanks

Saw it just now.
I will try to review and commit tomorrow night/Saturday.

I will inform

1 Like

@cinzas:

please add support for custom updater plugin, it is just a simple .json file.

1 Like

@cinzas
I’ve updated to HA 0.88 today and after that enigma stopped working.
Then I updated your component some minutes ago (right after you updated it on github).
It works! Thanks!
But I still have a warning in the log:

Integrations need to be in their own folder. Change notify/enigma.py to enigma/notify.py. This will stop working soon.

I presume you are still working on it…
And don’t forget to change the installation instructions… :wink:

New version released.
Now it only works with homeassistant v0.88 (minimum).
@sechsbug, I’ve accepted your pull request, thanks for the work.

I’ve tried and everythin is working properly. Notifications also work.
I’m not having the bug on the volume change :slight_smile:

@madrian: Thanks for the suggestion, I will have a look.

2 Likes

Done !.

New release. If you use custom_updater you will get your component updated automatically :slight_smile:

https://github.com/custom-components/custom_updater/wiki/components

3 Likes

Well done!
Component und custom_updater works flawlessly.
Thank you for the hard work!

Many thanks for the hard work.
It works fine again

Very cool, thank you. :slight_smile:

My only concern is the lag while volume changing. I don’t remember for such a lag in <0.88 versions.

It needs ca. 4-6 seconds to update the interface:

Thank you very much @cinzas for your work.

I would like to propose some improvements, which I have manually incorporated

  1. create an independent attribute for the selected channel, in this way, we could create sensors that are activated when we select a specific channel and create automatism (the same could also be done for the selected program).
    For example, when a certain channel is set … send a notification

  2. create a separate attribute for the current EPG and for the next EPG for a channel (with epgservicenow and epgservicenext methods)

Thank you

1 Like

I’m getting an error using the new system…

This is the error :

enigma: Error on device update!
Traceback (most recent call last):
  File "/root/.homeassistant/custom_components/enigma/media_player.py", line 160, in request_call
    return self._opener.open(uri, timeout=self._timeout).read()
  File "/usr/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/util/__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "/root/.homeassistant/custom_components/enigma/media_player.py", line 211, in update
    xml = self.request_call('/web/epgservicenow?sRef=' + reference)
  File "/root/.homeassistant/custom_components/enigma/media_player.py", line 164, in request_call
    HTTPError.code)
AttributeError: type object 'HTTPError' has no attribute 'code'

I have the following in enigma.yaml

devices:
  - host: 192.168.2.14
    port: 80
    name: Freesat Frontroom
    picon: picon
    timeout: 20

Clearly there’s something not right there with a HTTP400 response.
Did it work in a previous release?

One issue I found with enigma2 development is it’s quite fragmented. There are multiple distributions which have diverged somewhat, with multiple implementations of a web interface, and many many releases.

If you’re not already, I’d recommend upgrading to the latest release of your chosen image, and if you still have issues, report back on the release and version of the image/openwebif to see if anyone else is running the same release.