Paulsy
August 25, 2022, 1:36am
1
I looked through several previous posts here, but it was unclear if anyone got this working.
As above, I am trying to set up automations to turn on and shutdown a Kodi box. I followed the guide for the automations. Hopefully, someone else can share some tips.
Here is my automations.yaml [updated]
- id: '1661306317495'
alias: kodi_turn_on
description: 'Kodi: turn on'
trigger:
- platform: device
device_id: 3ff4f8b23626591a9adf701582858245
domain: kodi
entity_id: media_player.kodi_9c18780de34aae3fb9a983f5c86b8be6
type: turn_on
condition: []
action:
- service: script.turn_on
data: {}
mode: single
- id: '1661306445047'
alias: kodi_turn_off
description: 'Kodi: turn off'
trigger:
- platform: device
device_id: 3ff4f8b23626591a9adf701582858245
domain: kodi
entity_id: media_player.kodi_9c18780de34aae3fb9a983f5c86b8be6
type: turn_off
condition: []
action:
- service: kodi.call_method
data:
method: System.Shutdown
mode: single
tom_l
August 25, 2022, 2:05am
2
Your first automations does not seem to make sense.
For the kodi_turn_on automation you have:
Trigger: kodi media player turning on
Action: Shut down kodi host.
So this will shut down kodi as soon as you turn it on. I’m pretty sure you don’t want to do that.
For the kodi_turn_off automation:
Trigger: kodi media player turning off
Action: shut down kodi host.
Better. But does the media player turn off or does its state become idle
. That’s what mine do.
FYI: there’s no point redacting your device or entity ids. They are no use to anyone.
Paulsy
August 25, 2022, 2:33am
3
Thanks for pointing out the kodi_turn_on error. Not sure what happened there. I corrected my automations.yaml. I still haven’t seen any changes in Kodi History outside of when I play/pause media.
tom_l
August 25, 2022, 2:35am
4
When you run the actions manually does the action work?
Paulsy
August 25, 2022, 2:55am
5
I tried stopping Kodi via HA media player without success. Also manually triggering the automations did not change the KODI state. It remains paused.
tom_l
August 25, 2022, 3:10am
6
Then the integration is not set up correctly.
Did or did not?
Paulsy
August 25, 2022, 3:35am
7
I can play/stop media, but the turn off button on the media player does nothing.
tom_l:
Did or did not?
My bad. Did not change the KODI state.
trentjw
(Trenton J Wilson)
August 25, 2022, 3:44am
8
not sure if this is a path for you I built a switch that powers on and turns off my kodi which is on a PC running windows I then just use the automation to turn the switch on or off as needed
- platform: wake_on_lan
# mac: "10:BF:48:71:58:63"
mac: "D4:5D:64:B3:1A:FE"
name: HTPC
host: 192.168.1.129
turn_off:
service: kodi.call_method
data:
entity_id: media_player.htpc
method: System.Shutdown
1 Like
tom_l
August 25, 2022, 3:52am
9
[quote=“Paulsy, post:7, topic:453697”]
Stopping is not the same as turning off. Please try to describe your issue accurately.
I believe your automation issue is that you have not specified which media player to shut down. You need to provide an entity id, try this:
- service: kodi.call_method
data:
entity_id: media_player.kodi_9c18780de34aae3fb9a983f5c86b8be6
method: System.Shutdown
Paulsy
August 25, 2022, 3:29pm
11
[quote=“tom_l, post:6, topic:453697”]
tom_l:
Paulsy:
I tried stopping Kodi via HA media player without success
[/quote]
Then the integration is not set up correctly.
[/quote]
I can play/stop media, but the turn off button on the media player does nothing.
Stopping is not the same as turning off. Please try to describe your issue accurately.
I believe your automation issue is that you have not specified which media player to shut down. You need to provide an entity id, try this:
- service: kodi.call_method
data:
entity_id: media_player.kodi_9c18780de34aae3fb9a983f5c86b8be6
method: System.Shutdown
You are correct. Adding the entity_id fixed my shutdown problem.
Now I have to work on the WOL power on.
Paulsy
August 25, 2022, 3:30pm
12
trentjw:
ot sure if this is a path for you I built a switch that powers on and turns off my kodi which is on a PC running windows I then just use the automation to turn the switch on or off as needed
- platform: wake_on_lan
# mac: "10:BF:48:71:58:63"
mac: "D4:5D:64:B3:1A:FE"
name: HTPC
host: 192.168.1.129
turn_off:
service: kodi.call_method
data:
entity_id: media_player.htpc
method: System.Shutdown
Thanks for sharing this! The shutdown script works perfectly. Now I just need to add the WOL.