Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Inputs are not being updated after a Reboot

Hi All,

Houston we have a problem. :o(

I rebooted the EmonPi and I’m getting no inputs on any of the inputs?

I haven’t change anything knowingly in config as you have mentioned MQTT server would be upset. The only thing is that the board has a small red LED that use to flash slowly and it doesn’t seem to be doing that any longer.

All of the services seem to be ticking over except the emonPiLCD: Activating Start-pre

EMONCMS Stable 10.4

Hope you can point me in the right direction. :o)

Thanks

Additional Info: from DEBUG : EmonHub

2021-06-08 17:28:08,969 DEBUG    MainThread Signal 15 received.
2021-06-08 17:28:09,175 INFO     MainThread Exiting hub...
2021-06-08 17:28:09,426 INFO     MainThread Exit completed
2021-06-08 17:38:14,391 INFO     MainThread EmonHub emonHub (emon-pi variant) v2.2.6
2021-06-08 17:38:14,424 INFO     MainThread Opening hub...
2021-06-08 17:38:14,427 INFO     MainThread Logging level set to DEBUG
2021-06-08 17:38:14,429 INFO     MainThread Creating EmonHubJeeInterfacer 'RFM2Pi'
2021-06-08 17:38:14,478 DEBUG    MainThread Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
**2021-06-08 17:38:16,483 WARNING  MainThread Device communication error - check settings**
2021-06-08 17:38:16,486 INFO     MainThread Setting RFM2Pi baseid: 5 (5i)
2021-06-08 17:38:17,489 INFO     MainThread Setting RFM2Pi frequency: 433 (4b)
2021-06-08 17:38:18,492 INFO     MainThread Setting RFM2Pi group: 210 (210g)
2021-06-08 17:38:19,496 INFO     MainThread Setting RFM2Pi quiet: 1 (1q)
2021-06-08 17:38:20,499 INFO     MainThread Setting RFM2Pi calibration: 230V (1p)
2021-06-08 17:38:21,503 DEBUG    MainThread Setting RFM2Pi pubchannels: ['ToEmonCMS']
2021-06-08 17:38:21,505 DEBUG    MainThread Setting RFM2Pi subchannels: ['ToRFM12']
2021-06-08 17:38:21,515 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT'
2021-06-08 17:38:21,522 DEBUG    MainThread Setting MQTT pubchannels: ['ToRFM12']
2021-06-08 17:38:21,536 DEBUG    MainThread Setting MQTT subchannels: ['ToEmonCMS']
2021-06-08 17:38:21,537 INFO     MainThread Setting MQTT node_format_enable: 1
2021-06-08 17:38:21,539 INFO     MainThread Setting MQTT nodevar_format_enable: 1
2021-06-08 17:38:21,541 INFO     MainThread Setting MQTT nodevar_format_basetopic: emon/
2021-06-08 17:38:21,543 INFO     MainThread Setting MQTT node_JSON_enable: 0
2021-06-08 17:38:21,556 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg'
2021-06-08 17:38:21,561 DEBUG    MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2021-06-08 17:38:21,563 DEBUG    MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2021-06-08 17:38:21,575 WARNING  MainThread Setting emoncmsorg apikey: obscured
2021-06-08 17:38:21,577 INFO     MainThread Setting emoncmsorg url: https://emoncms.org
2021-06-08 17:38:21,578 INFO     MainThread Setting emoncmsorg senddata: 1
2021-06-08 17:38:21,580 INFO     MainThread Setting emoncmsorg sendstatus: 1
## EmonHub

