Beyonwiz T4 (potentially Enigma2 STB) media player custom component

Hi,

This is a media_player _custom component for Enigma2 based STB’s running the OpenWebif web interface. It has only been tested by me with my Beyonwiz T4 DVB set top box.

I’ve been using this for about a year and it’s served my purposes. I’d like to clean it up, maybe add some functionality and make it more robust/compatible. It’s nothing special but I thought I’d throw it out onto the internet so that the community can help me improve it.

You can find it at https://github.com/mihalski/homeassistant/tree/master/custom_components/media_player

EDIT: Improved handling when Enigma2 host is unreachable. Any requests for features?

Regards,
Michal

2 Likes

Hi, thanks for sharing this - working fine with my T4

this has been working pretty well for me in the past - will keep using the notification function that has worked well for me also

Thanks. Curious to see how someone else did the media player component.

I also meant to do a notify component but I couldn’t really find a use case where I needed it. Will give this a go. Maybe caller ID information if someone calls while you’re watching TV?

I find it useful notifying me of movement outside at night as an example.

Notificación is interesting for notifications when a device tracking detects a device arriving/leaving a zone (for example, my daughters).

Meanwhile, I have tried your component with no success in my new hassio instalation. I has copied the enigma2.py to /config/custom_components/media_player folder, but when I reboot Home Assistant, I obtain the following error:

File “/config/custom_components/media_player/enigma2.py”, line 7

^
SyntaxError: invalid syntax
Fatal error while loading config: invalid syntax (enigma2.py, line 7)
Failed config
General Errors:
- invalid syntax (enigma2.py, line 7)
Successful config (partial)

Any suggestion.

Anyway, thanks for your contribution.

That’s a baffling error. That is an empty line.

What does your configuration.yaml entry look like?

How did you download the file? Maybe delete it and then from the command line:

cd /config/custom_components/media_player
wget https://github.com/mihalski/homeassistant/raw/master/custom_components/media_player/enigma2.py

Then restart to see if you still get the same error.

Yes, you are right. I think that it was a weird problem with the file that I uploaded.

Now I am using the solution of cinzas (the one that grantc mentioned it), since I am not sure how to use your solution with login/password of my Box.

Thanks for your attention and work.

You’re welcome.

I have not yet implemented user/pass as I don’t use them. Will look into it after I solve another problem I’m currently trying to deal with… ie when the Enigma box is unreachable.

1 Like

It appears that this component has broken with 0.88 (still in beta) due to the new naming conventions of the custom_components folder. Is there a quick fix for this?
From what I can tell it has gone from media_player/enigma2.py and now has to be enigma2/media_player.py

https://rc--home-assistant-docs.netlify.com/blog/2019/02/13/release-88/

Have you tried doing just that? If that’s all that is involved then it should just work.

On a side note this component should be getting some more attention soon.

Yes have done the obvious and nothing - no errors in the log or media player in HA. Weird

I’ll give this a go tomorrow. Might ask a few questions tonight on the Discord as well.

@mihalski great work on this. I have been using my own the past couple of years and am in progress trying to get it merged here:

Initially, I was told the logic needed to go into a pypi pip module, so I created openwebif.py on pypi and this PR consumes that.

I’d love to add the channel selection like you have. That would be a nice addition to my existing PR (after I get it merged first I guess).

Oh and last night I got auto-discovery working, so just by launching Hass, both my Vu Duo2 and Vu Zero showed up a few seconds later in the UI. Zero config needed.

edit: I got channel selection working now.

Please comment on the PR if you would like to see it merged, so maybe the review might get picked up quicker!

https://github.com/home-assistant/home-assistant/pull/21271

Good work!
I have not had the chance to try the component yet and I’m curious if you handled the issue my component had with the channel list.

If the list updates while I am viewing it then it jumps to the top. This happens on every update. I was going to implement a check to see if the list had changed from the last update to mitigate that but on second thought it might be something best initialised at setup and not checked again?

Yes for mine, I just initialise once on startup. If channel lists change then a restart of HA is required. I think this is ok as I know my lists change very infrequently.

Also, currently my implementation only reads the first bouquet, which for me is my Favourites one, and that is very static in my case.

You’re clearly more adept at Python than I am (I am literally only just beginning to learn) so I’m happy your component looks like it will make it into Home Assistant.

I’ve not yet looked at your openwebif library, but I was curious whether it was exclusively openwebif or if it also utilised the api calls?

Once I’m a little better versed in python I might do a parallel development of my component just to see how that goes. Maybe I will have something useful to contribute then.

Absolutely, I think with a couple of people working on it there could be some nice new features.

My PR just got merged, so it will be released in the 0.90 version of HA.

I am thinking that a notify component would be nice so people could send text to the TV screen via the UI or via an automation. This should be straight forward to do.

Regarding APIs: I only know about the OpenWebif ones. Are there others that you know of?