Does anyone have a suggestion on how to automate lights based on Kodi’s idle time. For example, have all lights turn off if Kodi has been idle for an hour? I have all my other automation working but I’m not sure if there is a way to track idle time. My goal would be to turn all of my downstairs lights off automatically if Kodi hasn’t been playing any content for an hour or so. This way I don’t have to manually turn my scenes off. I can’t base the automation purely off the state because Kodi goes idle when it’s not playing any content, so going through media menus etc. I would need to specify some amount of time.
If anyone else would like to accomplish this, I was able to get it work by doing the following. Note my daylight scene is just a default scene that turns all lights off.
### Turn Lights Off If Livingroom Player Idle for 1 Hour ###
- alias: "No Media Playing"
trigger:
platform: state
entity_id: media_player.livingroom_player
state: 'idle'
for:
hours: 1
minutes: 0
seconds: 0
condition:
platform: state
entity_id: sun.sun
state: 'below_horizon'
action:
service: scene.turn_on
entity_id: scene.daylight