emonPi hangs and stops logging

Thank you Paul and Brian - I will get back to you with more info when I have it. Jon.

1 Like

I suffer from this “stops logging” problem on several occasions over the last year since I had my emonpi. It is frustrating to say the least, and from reading this community it appears to be a common problem that needs addressing centrally as surely the issue lies in the core code?

Indeed. And the more users that provide detailed info and logs, the better chance there is to discover the cause(s),

Many issues will manifest themselves as “stops logging” as have several previous issues that have been successfully fixed in the past.

If you can provide info and logs we can determine if the issue is the same and work towards a fix, either way. At the moment, even if we fixed Jon’s issue there are no guarantee’s it would fix your issue, or vice versa.

So please help us to help you by providing logs and info for your set up.

Annoyingly I have not had the issue since Feb 23rd, it is behaving perfectly at the moment (I think it must know we are talking about it). It can go months with no problem, but sometimes only hours.

I think my problem is related to the temperature sensors being disturbed / moved / touched, maybe the RJ45 to terminal block breakout has a poor connection somewhere. If it does not “stop logging” on its own soon I’ll go give it a jiggle.

I second that. I have a “shop” DS18B20 with an RJ45 on the end of a flat white cable, and at least one of the IDC connections in the plug was bad. I crimped them up again, and filled the cable entry with hot glue to act as a strain relief.

Can a bad connection to a temp sensor really cause an emonPi to “stop logging” ? I thought the FW was written to simply use a “30x” if no value was read from a temp sensor.

It should do, unless there’s an exception handler that isn’t working as it should; but a wiring fault still needs to be rectified.

Did you mean “shouldn’t do” ?

I don’t disagree that the temp sensor issue needs resolving, but I wanted to avoid it being a red-herring to this thread about the “emonPi hangs and stops posting”

however, I just took a quick peek at the code and found the emonPi doesn’t follow the “30x” convention.

https://github.com/openenergymonitor/emonpi/blob/master/firmware/src/src.ino#L315-L319

https://github.com/openenergymonitor/emonpi/blob/master/firmware/src/temperature.ino

and this line looks suspicious

https://github.com/openenergymonitor/emonpi/blob/master/firmware/src/temperature.ino#L26

what if it isn’t within -55 to 125 degC? Can the function return?

[edit] I know all actively warned faults will result in 85degC which is inside the -55 to 125, but I was wondering what if there is no response? How would that be handled?

That’s what it should do.

Yes. It does return zero, but according to K&R, the return value is undefined. So essentially, you cannot trust it to return anything or anything sensible, and what it does is probably compiler-dependent. It’s certainly bad practice to not define a return value.

[Unless of course it’s defined as void]

My emonPi also stops sporadically. Sampling at 5s and runs maybe a month. Latest emonPi firmware. This time I just rebooted it. It’s not obvious where to be looking.

Hi John,

I am still waiting for mine to stop logging again! That said I have been testing my electrics recently so the power has been going on and off and on and off so it may have done it and i did not notice.

If you look at reply # 6 from pb66 Paul he says what to do when it happens.

Jon.

this is #6:

See the EmonPi became "inactive" over 12 months ago, EmonCMS is still working fine?! thread as maybe linked.

[This and the following 6 posts were moved here from a separate thread titled “EmonPi became “inactive” over 12 months ago, EmonCMS is still working fine?!” - pb66]

OK, this is very odd - looking at my EmonPi locally at http://192.168.0.102/emoncms/ (not something I do often, if ever, but i have been having some issues) and it appears that it has logged nothing whatsoever since 2nd March 2017 and all nodes and feeds have “inactive” since then. Looking at emoncms and no stop occurred at that time and it is still working (mostly) today.
Is it possible there are two versions of the software running on the same Raspberry Pi and I am talking to the wrong one? What on earth is going on?

Hello Jon, do you mean that you have a full data history on emoncms.org?

Yes, EmonCMS (the one on the internet) is fine and up to date, emonpi (the one in my house) is showing no data for just over 12-months.

At 9.09pm on March 2nd 2017 my power was 2425W both locally and at emoncms.org - one minute later and locally it is zero (and has been ever since) and is still at about 2.4kw at emoncms.org and continues to log normally up until the present day.

It was 12-months ago - it is quite possible I did something to it.

@stabuck - How many setups do you have?

I ask because I’m confused by this new thread where you suggest you may not have checked your emonPi for over a year, since you have another thread that you started 22days ago by saying your emonpi regularly stops posting data fro hours or days, sometimes weeks. Are these the same systems?

If they are, the fact your emoncms.org account continues to collect data is a massive piece of information that would help that discussion. It rules out the emonpi board hanging, emonhub crashing and points the finger squarely at a likely MQTT issue, most likely the mqtt_input service.

Can you please confirm your setup and if these 2 threads are linked. I think we should merge this new discussion with that other thread unless you are talking about a completely independent system.

I have the one emonPi, this is the same emonPi. I don’t know if the two topics are related, it is quite possible as I can only see 4 or 5 incidents of “stops logging” between May 2015 and March 2017. I noticed this thread’s problem after it stopped logging and checked the EmonPi as you suggested in the other thread and found it would not respond to me.
Logging in and it does not like the command “sudo systemctl status emonhub”, “sudo: systemctl: command not found”

