Appears a reboot of the reciever after enabling http auth was required.
2nd vote for being able to select bouquet though
Appears a reboot of the reciever after enabling http auth was required.
2nd vote for being able to select bouquet though
Hi guys
Great inputs. Thanks for that.
So, collecting the inputs.
The 2 is easy to solve. 1 should be working, I will try.
For 3, i got the impression that Enigma was seeking the picons by the reference in the internal picon folder. So it seems it also search for the channel name. In that case i will have to load one picon by default and if it fails then try to load the second way. I’ve to do more tests on this. Don’t know if all enigmas work on this way.
For 4, that’s also one of the things I would like. Since I’ve forked this from other git, I will have to take a look in detail to the way it is being loaded. The problem is it will take more time to load if we have to perform the parsing trough all channels (I’ve more than 3k channels on one of my set top boxes !!!).
Looking forward to have the time to look in to that
Hi everyone
Just committed the new version to github.
It now accepts connections on distinct ports (was working only with port 80).
It accepts all passwords (even password=“password” ).
Regarding the picons, and after reading in some enigma forums, I’m seeing that the standard is to use the channel reference. So I will kindly ask you to try that on your enigmas.
The url to the picon is passed directly to the media_player component. In order to solve this I would need to change my component to check the url in advance, and for each time, request it to the enigma box, check if it exists and then send it to the media_player so it does the same work again.
In case the picon request failed, I would have to check by the name (in lowercase, without special chars), and if the box ack the request, then send it again to the media_player component.
This means that it will at least double the http request to display a picon, and for those who have by channel name, it would triplicate the number of requests.
Unless there are a lot more people with the same problem, i would rather prefer to change the picons names in the box.
@Fran, would it work for you?
Thanks @cinzas ! Renaming the picons is fine for me (I’ll write a simple script to do it for me) but you may come across other people with a similar problem if they are using terrestrial (DVB-T2) tuners. I’ve been doing a little reading and the e2servicereference name is based on the frequency (and other info of the channel). For a satellite (DVB-S) tuner system these would be the same for everyone and so the implemented system works.
However, on the terrestrial system the same TV channel could have different e2servicereference values depending on which transmitter your aerial is pointing towards. Because of this, I guess there is the alternative naming system on the enigma box for picons to deal with these regional variations and looks for a picon name based on the channel name rather than the channel frequency etc.
The openwebif displays picons when you look at the EPG in a browser, so I wonder if there is another way of determining which picon to use, maybe another API call that asks the enigma system which picon to use rather than trying to determine it yourself?
One last thing, would it be possible to make the display of the picon optional and not even attempt to load it? It would avoid problems if the picons are not present for any reason and also gives the option of not using up too much space on the user interface on a smaller screen.
Thanks for your hard work, very much appreciated!
[EDIT] There is a function called getPicon() in services.py of the openwebif source which may be useful. I also notice there is another function called getPiconPath() (defined in info.py) that suggests picons may not always be in one place. Source for openwebif is on github here: https://github.com/E2OpenPlugins/e2openplugin-OpenWebif
Hi Fran
Making the picon optional should be easy.
If I’ve time during the weekend I will implement that.
The functions you reference are on server side and not exposed.
This is currently what is available via http requests: https://dream.reichholf.net/wiki/Enigma2:WebInterface#Client_API
Doesn’t mean that other stuff isn’t impossible to implement, but using enigma2 webinterface with http requests the available methods are restricted.
What I would like to look now is a way to use the notification componente from home assistant and integrate it with the enigma2 component, so we can have notifications sent to the TV whenever we want
Rgds
That’s an interesting resource - I have not seen that before. I understand that something running on the enigma box will have more access, but I wondered if some of the code could be re-used (with changes) to deal with both types of picon naming as both the web UI and this HA custom component need to deal with both.
If you have no objections, I’m going to see if I can modify your code to work in my situation, and then if I am successful (and learning python at the same time!) we could look to merge that into your code.
Notifications on the TV would be great!
Great I would appreciate that !
Learning by doing, that’s also what I’m doing
There’s a bit of work to do, to get the picon file name from the channel name - you have to do a bit of conversion. I did the change in LCD4Linux a long time back, and remember then that this wasn’t so well documented in terms of how the name was created (i.e. what to replace and what not!)
I did it something like this:
name = str(""+self.Lchannel_name)
name = unicodedata.normalize('NFKD', unicode(name, 'utf_8', errors='ignore')).encode('ASCII', 'ignore')
name = re.sub('[^a-z0-9]', '', name.replace('&', 'and').replace('+', 'plus').replace('*', 'star').lower())
name= name +".png"
In terms of notifications, I use this already from HA, but via a command line script that uses curl/wget. against openwebif, i.e.
http://<ip>/web/message?text=The+Encoded+Message&type=3&timeout=10"
will pop up an info message for 10 seconds.
I guess it should be relatively easy to create a notification component for this.
Hi Pembo
You’re right … From what i read, the picon for these cases (that doesn’t use the reference), should be the channel name, all lower case, without spaces, plus png at the end.
For the notification, should be easy, just need the time for that … and last days have been busy
Thanks @pembo - I’ve not have a chance to look at this yet so you’ve saved me the job of checking through the servicenames against the pngs for all the exceptions. There was a similar naming scheme for the channel icons on the Toppy (Topfield 5800) receiver.
Hoping to get a chance to have a go at this later this week.
Hi,
I´m new using home assistant.
I´ve been using this component and, so far, works great!
Is there any way to set the source (channel) by means of a variable?
What I want to do is: when I press a button, the vu+ decoder changes to my favourite sport channel and the lights dime…
Thanks in advance
Hi Cinzas,
Thank you for the custom component! I have tested it and it works with 2 of the 3 dreamboxes I have, but they all have the same settings and software so I don’t know why it doesn’t work with my third dreambox…
This is the error I get in the log, I get that it complaints about the connection but I don’t know why because I can connect to the dreambox manually through the webinterface…
Error while setting up platform enigma
Traceback (most recent call last):
File "/home/hass/.homeassistant/custom_components/media_player/enigma.py", line 150, in request_call
return self._opener.open(uri, timeout=self._timeout).read().decode('UTF8')
File "/usr/local/lib/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "/usr/local/lib/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/local/lib/python3.6/urllib/request.py", line 570, in error
return self._call_chain(*args)
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 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 412: Precondition Failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 82, in async_setup
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 "/usr/local/lib/python3.6/asyncio/coroutines.py", line 212, in coro
res = func(*args, **kw)
File "/home/hass/.homeassistant/custom_components/media_player/enigma.py", line 78, in async_setup_platform
config.get(CONF_TIMEOUT))
File "/home/hass/.homeassistant/custom_components/media_player/enigma.py", line 118, in __init__
self.load_sources()
File "/home/hass/.homeassistant/custom_components/media_player/enigma.py", line 123, in load_sources
reference = urllib.parse.quote_plus(self.get_bouquet_reference())
File "/home/hass/.homeassistant/custom_components/media_player/enigma.py", line 139, in get_bouquet_reference
bouquets_xml = self.request_call('/web/getallservices')
File "/home/hass/.homeassistant/custom_components/media_player/enigma.py", line 152, in request_call
_LOGGER.exception("Enigma: [request_call] - Error connecting to remote enigma %s: %s ", self._host, HTTPError.code)
AttributeError: type object 'HTTPError' has no attribute 'code'
Hi, the error 412 is used when your server does not meet a condition specified by the client.
Can you share your configuration file ?
Can you access that enigma box using your browser ?
Thanks
Hi Cinzas,
Thank you for your time! Yes I can connect to the enigma box using my browser, I can see the channel list and bouquet lists and everything works.
This is my configuration, but it is exactly the same as the other 2 dreamboxes that do work.
#------------------------------------------------------------------------------
# Dreambox
# @NickSchaepkens
# Original Repo : https://github.com/NickSchaepkens
#------------------------------------------------------------------------------
##############################
##### Instructies #####
##############################
# Bij het aanmaken van een nieuwe entity in dit bestand:
# - vervangen dreambox_X door dreambox_Y
# - friendly names aanpassen
# Customize
#------------------------------------------------------------------------------
homeassistant:
customize:
switch.slaapkamer_jos_dreambox:
friendly_name: Slaapkamer Jos Dreambox
icon: mdi:television
# homebridge_visible: true
media_player.slaapkamer_jos_dreambox:
friendly_name: Slaapkamer Jos Dreambox
icon: mdi:television
group.slaapkamer_jos_dreambox:
friendly_name: Slaapkamer Jos Dreambox
icon: mdi:television
# Groups
#------------------------------------------------------------------------------
group:
slaapkamer_jos_dreambox:
view: no
control: hidden
entities:
- binary_sensor.slaapkamer_jos_dreambox
- switch.slaapkamer_jos_dreambox
- media_player.slaapkamer_jos_dreambox
# Binary sensors
#------------------------------------------------------------------------------
binary_sensor:
- platform: ping
host: !secret slaapkamer_jos_dreambox_ip
name: Slaapkamer Jos Dreambox
count: 2
scan_interval: 5
# Switches
#------------------------------------------------------------------------------
switch:
- platform: template
switches:
slaapkamer_jos_dreambox:
value_template: "{{ is_state('binary_sensor.slaapkamer_jos_dreambox', 'on') }}"
turn_on:
service: media_player.turn_on
entity_id: media_player.slaapkamer_jos_dreambox
turn_off:
service: media_player.turn_off
entity_id: media_player.slaapkamer_jos_dreambox
# Media players
#------------------------------------------------------------------------------
media_player:
- platform: enigma
host: !secret slaapkamer_jos_dreambox_ip
port: 80
name: Slaapkamer Jos Dreambox
icon: mdi:satellite-variant
timeout: 20
username: !secret dreambox_username
password: !secret dreambox_password
Thanks @Cripplin
What image are you using on that dreambox, and what version of OpenWebIf ?
Also, can you get a xml output when running the command below from HA ?
curl -u root:<your_password> http://<your_enigma_ip>/web/getallservices
Just a quick update.
I’ve finished the notify component for enigma
It is possible to send messages to the enigma boxes using the notify component.
messagetext=Text of Message
messagetype= [0= Yes/No, 1= Info, 2=Message, 3=Attention]
timeout=Can be empty or the Number of seconds the Message should disappear after.
I will try to release it until the end of the week
Thanks for your help. I use OE 2.5 and GP 3.3 on that dreambox. I looked in the webinterface and found these details:
Device Name: | dm520 |
---|---|
Dreambox OS Version: | 4.3.1r27-2018-03-20 |
Image Version: | Experimental 2017-01-02 |
Frontprocessor Version: | VNone |
Webinterface Version: | 1.8.0 |
I also executed the curl command and this is the result:
<html>
<head><title>412 - Precondition failed!</title></head>
<body>
<h1>Precondition failed!</h1>
<p>sessionid is missing, invalid or expired!</p>
</body>
</html>
Thank you!
Latest OpenWebIf version is 1.3.1
I changed the component and added the headers to the request.
Try now to see if it works.
I will commit the update in the next minutes (together with the notify component)
Hi Cinzas,
I tried it again and it gives the same result as before: HTTP Error 412: Precondition Failed.
You also said that the latest OpenWebIf version is 1.3.1, but I got a version of 1.8.0, so I guess i’m using an other webinterface than OpenWebIf? Or am I using a beta version?
I also tried the notifications on the other dreamboxes that do work and it works wonderfully! Thank you for this component.
Cheers
Good to know
I’m not using the notifications
Regarding openwebif, you can find the changelog here: https://github.com/E2OpenPlugins/e2openplugin-OpenWebif/blob/master/CHANGES.md
So I wonder which version of OpenWebif you’re using.
Can you post a screenshot of the webinterface ? And the about link ?