1

I have a number of pending updates on my raspberry pi. Until I take a day to perform all those updates, I'm sitting at pilight version v8.1.5. Updating may potentially solve my ultimate problem, but until then, I'm dealing with about a once daily issue where pilight just silently stops working.

By "silently stops working", I mean, I issue any pilight-send command and no signal is sent and no error is printed or logged (that I can find). Going by the command line, you wouldn't think there's any issue at all except for the fact that the device being controlled doesn't change states. Whenever this happens, it's usually hours before I find out there's an issue. My automations don't work. I can't turn on/off any devices plugged into my 433Mhz outlets.

Restarting pilight with:

sudo service pilight restart

Always resolves the issue. Things start working again. It's such a frequent occurrence, I set up a "button" in the home app to restart pilight.

When there is an issue, the restart takes 20s-1m. When there is not an issue, the restart cycles in a second or so.

I tried setting up a nightly restart of pilight in order to try and head-off the issue, but it still seems to happen roughly once a day, sometimes twice, and sometimes it will go days without any issue.

Side note: A couple years ago, I disabled pilight's ability to receive because, due to background noise, it would cause my pi to run hot. Disabling pilight's ability to receive signals 100% resolved that issue.

What I would like is for some way to immediately catch when pilight stops working so that I can automatically restart it.

I realize that it would be better to solve the underlying problem, but until I'm running the latest version of pilight, it seems like working on that would be a waste. For now, it would just be nice to detect the problem faster.

13
  • 1
    Sorry about your plight with plight ! Until you fix either pilight or one of the drivers/plugins/modules that pilight uses, you're probably stuck. Perhaps you could also try rebooting/resetting the entire pi nightly, instead of just the service. Commented Jan 9 at 16:09
  • Try issuing a command, then immediately checking to see if the command has executed. If so, it's functioning, if not, restart pilight. How you'd go about doing so is an exercise left to the reader (mostly because I haven't a clue what pilight is. ;)
    – FreeMan
    Commented Jan 10 at 17:44
  • @FreeMan, As mentioned in the post, the command executes without any indication of a problem. I also indicated that I wanted to "detect" the problem, I.e. automatically... so that when I try to turn on/off one of the outlets, it's more likely to always work.
    – hepcat72
    Commented Jan 10 at 18:27
  • 1
    @kalyanswaroop. Thanks. I fear that's likely true. I was hoping someone knew some clever way to detect the problem. I would do a reboot, but I've let versions stagnate for too long and node-red no longer works with pm2. Might be a misconfig. I have to manually start it anytime I reboot these days. I have a lot of put off maintenance. Besides, based on the pattern, I don't think the intermittent failure is based on uptime.
    – hepcat72
    Commented Jan 10 at 18:32
  • I got that part. I was thinking along the lines of: turn off living room light, delay 2 seconds, if living room light is on, send notification. Don't know if that can be done in pilight, hence comment, not answer.
    – FreeMan
    Commented Jan 10 at 18:33

1 Answer 1

0

The last time this happened, I decided to try and catch what was happening by writing a flow that, whenever I manually restart pilight, it would first create a backup of the pilight logs (/var/log/pilight.log (in addition to /var/log/pilight.err)).

I did this because whenever I'd looked in the logs in the past, it never had any errors in it... but I realized that pilight cycles the log rather aggressively - at least once a day. So, whenever this had happened in the past, more than 2 days usually passes before I sit down on the weekend to figure out what's going on - so any error that would have been there (in the current or previous day's log) was long gone.

The issue occurred twice since I started saving the logs upon pilight restart... and there was a repeating error about some invalid object. The timing of the error in the log coincided with the time between last successful and first failure pilight command attempt:

---- LUA STACKTRACE ----
 error: /usr/local/lib/pilight/hardware/433gpio.lua:32: table object required but unknown object passed
 module: /home/pilight/source/daemon-dev/libs/pilight/lua_c/async/timer.c #413

 [#000] [C]:-1 
 [#001] [C]:-1  (field unshift)
 [#002] /usr/local/lib/pilight/hardware/433gpio.lua:32 

 number of element on stack: 3

 1: function
 2: function
 3: function

---- LUA STACKTRACE ----

I'm sure that this is probably an error that has since been fixed in pilight, but given the massive upgrade hurdle of my outdated rPi, the path of least resistance was to simply watch for the error, and when it is encountered, restart pilight:

enter image description here

I had considered a suggestion in the comments about restarting pilight every time, however, I eventually decided it was problematic, because I have Home app "scenes" that issue multiple pilight-send commands in a fraction of a second. If I restarted before every command, commands would fail, mainly because the commands are issued via homebridge, not node-RED. (Granted, if they were being issued from node-RED, I could control the order of execution, but it wasn't enough of a priority for me to take the time to do the transfer.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.