New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kodi: media content type issue #6989
Comments
I noticed this the other day when my lights failed to dim. For some reason the media_content_type attribute has now changed to show the 'type' of video that is playing. Rather than "video" it now displays "tvshow" or "movie". You need to change the conditions in your automation(s) to: - alias: 'Media player playing'
trigger:
- platform: state
entity_id: media_player.kodi
from: 'idle'
to: 'playing'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: state
entity_id: group.ceiling
state: 'on'
- condition: or
conditions:
- condition: template
value_template: '{{ states.media_player.kodi.attributes.media_content_type == "tvshow" }}'
- condition: template
value_template: '{{ states.media_player.kodi.attributes.media_content_type == "movie" }}'
action:
service: scene.turn_on
entity_id: scene.cinema_time Hope this helps. |
@mf-social |
That's odd, definitely there for me in the latest version. Hope you get sorted. |
Are you playing content from your library? |
@Spartan-II-117, |
Hmm, looking through the recent code changes it looks like it should still show up, but I'm not a programmer, so I can't tell for sure |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 |
The issue still persists in the recent 49.0 |
Any news on this? I am on 0.53.1 and just started to get more into the hass.io and kodi integration. I have an automation that looks like this:
It sends some kind of command to kodi as I can see the spinning wheel on the kodi screen, but then it goes back to the GUI without starting TV. |
Sorry to ask you to check again but: I'm running 17.3 & hass 0.56dev0 and playing a tvshow i can see this in the dev tools: |
@Molodax is this still an issue? |
For me this sort of works. I can see the |
@tschmidty69 sorry, I will be able to check it in a couple of weeks only. |
I've managed to solve this issue. The problem is in video type definition in Kodi. The existing procedure makes two API calls: Player.GetActivePlayers to determine if player active, and then, if there is one, call to Player.GetItem gets item details, exposed as attributes of Kodi entity in HASS. And here's the problem: player item's property "type" is "unknown" for all videos not recognised by Kodi's scrobbling: so, if you play something known by IMDB, for example, the "type" is "movie":
but when you play your home video, or some other file with unrecognised name or tags - "type" is "unknown"
this causes "@Property media_content_type(self)" to return None, so HASS entity has no "media_content_type" attribute at all. My solution is pretty simple: the first call to Player.GetActivePlayers also returns "type" of player, and it is "video" for all videos, so it is possible to return Player type when Item type is unknown
Hope this will be fixed in further versions, and now my temporary solution is to create custom platform "kodi_m", which fully inherits the existing Kodi platform except media_content_type property <config_dir>/custom_components/media_player/kodi_m.py
configuration.yaml (with normal and test instances)
As the result, all videos are displayed as "movie", so now it is possible to make automations (I'm going to dim lights, of course). |
If you have implemented the fix why not create a PR? |
yes, on my way to it )) |
* media_content_type fix Kodi media_content_type attribute display fix * media_content_type fix (#6989) fixes attribute display for unknown media * code cleanup * trailing whitespaces * comments correction * redundant "else:" removed
Make sure you are running the latest version of Home Assistant before reporting an issue.
You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:
Home Assistant release (
hass --version
):Since 0.41.0
Python release (
python3 --version
):3.4.2
Component/platform:
Kodi
Description of problem:
After implementing PR #6645 there is no media_type_content while video is playing.
My automation doesn't work after upgrading to HASS 0.41 and later
Expected:
Be able to distinguish media type content using
attributes.media_content_type
Problem-relevant
configuration.yaml
entries and steps to reproduce:Traceback (if applicable):
Additional info:
Media content type is available while audio is playing.
The text was updated successfully, but these errors were encountered: