ironsheep / RPi-Reporter-MQTT2HA-Daemon

Linux service to collect and transfer Raspberry Pi data via MQTT to Home Assistant (for RPi Monitoring)
GNU General Public License v3.0
459 stars 64 forks source link

Reboot and shutdown buttons not working from Home Assistant. #137

Closed mattlward closed 7 months ago

mattlward commented 7 months ago

Checklist:

Release with the issue: 1.8.5 Last working release (if known):

Hardware, Operating System, Python version: Pi 4, Raspbian GNU/Linux 10 (buster) armv7l, python3 3.7.3

Description of problem: Reboot and shutdown buttons from HA do not work log results here:

Feb 09 17:09:28 ts-pi python3[715]: We trust you have received the usual lecture from the local System
Feb 09 17:09:28 ts-pi python3[715]: Administrator. It usually boils down to these three things:
Feb 09 17:09:28 ts-pi python3[715]:     #1) Respect the privacy of others.
Feb 09 17:09:28 ts-pi python3[715]:     #2) Think before you type.
Feb 09 17:09:28 ts-pi python3[715]:     #3) With great power comes great responsibility.
Feb 09 17:09:28 ts-pi python3[715]: sudo: no tty present and no askpass program specified
Feb 09 17:09:28 ts-pi sudo[996]: pam_unix(sudo:auth): conversation failed
Feb 09 17:09:28 ts-pi sudo[996]: pam_unix(sudo:auth): auth could not identify password for [daemon]
Feb 09 17:09:28 ts-pi sudo[996]:   daemon : user NOT in sudoers ; TTY=unknown ; PWD=/opt/RPi-Reporter-MQTT2HA-Daemon ; USER=root ; COMMAND=/sbin/shutdown -r now reboot rqst via MQTT

Run our report script 'genBugInfo' on your failing device and include the output here:

mattw@ts-pi:/opt/RPi-Reporter-MQTT2HA-Daemon $ more genBugInfo-240209-173041.lst

SCRIPT genBugInfo v1.1 run 24/02/09-17:30:41

----------------------------------------------------------------------

/bin/cat /etc/apt/sources.list | /bin/egrep -v '#'

deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi


/bin/cat /etc/apt/sources.list | /bin/egrep -v '#' | /usr/bin/awk '{ print $3 }' | /bin/grep . | /usr/bin/sort -u | head -1

buster


/bin/uname -r

5.10.103-v7l+


/bin/hostname -f

ts-pi.home


/usr/bin/uptime

17:30:41 up 26 min, 2 users, load average: 0.15, 0.11, 0.09


/sbin/ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.21 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::248d:2b26:5dfe:cd3b prefixlen 64 scopeid 0x20 inet6 2601:240:8301:1460:8dbe:5a1:2482:7af prefixlen 64 scopeid 0x0 ether dc:a6:32:87:f7:4e txqueuelen 1000 (Ethernet) RX packets 13859 bytes 1899355 (1.8 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 3601 bytes 526006 (513.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 159 bytes 8905 (8.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 159 bytes 8905 (8.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether dc:a6:32:87:f7:4f txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


/sbin/ifconfig | /bin/egrep 'Link|flags|inet|ether' | /bin/egrep -v -i 'lo:|loopback|inet6|\:\:1|127.0.0.1'

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.21 netmask 255.255.255.0 broadcast 192.168.1.255 ether dc:a6:32:87:f7:4e txqueuelen 1000 (Ethernet) wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether dc:a6:32:87:f7:4f txqueuelen 1000 (Ethernet)


/sbin/route

Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default pfsense.home 0.0.0.0 UG 202 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0


/bin/ls -l /var/log/dpkg.log /var/log/dpkg.log.1 2>/dev/null

-rw-r--r-- 1 root root 135643 Feb 9 16:37 /var/log/dpkg.log -rw-r--r-- 1 root root 84206 Apr 13 2023 /var/log/dpkg.log.1


/bin/grep 'status installed' /var/log/dpkg.log /var/log/dpkg.log.1 2>/dev/null | sort | tail -1

/var/log/dpkg.log:2024-02-09 16:37:16 status installed python3-unidecode:all 1.0.23-1


/bin/df -m

Filesystem 1M-blocks Used Available Use% Mounted on /dev/root 234470 4168 220729 2% / devtmpfs 1764 0 1764 0% /dev tmpfs 1925 0 1925 0% /dev/shm tmpfs 1925 10 1916 1% /run tmpfs 5 1 5 1% /run/lock tmpfs 1925 0 1925 0% /sys/fs/cgroup /dev/sda1 253 49 204 20% /boot tmpfs 385 0 385 0% /run/user/109 tmpfs 385 1 385 1% /run/user/1004


/bin/df -m | /usr/bin/tail -n +2 | /bin/egrep -v 'tmpfs|boot'

/dev/root 234470 4168 220729 2% /


ls -l /opt/vc/bin/vcgencmd /usr/bin/vcgencmd

-rwxr-xr-x 1 root root 16452 May 9 2023 /opt/vc/bin/vcgencmd lrwxrwxrwx 1 root root 20 May 9 2023 /usr/bin/vcgencmd -> /opt/vc/bin/vcgencmd


Python errors shown in the logs (if applicable):

Additional information:

ironsheep commented 7 months ago

Take a look at this section https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon/blob/master/RMTECTRL.md#s3-enabling-the-daemon-to-run-external-commands

See if following those steps helps.

Let me know.

mattlward commented 7 months ago

Got it working... thanks!