@pblgomez made me think about the whole environment variable setup a bit more and after a few guesses and test scripts I found that the virtual environment within the systemd service was missing a few paths.
So here is the fix, edit your systemd service and add :/usr/bin to the line starting with Environment=PATH="$VIRTUAL_ENV/bin:.
Works flawless for me too! This right here is why Home Assistant is #1. This community truly kicks ass!
Just for anyone who is very new to linux in general like myself the path to the systemd file for me on Ubuntu Server 16.10 with the VIRTUALENV Install is
Would be great if you typed, where to aply this fix. I am facing the same issue with the switch tracking myself and from what you typed I can’t figure out what to do at all. I have Home Assistant OS and the srv directory is empty for some reason.
just following up on this solution, does this work for the latest HA? I seem to have the same problem and running the “ps -p 1 -o comm=” fails from within HA to return any reference to systemd.
Do I need to SSH into the RPI that HA is running on it and configure from there ?
The above was run from the terminal app from within HA.
For those of you who are on Windows and can’t get the switch state after adding the “host” parameter in your config, make sure you can ping your pc from another pc in the network. If you can’t, in Windows firewall advanced settings, enable inbound rule “File and Printer Sharing (Echo Request – ICMPv4 – In)”.
Only if someone need it with windows 11:
Go to “Control Pannel” → “System and Security” → “Windows Defender Firewall” → "Allow an app or feature through Windows Defender Firewall "
And there check “File and Printer Sharing” (There are 2 line similar. Check the first one. NOT the “…SMBDirect”).
If you use a Private network check only the first column (private) otherwise check the second column (public).
[You can check both but maybe it is better if you set your network in private and check only private]