Feature Request: Display time of last undervoltage/overheat event on icon hover

I feel that it would be quite useful, for troubleshooting purposes, if the icon that displays the undervoltage / overheated state in the top bar of OctoPrint would also show some indicator of when the event happened in the hover-over display (provided the event is not ongoing).

I realize that this information can be found in the octoprint.log file, but having the data available at a glace would be a great QoL feature, which could help people with intermittent issues determine the cause of those issues.

I have some apprentice-level coding skills, but wouldn't really know where to start insofar as coding a plugin is concerned. Perhaps one already exists, but I've been unable to find it. It seems that perhaps a modification to the Pi Support Plugin could add this info without much fuss, but I'm certainly speculating, there.

Please forgive me if this has already been covered! I tried searching the forum but didn't come across anything that seemed right.

Thank you!

OctoPrint isn't logging the undervoltage/overtemp event itself, it's asking the Raspberry Pi via vcgencmd get_throttled if it has happened in the past or is currently happening and reacting to that information.
The information you see in the octoprint.log is when OctoPrint checked this state (so the timestamp corresponds to when OctoPrint ran vcgencmd in the background not when the event happened).

From what I understand, the Raspberry Pi also doesn't log the time when one of those events occur internally or in a way that can be retrieved from a command like the state.

From a quick search, it looks like messages may have been added to the kernel log for when these events occur, but it's not clear if that's enabled by default or not. If you are having issues, I'd check there first.

edit: that means there may be a message in either dmesg or /var/log/kern.log.

In fact both places do show the undervoltage event. Which approach shows better info depends on how often it happens and how often the raspi reboots. On a system with few such events and months of uptime dmesg will probably reach further down in time as kern.log messages get rotated off after a while.

sudo dmesg -T|grep volt

or:

cd /var/log
sudo gunzip kern.log.*.gz
cat kern.log*|grep volt

on one of my systems result in

[Sat Sep  4 18:17:21 2021] Under-voltage detected! (0x00050005)
[Sat Sep  4 18:17:35 2021] Under-voltage detected! (0x00050005)
[Wed Sep 29 15:15:01 2021] Under-voltage detected! (0x00050005)

or

Sep 29 15:14:32 moa kernel: [2356743.107269] Under-voltage detected! (0x00050005)

1 Like

Dmesg rotates as well

sure does and how far down into the past the buffer reaches obviously depends on how many kernel events happen. Then again, if undervoltage occurrs so seldom that log rotation makes it hard to find then the problem isn't all that serious in the first place.