Your favourite automations

@myle - sure!! First of all - I’ll give credit where credit is due - I had to start a thread where I was having to determine the type of content playing - as I didn’t want the lights to dim when playing ‘tv’ content vs ‘movies’ - so credit to @Zen for the help!! - Thread is here - KODI - Content Type - Movie vs Tv Show - Library

I had the whole solution in that thread - so I’m copying/pasting from there - it’s all still working perfectly!!

Just so everyone has the solution -

bash script:
#! /bin/bash

curl -s -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "playerid": 1}, "id": "VideoGetItem"}' http://<<<IP ADDRESS OF KODI>>>/jsonrpc | if [[ $(grep -o movie) ]]; then echo "ON"; else echo "OFF"; fi
Sensor:
- platform: command_line
scan_interval: 10
name: Movie_Time
command: "/usr/bin/mediachecker.sh"
payload_on: "ON"
payload_off: “OFF”

Automation:
- alias: "KODI Movie Stopped"
trigger:
- platform: state
entity_id: sensor.movie_time
from: 'ON’
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
action:
service: scene.turn_on
entity_id: scene.Kodi_Stopped

- alias: "KODI Movie Playing"
  trigger:
    - platform: state
      entity_id: sensor.movie_time
      to: 'ON' 
  condition:
    - condition: state
      entity_id: sun.sun
      state: below_horizon
  action:
      service: scene.turn_on
      entity_id: scene.Kodi_Playing
Scene:
scene:
- name: Kodi_Playing
entities:
light.linear_lb60z1_dimmable_led_light_bulb_level_3_0:
state: on
brightness: 25
switch.ge_unknown_type5052_id3031_switch_2_0: off

 - name: Kodi_Stopped
   entities:
     light.linear_lb60z1_dimmable_led_light_bulb_level_3_0:  
      state: on
      brightness: 255
     switch.ge_unknown_type5052_id3031_switch_2_0: on 
1 Like