I have had a Shell command to suspend my PC I created a year or so ago …
shell_command:
suspend_pc: >-
ssh -i /config/HA2Main -o 'StrictHostKeyChecking=no' [email protected]
'[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms";
[System.Windows.Forms.Application]::SetSuspendState([System.Windows.Forms.PowerState]::Suspend, $false, $false);'
I’ve been calling from an Automation triggered by me going out. The automation does other stuff as well like turning lights and heating off; some before and some after the Shell Service call.
alias: Graham goes out
description: ""
trigger:
- platform: state
entity_id:
- person.graham
from: home
to: not_home
for:
hours: 0
minutes: 5
seconds: 0
condition:
- condition: state
entity_id: binary_sensor.owl_away
state: "off"
action:
- service: light.turn_off
data: {}
target:
entity_id: light.light_white_study_top
- service: shell_command.suspend_pc
data: {}
- service: climate.set_hvac_mode
data:
hvac_mode: "off"
target:
entity_id: climate.hall_thermostat
mode: single
I’m pretty sure it used to work fine but I noticed the other day that things after the Shell Service call aren’t running. Checking the Automation trace I can see an error after or at the Shell Service call that stops the Automation running any further. The suspend_pc still works from the Automation and from Developer Tools.
I could put it last but I’m keen to know what is wrong as I am writing another automation for when I go to bed where I don’t want it to be last, and that one stops there as well.
The error log says…
Logger: homeassistant.components.shell_command
Source: components/shell_command/__init__.py:94
Integration: Shell Command (documentation, issues)
First occurred: 20 September 2023 at 08:30:05 (14 occurrences)
Last logged: 17:10:22
Timed out running command: `ssh -i /config/HA2Main -o 'StrictHostKeyChecking=no' [email protected] '[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms"); [System.Windows.Forms.Application]::SetSuspendState([System.Windows.Forms.PowerState]::Suspend, $false, $false);'`, after: 60s
Am I correct in inferring that this only started on the 20 September? That might be (not sure) when I upgraded to HA 2023.9.1 (haven’t gone for 2 or 3 yet)? Something to do with Service call responses perhaps?
Any ideas anyone?