emonhoub.log

2018-03-20 05:54:28,434 INFO     MQTT       Could not connect...
2018-03-20 05:54:30,876 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 16 33 226 40 208 28 160 9 192 15 96 41 58 36 17 2 131 13 128 128 70 (-110)
2018-03-20 05:54:31,810 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 4 1 64 32 225 32 116 20 167 196 2 1 104 17 15 0 104 28 144 33 126 (-111)
2018-03-20 05:54:33,345 DEBUG    RFM2Pi     110614 NEW FRAME : OK 5 226 19 0 0 226 19 61 95 4 0 194 0 81 0 0 0 0 0 0 0 50 0 0 0 (-0)
2018-03-20 05:54:33,348 DEBUG    RFM2Pi     110614 Timestamp : 1521525273.35
2018-03-20 05:54:33,349 DEBUG    RFM2Pi     110614 From Node : 5
2018-03-20 05:54:33,349 DEBUG    RFM2Pi     110614    Values : [5090, 0, 5090, 243.81, 0.4, 19.400000000000002, 8.1, 0, 0, 0, 50]
2018-03-20 05:54:33,350 DEBUG    RFM2Pi     110614 Sent to channel(start)' : ToEmonCMS
2018-03-20 05:54:33,350 DEBUG    RFM2Pi     110614 Sent to channel(end)' : ToEmonCMS
2018-03-20 05:54:33,455 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 17 38 9 37 139 3 32 34 10 136 96 139 168 0 5 213 255 0 26 66 97 (-111)
2018-03-20 05:54:33,651 INFO     MQTT       Connecting to MQTT Server
2018-03-20 05:54:33,652 INFO     MQTT       Could not connect...
2018-03-20 05:54:34,466 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 18 29 124 232 160 62 60 145 176 67 129 12 132 46 127 173 41 49 128 32 146 (-106)
2018-03-20 05:54:35,074 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 9 150 73 0 35 56 1 12 194 128 34 0 125 2 127 173 41 49 128 32 146 (-111)
2018-03-20 05:54:35,483 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 29 9 136 172 4 248 64 115 100 66 188 1 24 168 80 113 155 178 132 140 173 (-112)
2018-03-20 05:54:36,894 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 6 50 148 244 0 9 49 200 1 74 0 2 93 29 25 0 160 43 184 48 0 (-111)
2018-03-20 05:54:37,394 DEBUG    emoncmsorg Buffer size: 6
2018-03-20 05:54:37,396 INFO     emoncmsorg sending: http://emoncms.org/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1521525248.273787,5,5072,0,5072,243.49,0.30000000000000004,19.400000000000002,8.1,0,0,0,50],[1521525253.335623,5,5086,0,5086,243.73000000000002,0.30000000000000004,19.400000000000002,8.1,0,0,0,50],[1521525258.326553,5,5100,0,5100,244.04,0.30000000000000004,19.400000000000002,8.1,0,0,0,50],[1521525263.360134,5,5072,0,5072,243.42000000000002,0.30000000000000004,19.400000000000002,8.1,0,0,0,50],[1521525268.281153,5,5072,0,5072,243.42000000000002,0.4,19.400000000000002,8.1,0,0,0,50],[1521525273.34531,5,5090,0,5090,243.81,0.4,19.400000000000002,8.1,0,0,0,50]]&sentat=1521525277
2018-03-20 05:54:37,793 DEBUG    emoncmsorg acknowledged receipt with 'ok' from http://emoncms.org
2018-03-20 05:54:38,313 DEBUG    RFM2Pi     110615 NEW FRAME : OK 5 214 19 0 0 214 19 37 95 4 0 195 0 81 0 0 0 0 0 0 0 50 0 0 0 (-0)
2018-03-20 05:54:38,317 DEBUG    RFM2Pi     110615 Timestamp : 1521525278.31
2018-03-20 05:54:38,318 DEBUG    RFM2Pi     110615 From Node : 5
2018-03-20 05:54:38,319 DEBUG    RFM2Pi     110615    Values : [5078, 0, 5078, 243.57, 0.4, 19.5, 8.1, 0, 0, 0, 50]
2018-03-20 05:54:38,320 DEBUG    RFM2Pi     110615 Sent to channel(start)' : ToEmonCMS
2018-03-20 05:54:38,320 DEBUG    RFM2Pi     110615 Sent to channel(end)' : ToEmonCMS
2018-03-20 05:54:38,428 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 12 216 168 203 3 59 77 223 131 240 193 27 255 162 38 163 72 28 175 9 240 (-111)
2018-03-20 05:54:38,470 INFO     MQTT       Connecting to MQTT Server
2018-03-20 05:54:38,471 INFO     MQTT       Could not connect...
2018-03-20 05:54:39,338 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 0 25 128 40 3 59 77 223 131 240 193 27 255 162 38 163 72 28 175 9 240 (-110)
2018-03-20 05:54:40,449 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 17 65 134 0 3 59 77 223 131 240 193 27 255 162 38 163 72 28 175 9 240 (-111)