I run my homeassistant (v0.95.1) instance in an iocage jail on my FreeNAS server.
I’m looking to add temperature monitors to homeassistant for the CPU and hard drives of my server via the command_line sensor.
This is what I have within my configuration.yaml at present:
I have set up ssh using key authentication (ssh-keygen + adding public key to the root FreeNAS user) and have verified that the above command functions as expected when run manually by ssh-ing into my freenas (through cmd), changing into my homeassistant jail (so that the commands are executed from ‘root@homeassistant’) and testing. This returns 26 (°C). However on the homeassistant front end, a blank value is returned (as below). There are no related entries in the home-assistant.log (which doesn’t help with troubleshooting!)
Does this mean that the SSH connection was successful (no error) and there is most likely an issue with a blank return value or a value that couldn’t be parsed? Or is is still possible that SSH fails and just doesn’t throw an error? I’ve tried removing the ‘-q’ from the command but this still doesn’t give any errors. Perhaps there is a permissions problem?
I’ve tried a few steps from other forums around the net but I haven’t has any success.
Any thoughts would be appreciated
I have hassio running on ubuntu on an old PC. There’s also a Raspberry Pi running rtl_433 getting data from a few 433 MHz sensors and sending them over MQTT.
What I’m trying to do is get a reading of the Pi’s core temperature using a command line sensor. I have SSH keys setup from the hassio machine to the Pi, everything works well when trying the command from hassio shell:
Hi @MrSir - I’m trying to achieve something similar via SSH. Feels like I’ve been going round in circles for most of the day now… trying this via both shell_commands & command_line.
I’m running home assistant OS on a RPi4 and want to SSH to a Lubuntu VM, the end game is to monitor the VPN status on the Lubuntu box so I can create automations based on this. I’m using HA OS.
I’ve shared the public key between the HA and the Lubuntu VM. When on the CLI within the HA web interface, I can SSH without any issues, even without including -i /data/.ssh/id_rsa. But when I create a command_line sensor (shown below) the SSH logs on the Lubuntu box indicate the authentication is failed based on password.
Jul 14 18:25:52 ubuntu sshd[7942]: Connection from 192.168.0.102 port 35238 on 192.168.0.101 port 22
Jul 14 18:25:52 ubuntu sshd[7942]: Failed none for matt from 192.168.0.102 port 35238 ssh2
Jul 14 18:25:52 ubuntu sshd[7942]: Failed password for matt from 192.168.0.102 port 35238 ssh2
Jul 14 18:25:52 ubuntu sshd[7942]: Failed password for matt from 192.168.0.102 port 35238 ssh2
Jul 14 18:25:52 ubuntu sshd[7942]: Connection closed by authenticating user matt 192.168.0.102 port 35238 [preauth]
Am I missing something due to the way that SSH is ran in a container on the HA? I’ve looked at various articles on SSH config and cannot seem to crack this by either changing the command, permissions on the files or with sshd config? Did you manage to solve @thermseekr?
Since posting this, I actually migrated all my SSH sensors over to either REST API’s, or MQTT calls to Node-Red (which in turn does the SSHing). So unfortunately I no longer have any active command_line platform components in my HA anymore to do any testing…
However, have you tried running the SSH command manually within the container as the HA user? It may wind up being a permissions issue or something as well… @thermseekr - the permissions on the file are one thing, but the permissions in the whole directory structure leading to the key may need to be set properly as well.
I run my HA inside a FreeBSD jail (NOT HASSIO), so that may have some bearing on what does and doesn’t work. I don’t know for sure.