Vu+ Integration

so… there is a new problem, after i resolved the eventtitle request:

the output have to be in utf8, because of some special character. so i have changed all ‘ASCII’ to ‘utf8’.
now, there is no error, but the card isn’t shown anymore :frowning:

17-01-23 19:20:55 custom_components.media_player.enigma: PO ZADANI HESLA:

www.vuplus-support.org
home of

/$$ /$$ /$$$$$$$$ /$$
| $$ | $$|__ $$/|/
| $$ | $$ | $$ /$$
| $$ / $$/ | $$ | $$
\ $$ $$/ | $$ | $$
\ $$$/ | $$ | $$
\ $/ | $$ | $$
_/ |/ |/

Welcome on your Vu+ !

root@vusolo2:~#
^[[61;17R17-01-23 19:20:55 custom_components.media_player.enigma: HODNOTA PWSTATE: false
17-01-23 19:20:55 custom_components.media_player.enigma: PO ZADANI PWSTATE: root@vusolo2:~#
^[[61;93R17-01-23 19:20:55 custom_components.media_player.enigma: HODNOTA NAME: Solo²
17-01-23 19:20:56 custom_components.media_player.enigma: PO ZADANI MODEL: root@vusolo2:~#
^[[61;91R17-01-23 19:20:56 custom_components.media_player.enigma: HODNOTA SOURCE: RTL Austria
17-01-23 19:20:57 custom_components.media_player.enigma: PO ZADANI SOURCE: root@vusolo2:~#
^[[61;92R17-01-23 19:20:57 custom_components.media_player.enigma: HODNOTA REFERENCE: 1:0:1:7080:443:1:C00000:0:0:0:
17-01-23 19:20:57 custom_components.media_player.enigma: PO ZADANI REFERENCE: root@vusolo2:~#
^[[61;95R17-01-23 19:20:57 custom_components.media_player.enigma: HODNOTA EVENT TITLE: Alles was zählt
17-01-23 19:20:58 custom_components.media_player.enigma: PO ZADANI EVENTTITLE: root@vusolo2:~#
^[[61;96R17-01-23 19:20:58 custom_components.media_player.enigma: HODNOTA VOLUME: 100
17-01-23 19:20:58 custom_components.media_player.enigma: HODNOTA VOLUME: 1.0
17-01-23 19:20:58 custom_components.media_player.enigma: PO ZADANI REFERENCE: root@vusolo2:~#
^[[61;95R17-01-23 19:20:58 custom_components.media_player.enigma: HODNOTA MUTED: False
17-01-23 19:20:58 custom_components.media_player.enigma: HODNOTA MUTED: False
17-01-23 19:20:59 custom_components.media_player.enigma: PO ZADANI REFERENCE: root@vusolo2:~#
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event state_changed[L]: entity_id=media_player.solo2, old_state=None, new_state=< state media_player.solo2=on; source=RTL Austria - Alles was zählt, source_list=[], media_title=RTL Austria - Alles was zählt, friendly_name=Solo², is_volume_muted=False, supported_media_commands=18829, volume_level=1.0 @ 2017-01-23T19:20:59.290378+01:00>>
^[[61;95R17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=turn_off>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=media_previous_track>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=clear_playlist>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=media_next_track>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=media_play>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=media_play_pause>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=toggle>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=select_source>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=media_seek>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=volume_mute>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=play_media>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=media_pause>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=media_stop>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=turn_on>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=volume_down>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=volume_up>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=volume_set>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event component_loaded[L]: component=media_player>
17-01-23 19:20:59 homeassistant.loader: Loaded tts.google from homeassistant.components.tts.google
17-01-23 19:20:59 homeassistant.bootstrap: Setting up tts
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=tts, service=google_say>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=tts, service=clear_cache>
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event component_loaded[L]: component=tts>

Till this:
17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event state_changed[L]: entity_id=media_player.solo2, old_state=None, new_state=< state media_player.solo2=on; source=RTL Austria - Alles was zählt, source_list=[], media_title=RTL Austria - Alles was zählt, friendly_name=Solo², is_volume_muted=False, supported_media_commands=18829, volume_level=1.0 @ 2017-01-23T19:20:59.290378+01:00>>

everything seems to be OK.
But im not sure whats the next line:
^[[61;95R17-01-23 19:20:59 homeassistant.core: Bus:Handling < Event service_registered[L]: domain=media_player, service=turn_off>

Also have some problems if I may join :slight_smile:

My DM800 causes this errors:

17-01-28 00:06:18 homeassistant.components.media_player: Error while setting up platform enigma
Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/media_player/enigma.py", line 74, in setup_platform
    if enigma.update():
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
    result = method(*args, **kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/media_player/enigma.py", line 179, in update
    .strip()
  File "/usr/lib/python3.4/telnetlib.py", line 329, in read_until
    return self.read_very_lazy()
  File "/usr/lib/python3.4/telnetlib.py", line 405, in read_very_lazy
    raise EOFError('telnet connection closed')
EOFError: telnet connection closed 

I absolute cant get through it… :neutral_face:

Hello. Try to use this new HTTP version.

enigma_xml.py

1 Like

Thanks! :slight_smile:
I shoved it in /home/homeassistant/.homeassistant/custom_components/media_player
and renamed it to enigma.py
Now it seems to work for me :slight_smile:

2 Likes

A small thing:
I there a way to change the device name?
I tried:
platform: enigma name: Dreambox host: 19.10.187.10 port: 23 username: user password: passw

But that seem to have no effect…

(btw. I dont know why these damn code formattings doesnt work properly … :angry: )

Try this new:

enigma.py

If you provide "name: " it will use it.
If not, it will use MODEL from device.
If model not provided, it will use default name “Enigma2 Satelite”

1 Like

Is it even newer than the last one you posted?
I tried using name: but it unregular switched between device model and device name:

My workaround till now is to set the name via cusomization.
Seems to work for now :slight_smile:

It would be really great if you could include Play-Pause button. Would like to pause when my phone rings…

This is working great! Thanks!

Another feature request for this component: the select source service could be used to display the selected channel number.
I want to use this function for a special trick: by choosing an unused channel I would like to change my avr source because I’m missing this function on the dreambox remote…

I’m not sure I understand what you want to achieve? On my e2 box, choosing an unused channel acts as a panic and takes me back to the first channel (you can turn this off) but I’m not sure how this would help with the AVR source. If you tell me what you want to do, I could probably script a call. I’ve got a few scripted calls to my e2 box, including a full reboot to make it easier for the family to restart if it ever crashes (it does sometimes!)

do you want a sensor in HA that shows the active E2 channel?

If the sensor would detect the active channel on in dreambox i could use it in Ha. e.g. when i switch to channel 666 i could change the source of AVR, with switching channel 777 i could fade down lights or whatever…
In IOBroker there is a enigma-plugin that can display msg on screen… thats a very nice feature, too.

ok, so the only challenge is channel numbers. This isn’t something E2 offers so easily, however I can easily get you a sensor that gets the channel name or service Id, e.g.

Sensor
Create a shell script like the below, changing the <IP> and perhaps the paths if you want.
You might need to install xmllint which allows you to xpath parse an xml response

#!/bin/bash
wget --no-check-certificate -O /tmp/e2.xml -o /tmp/e2.log http://<IP>/web/subservices
xmllint --xpath "//*[local-name()='e2servicename']/text()" /tmp/e2.xml
#xmllint --xpath "//*[local-name()='e2servicereference']/text()" /tmp/e2.xml

Then once you’ve done that, add a command line sensor to your config, e.g.

sensor:
- platform: command_line
  name: E2 Channel
  command: '/bin/bash -c "<PATH TO SCRIPT>"'

The example above returns channel name, switch the comment in the shell script to get the service reference if you want that instead

Messages
Messages are easy also, you can drive this from a command shell/script - create another shell script using wget like in the example above, but call something like:

http://<IP>/web/message?text=This+is+a+test&type=3&timeout=10
In this scenario - you can drop the xmllint call as you won’t care about the response.

1 Like

Does anybody else get an error with this file, this is what I get when trying to run the enigma.py file,

> Traceback (most recent call last):
>   File "/home/homeassistant/.homeassistant/custom_components/media_player/enigma.py", line 131, in update
> powerstate_xml = urllib.request.urlopen("http://" + self._host + "/web/powerstate", timeout=10).read().decode("UTF8")
>   File "/usr/lib/python3.4/urllib/request.py", line 153, in urlopen
> return opener.open(url, data, timeout)
>   File "/usr/lib/python3.4/urllib/request.py", line 455, in open
> response = self._open(req, data)
>   File "/usr/lib/python3.4/urllib/request.py", line 473, in _open
> '_open', req)
>   File "/usr/lib/python3.4/urllib/request.py", line 433, in _call_chain
> result = func(*args)
>   File "/usr/lib/python3.4/urllib/request.py", line 1202, in http_open
> return self.do_open(http.client.HTTPConnection, req)
>   File "/usr/lib/python3.4/urllib/request.py", line 1177, in do_open
> r = h.getresponse()
>   File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse
> response.begin()
>   File "/usr/lib/python3.4/http/client.py", line 351, in begin
> version, status, reason = self._read_status()
>   File "/usr/lib/python3.4/http/client.py", line 313, in _read_status
> line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
>   File "/usr/lib/python3.4/socket.py", line 371, in readinto
> return self._sock.recv_into(b)
> socket.timeout: timed out

> During handling of the above exception, another exception occurred:

> Traceback (most recent call last):
>   File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
> result = coro.throw(exc)
>   File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 387, in _update_entity_states
> yield from update_coro
>   File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 209, in async_update_ha_state
> yield from self.hass.loop.run_in_executor(None, self.update)
>   File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
> yield self  # This tells Task to wait for completion.
>   File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
> value = future.result()
>   File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
> raise self._exception
>   File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
> result = self.fn(*self.args, **self.kwargs)
>   File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
> result = method(*args, **kwargs)
>   File "/home/homeassistant/.homeassistant/custom_components/media_player/enigma.py", line 132, in update
> except (HTTPError, URLError, ConnectionRefusedError):
> NameError: name 'HTTPError' is not defined

I seems you can’t access E2 from HASS.
“> socket.timeout: timed out”

Can you access this site: " http://IPofE2/web/powerstate " ?

yes it returns the following

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<e2powerstate>
<e2instandby>false</e2instandby>
</e2powerstate>

Hi, I have giga blue quad with open atv.
Ip, user and pass is correct, but still get error like this:

ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform enigma
Traceback (most recent call last):
File “/root/.homeassistant/custom_components/media_player/enigma.py”, line 131, in update
powerstate_xml = urllib.request.urlopen(“http://” + self._host + “/web/powerstate”, timeout=10).read().decode(“UTF8”)
File “/usr/lib/python3.4/urllib/request.py”, line 153, in urlopen
return opener.open(url, data, timeout)
File “/usr/lib/python3.4/urllib/request.py”, line 461, in open
response = meth(req, response)
File “/usr/lib/python3.4/urllib/request.py”, line 571, in http_response
‘http’, request, response, code, msg, hdrs)
File “/usr/lib/python3.4/urllib/request.py”, line 499, in error
return self._call_chain(*args)
File “/usr/lib/python3.4/urllib/request.py”, line 433, in _call_chain
result = func(*args)
File “/usr/lib/python3.4/urllib/request.py”, line 579, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 401: Unauthorized

Should I allow some service on my box? OpenWebif work nicely…

I had some free time today, so I looked closer on enigma.py script. I have found out that here was no support for HTTP auth. I am not the python programmer, actualy this was my first time :slight_smile: Well I have no idea if it is the best practice, but I put these five lines at end of init method and now it works:

   password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
   password_mgr.add_password(None, host, username, password)
   handler = urllib.request.HTTPBasicAuthHandler(password_mgr)
   opener = urllib.request.build_opener(handler)
   urllib.request.install_opener(opener)

But I still have some problems with empty Source select box.