For the moment my PC running, Debian & HA supervisor is in a small upstairs room , second house, 400 kms away
Now while all works well, in the latest heat wave that particulier room and the PC get extremely hot and the PC shuts down because it’s overheating. Tiny PC no fans
Now I written the following script, shutting down the PC before it’s gets really to hot which works, but it doesn’t shut down the PC cleanly. Is there a way of sending an instruction to the Debian’s terminal giving it the shutdown command when the temp sensor reaches a certain figure, so the its shuts down cleanly ? rather than just turning of the plug ?
alias: Turn PC of if too hot
description: turn PC of if too hot
trigger:
- platform: numeric_state
entity_id: sensor.ewelink_bureau_temperature
above: "30"
condition:
- condition: device
type: is_on
device_id: bd5f25bcce1f69bbd82fac448dbc14c5
entity_id: 4f17c06d0995d34dd2c34dace954a09d
domain: switch
action:
- type: turn_off
device_id: bd5f25bcce1f69bbd82fac448dbc14c5
entity_id: 4f17c06d0995d34dd2c34dace954a09d
domain: switch
enabled: false
mode: single
PS I could send myself a mail with warnings about the heat and shut it down at a distance, but as I’m not always at home this isn’t optimum
alias: test shutdown
description: test shutdown
trigger:
- platform: numeric_state
entity_id: sensor.ewelink_bureau_temperature
above: "30"
condition: []
action:
- service: shell_command.my_script
shell_command:
my_script: /usr/local/bin/ha_shutdown.sh
mode: single
But whatever I try I can’t get past an error message Message malformed: extra keys not allowed @ data[‘shell_command’]
I’ve tried adding, deleting spaces to no avail, also adding [] after action, again to no avail, also trying with " beginning/end of /usr/local/bin/ha_shutdown.sh
Where is your ha_shutdown.sh file stored? It seems its not in /usr/local/bin since HA cannot find it. Just put it into /config for example and change your shell command to my_script: bash /config/ha_shutdown.sh
Sorry my fault. Create 1 user, eg. homeassistant or use an existing one and add it to the sudo group and sudoers file. Then use this user for the ssh command. For user homeassistant you would use:
So it seems that the host is not accepting the ssh connection. Can you please enable debugging for shell_command in configuration.yaml, restart HA, try again and check the logs.
logger:
default: critical #or whatever you use
logs:
homeassistant.components.shell_command: debug