Hello,
I’m running HA on my RPi3 for days now and I realised the speedtest component does not work well for me (getting pings over 1000 on my Pi - so it’s useless).
I started to play around with command line ping and wrote a script I want to add instead of speedtest ping.
The script outputs the ms without decimal. Script isn’t best solution yet, but I don’t usually use bash - sorry.
It works if I run it as homeassistant user on my Pi, but in my webinterface it stays emty.
ping.sh
#!/bin/bash
pingresult=$(ping -c 4 8.8.8.8)
PING=$(echo "$pingresult" | grep min/avg/max/mdev | cut -d " " -f 4 | cut -d "." -f 1)
echo $PING
sensor.yaml:
- platform: command_line
name: PingPi
command: "/home/homeassistant/scripts/speedtest/ping.sh"
unit_of_measurement: "ms"
scan_interval: 300
I don’t unterstand why it works in ssh but not in HA
I played with output to tmp file.
HA created it but the file was empty. Running it as HA user on pi filled the file. - Rights were the same.
Do you have some ideas for me? Thanks!