Adding MythTV Frontend component

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

@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

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

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

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.

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.

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:

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:

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.

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

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.

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.

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:

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

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

Working nicely on my system too. 8)

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!

1 Like

Has anyone got this working with Home Assistant OS / core-2021.x ?
I had it working with minimal hassles before on Hassbian (using instructions from GitHub - calmor15014/HA-Component-mythtv-frontend: Home Assistant media player component for MythTV 0.27+ Frontend) but now with all the containerisation I don’t know where to start when trying to install. Any tips or pointers to get me started would be greatly appreciated.

Hi Wade. This is on my medium-term TODO list.
What do you mean about “with all the containerisation”? What install method are you using?

Hi Lindsay.

I’m on a Pi 4 with Home Assistant OS (Raspberry Pi - Home Assistant).
Re containerisation: With Hassbian being plain linux, it was straight forward to locate files / paths / where and how to install things. With haOS, SSH is via an add-on that allows access to that add-ons container, and “This add-on will not enable you to install packages or do anything as root” (from it’s docs).

1 Like