Home Assistant Community

Adding MythTV Frontend component

media_player
Tags: #<Tag:0x00007fcf4dd7c840>
#48

Good. I’m happy to add timeout as a config option… I went to do it but the master and dev branches are a bit disjointed now (dev is is 2 commits ahead, 3 commits behind master) and I can’t quite tell what it should be.
Do you want to update this so that dev and master are both the latest, then I’ll checkout dev and add the next update to it?

#49

I’ll do that today so that we’re ready to go!

1 Like
#50

I started to look at it this weekend, but my Git knowledge is pretty bad… I’ll try to focus on getting them straightened out early this week.

1 Like
#51

Okay, I think I fixed it. Dev now shows 0 behind, 1 ahead (which just seems to be the merge request to get the master branch updates in). I also removed the novalidate option from the API requests, as the 0.27 version issue was fixed in MythTVServicesAPI.

I’m still pretty green with GitHub, so if I need to do something else, feel free to let me know what that is or if you have other input there, let me know.

Beyond that, I think it’s ready to go?

1 Like
#52

@calmor15014, @lindsayward, judging by the timestamps, you’re as busy as I am,
probably more.

I just looked at the source and noticed that the ‘old’ method of detecting errors
is still in use. Starting with 0.1.3, use exceptions like this:

    except RuntimeWarning as warning:    
        print('\nWarning: "{}"'.format(warning))                                
    except RuntimeError as error:                                               
        sys.exit('\nFatal error: "{}"'.format(error))
1 Like
#53

As to SendAction, the fix for 0.28 (and above) was committed
in Aug. 2017

#54

Starting with MythTV version 30.0, the Services API module is included
with the Python Bindings. Import it like this:

from MythTV.services_api import send

This will no longer be maintained on the previous github account. See:

Services API

1 Like
#55

Thanks. I noticed after upgrading to HA 0.88 that this component no longer works, so I’ll look into doing an update that fixes it and also refers to the Python bindings instead of the deprecated API.

#56

Yes - I just encountered this too. Following advice here and here I hacked a fix for myself on hassio:

cd /config/custom_components
mkdir ./mythfrontend/
cp ./media_player/mythfrontend.py ./mythfrontend/media_player.py
touch ./mythfrontend/__init__.py
rm ./media_player/mythfrontend.py

In mythfrontend/media_player.py, change:

from homeassistant.components.media_player import (
    SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, SUPPORT_PREVIOUS_TRACK,
    SUPPORT_TURN_OFF, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_STEP,
    SUPPORT_PLAY, MediaPlayerDevice, PLATFORM_SCHEMA, SUPPORT_TURN_ON,
    SUPPORT_VOLUME_SET, SUPPORT_STOP)

to:

from homeassistant.components.media_player import (
    MediaPlayerDevice, PLATFORM_SCHEMA)
from homeassistant.components.media_player.const import (
    SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, SUPPORT_PREVIOUS_TRACK,
    SUPPORT_TURN_OFF, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_STEP,
    SUPPORT_PLAY, SUPPORT_TURN_ON,
    SUPPORT_VOLUME_SET, SUPPORT_STOP)

You may also need to reinstall the mythtv_services_api as hassio 0.88 also seems to have bumped to python 3.7 and I needed to reinstall.

Cheers,
Glenn.

#57

Hi @apiguy Bill :slight_smile:

I asked on the MythTV forum… but can you tell me how to install the API from this new location (on a machine without MythTV)?
Thanks :+1:

#58

Could I ask anyone using this component to test my latest update?


@calmor15014 - if it works for you, you could merge the PR into master. EDIT: merged and link updated.

I have chosen to change mythfrontend to mythtv and I’ve also included the notify platform, which was previously in another branch and has been updated.
I’ll update the code to use the new API/location when I can find out how :slight_smile:

#59

I’ve updated the readme and installation instructions.
It would be great if someone could give this a go and let me know if there are any areas that need improvement. Thanks.

#60

I just updated my hass-dev environment to 0.89.2 and am still working out some of the config. I intend to finally upgrade my production environment soon, so I’ll be making a push to get everything sorted out here as well. I’ll merge and test by this weekend. Still on MythTV 0.27 though; that’s going to have to wait until after hockey season to upgrade…

1 Like
#61

I just upgraded MythTV to 0.30 with some amount of trepidation, but it all went well. Still on Ubuntu 14.04.
Nothing to merge in our repo; I updated the readme on master since it was out of sync with the code.
I’d like you to look at the instructions and see if there might be a better way… Now that we have a folder and multiple files, it takes an extra wget per code file. If we added more, we’d need to wget each one… I couldn’t see another way easily. It works for me though…
I’m still hoping we can get some testers and improve things as needed based on feedback.

#62

I’ve just tried getting mythtv integration working again and have not quite succeeded. I was using HA 0.84 on hassbian with MythTV 0.28 and had it all working for 3 different frontends around the house.

I’ve upgraded HA to 0.90.1, removed my previous mythfrontend media player and followed the new installation instructions on https://github.com/calmor15014/HA-Component-mythtv-frontend, including the 2 wget commands.

On starting HA I get
“Error while setting up platform mythtv”
[snip…]
File “/home/homeassistant/.homeassistant/custom_components/mythtv/media_player.py”, line 92, in init
from wakeonlan import wol
ImportError: cannot import name ‘wol’

I did have wakeonlan 1.1.6 installed, but I have removed that and installed wakeonlan 0.2.2 but the error still remains. I have just commented out lines 92 and 103 that make reference to wol. HA willl then start up with no errors logged, just a warning about “You are using a custom component for mythtv.media_player”. And with a reload of my web browser, HA now shows my frontend and play/pause are working.

Any pointers on getting the wol code not to error? I don’t actually use it with the my frontends, it’s just I don’t like having to comment out stuff to make it work, it feels wrong.

#63

Thanks for the report Wade. I’ll look into this as soon as I can and get back to you. Good that it mostly works :slight_smile:

#64

I just made a pull request which fixes the wol error to work with the wakeonlan that homeassistant wake_on_lan component uses.
if you want you can try my unofficial branch
You will need both media_player.py and manifest.json

to note I also added shutdown and seek.

1 Like
#65

Thanks for the PR! I’ve tested it and merged. Looking good on my systems.

#66

Working nicely on my system too. 8)

#67

I finally got some time to get onto MythTV 30. I’m happy to see everyone adding on, and look forward to testing it out soon!