Looks like the serial port isn’t happy? :o( Ho Hum.

Formatted text - Moderator

Okay, I think I finally got to the bottom of this.

It seems that the /boot/config.txt was set to “enable_uart=0” which is why the first issue of ‘ttyAMA0’ no such file was reported.

Change this to read “enable_uart=1” and a reboot of the Raspberry Pi Zero got the /dev folder with ttyAMA0 inside off it. Cross my heart etc etc… I didn’t touch this file. So, how it became changed I do not know? I then using the Admin Page uploaded the emonPI to ttyAMA0 as it was now listed. It took a couple attempts as listed here;

Starting update via service-runner-update.sh (v3.0) >
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G  2.9G   11G  21% /
devtmpfs        183M     0  183M   0% /dev
tmpfs           216M     0  216M   0% /dev/shm
tmpfs           216M  3.2M  212M   2% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           216M     0  216M   0% /sys/fs/cgroup
/dev/mmcblk0p1  253M   48M  205M  19% /boot
log2ram          50M  4.6M   46M  10% /var/log
tmpfs            44M     0   44M   0% /run/user/1000
tmpfs            44M     0   44M   0% /run/user/118
- emonSD version: emonSD-02Oct19
- supported images: emonSD-08May21 emonSD-24Jul20 emonSD-02Oct19 emonSD-17Oct19
- emonSD base image check passed...continue update
git pull /opt/openenergymonitor/EmonScripts
  master
* stable
On branch stable
Your branch is up to date with 'origin/stable'.

nothing to commit, working tree clean
Already up to date.
-------------------------------------------------------------
Main Update Script
-------------------------------------------------------------
Date: Wed 9 Jun 17:16:47 BST 2021
EUID: 1000
openenergymonitor_dir: /opt/openenergymonitor
type: firmware
firmware: emonpi
Reading package lists...
Building dependency tree...
Reading state information...
python3-pip is already the newest version (18.1-5+rpt1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: redis in /usr/local/lib/python3.7/dist-packages (3.5.3)
Hardware detected: rfm2pi
-------------------------------------------------------------
EmonPi Firmware Update (Discrete Sampling)
-------------------------------------------------------------
Start ATmega328 serial upload using avrdude with latest.hex
Attempt: 1
avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/opt/openenergymonitor/emonpi/firmware/compiled/latest.hex
Note: progress written to logfile /var/log/emoncms/firmware.log

avrdude-original: Using autoreset DTR on GPIO Pin 7
strace: |autoreset: Broken pipe

ERROR: Not in sync
Attempt: 2
avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/opt/openenergymonitor/emonpi/firmware/compiled/latest.hex
Note: progress written to logfile /var/log/emoncms/firmware.log

avrdude-original: Using autoreset DTR on GPIO Pin 7
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe


avrdude-original: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude-original: Device signature = 0x1e950f (probably m328p)
avrdude-original: NOTE: "flash" memory has been specified, an erase cycle will be performed
                  To disable this feature, specify the -D option.
avrdude-original: erasing chip
avrdude-original: reading input file "/opt/openenergymonitor/emonpi/firmware/compiled/latest.hex"
avrdude-original: input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex auto detected as Intel Hex
avrdude-original: writing flash (18526 bytes):

Writing | ################################################## | 100% 2.72s

avrdude-original: 18526 bytes of flash written
avrdude-original: verifying flash memory against /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex:
avrdude-original: load data flash data from input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex:
avrdude-original: input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex auto detected as Intel Hex
avrdude-original: input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex contains 18526 bytes
avrdude-original: reading on-chip flash data:

Reading | ################################################## | 100% 2.84s

avrdude-original: verifying ...
avrdude-original: 18526 bytes of flash verified

avrdude-original done.  Thank you.

SUCCESS: flash verifed

It now reporting the inputs as it should. :o)

Hope this helps other people. As it had me pulling what hair I have left out. Seems something nasty happen to the Firmware as well as the Uart change in “config.txt”

Can anyone explain why the Firmware is upgraded at 115200 bits when the [Emonhub] config it is listed at 38400 bits/s? Just interested.

Time for a Beer me thinks.

Cheers.

[For future reference, when posting code or output, please put 3 ‘backticks’ (normally found at the top left of the keyboard) on a line of their own *before the code, and 3 more backticks also on a line of their own after the code:

```
code
```

If it is something like php you can add a language identifier after the first 3 backticks: ```php or even ```text if you don’t want any language markup applied.

Thanks - Moderator (RW)]

Yes, The 115200 speed is that required by the bootloader when updating the sketch. The 38400 speed is that at which the sketch sends or receives serial data - and that’s under software control within the sketch itself.

Thanks Robert for the explanation.

Cheers