I’m wondering if someone could point me in the right direction. I want to dim the lights when kodi starts playing but only when the content type is “movie” and the sun is below the horizon. I have created an automation that does this as you can see here (I’m using an input_boolean just for testing as I’ve not configured the scene yet):
automation 2:
alias: Movie time on
trigger:
platform: state
entity_id: media_player.kodi
to: ‘playing’
condition:
condition: and
conditions:
- condition: template
value_template: ‘{{ states.media_player.kodi.attributes.media_content_type == “movie” }}’
- condition: state
entity_id: sun.sun
state: ‘below_horizon’
- condition: state
entity_id: input_boolean.film_time
state: ‘off’
action:
service: input_boolean.turn_on
entity_id: input_boolean.film_time
I wan’t a rule that will go back to a normal scene when the movie stops. I’m struggling with this, because when I stop a movie, its state isn’t “stopped” it returns to “idle” and there is no media_content_type attribute in the state of idle.
So I wan’t to be able to access the media_content_type of the old_state, and check in the condition that this was “movie” to avoid the normal scene to be enabled when stopping other media content types. I can see in the logs that this information is there, but I don’t know if you can, or how to access it?
Does anyone have any ideas how you can achieve this?
You could have an input boolean that you can use as a limiting condition in your other automation that will only be true when the media content type is a Movie.