Thanks. That was it.
Running HA Supervised supported/healthy. I am attempting the following in an automation:
- id: drups beeper off
alias: "DRUPS beeper off"
trigger:
platform: state
entity_id: input_boolean.drups_beeper
to: "Off"
action:
service: hassio.addon_stdin
data:
addon: a0d7b954_ssh
# input: "/config/sudo docker exec addon_a0d7b954_nut upscmd -u admin -p xxxx DR_UPS beeper.enable"
input: "/config/boff.sh"
I have tried both actions, neither works nothing logged in home-assistant.log or in the SSH log with level set to debug. I have logbook entries for the automations triggering (both on and off).
I can run either from the ssh shell and both work well. The script files just contain the sudo line.
What am I not understanding correctly? The beeper test is a basic test that does not change the ups state, not the intended long term target command. I have also tried the full container name of addon_a0d7b954_ssh.
try using
to: off
instead, all lowercase
Tried it with an error:
2021-03-02 15:06:44 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: expected str for dictionary value @ data['to']. Got None. (See ?, line ?).
Either â â or " " seem to be required.
Sorry, should be
to: âoffâ
In a pure python hass core, I am pretty sure you have already SSH enabled. So you just need to setup the WebTerminal aka ttyd and add to home assistant as a new panel iframe
This is how this automation works.
alias: UPS
description: ''
trigger:
- platform: state
entity_id: sensor.ippon650_beeper_status
to: enabled
condition: []
action:
- service: hassio.addon_stdin
data:
addon: a0d7b954_ssh
input: sh /config/nas/beeperoff.sh
mode: single
Code beeperoff.sh
sudo docker exec addon_a0d7b954_nut upscmd -u admin -p *** [email protected] beeper.toggle disabled
Dude, that is awesome! It is working well now. So much more straight forward than sshpass ever was.
Thanks
Final automation:
- id: drups beeper off
alias: "DRUPS beeper off"
trigger:
platform: state
entity_id: input_boolean.drups_beeper
to: 'off'
action:
service: hassio.addon_stdin
data:
addon: a0d7b954_ssh
input: sh /config/boff.sh
Final shell script
sudo docker exec addon_a0d7b954_nut upscmd -u admin -p xxxx [email protected] beeper.disable
Hi, i have a problem with ha core, web gui not working but ssh works, and i try to work with docker but have a message: that to work with docker i need to Turn off Protection Mode from Web gui. but i hanât gui now, can turn off it from terminal? i have hassio os on rpi4. tnx
Is there any way to get the execution results of a script back into HA?
Have an HA-automation for scheduled backups. One action of this automation is calling a Shell-Script in the ssh&webterminal addon.
I would like to somehow report on the success/failure of the execution in HA.
I use MQTT to get info back from a shell script and then an MQTT sensor.
Thanks for the suggestion but Iâm not using MQTT.
Does anybody see another way?
You can publish to a sensor directly using a long lived access token and rest
This sounds interesting. I guess Iâll have to dig into this a little.
If you look at the Aussie Broadband script on my Github you can see an example of how to write to a sensor directly. When you restart HA you might end up with an unknown state till it populates it⌠MQTT will write a retained message so it wonât do that but its a minor issue.
perfect solution for mac users
Is there an example how to use the init_commands to customize files?
I really want to have a custom .vimrc file so I donât have to remake it every timeâŚbut there seems little to no documentation about how to use it.
This doesnât seem to work, and I donât know why or where it might tell errors.
init_commands:
- ln -s /config/.vimrc /root/.vimrc
The symlink doesnât appear on restarting the addon and logging in.
Any ideas on how to copy output to the clipboard? In normal bash you just highlight it but in zsh it does nothing and unhighlights as soon as you release the mouse. There also seems to be zero online help for doing this.
Everytime I update HA from the terminal now it works perfectly however there is an obscure error returned:
Post "http://supervisor/core/update": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
Any ideas? Only does this with the latest update to the addon.
This is awesome. What service should I call to do this?
I just installed Home Assistant OS on Raspberry Pi for testing purpose.
Have been using HA in Docker on RPi since last year.
Now I am trying to establish SSH access to HA.
Installed this addon.
But cannot establish a connection neither with Putty (âconnection refusedâ) nor with web access (â502: Bad Gatewayâ).
Can anyone teach me how to do it?
Log:
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] permissions: applying...
[fix-attrs.d] permissions: exited 0.
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing...
-----------------------------------------------------------
Add-on: SSH & Web Terminal
SSH & Web Terminal access to your Home Assistant instance
-----------------------------------------------------------
Add-on version: 8.2.2
config:
ssh:
username: hassio
password: ''
authorized_keys: []
sftp: false
compatibility_mode: false
allow_agent_forwarding: false
allow_remote_port_forwarding: false
allow_tcp_forwarding: false
zsh: true
share_sessions: false
packages: []
init_commands: []