Community
OpenEnergyMonitor

Community

How to emonhub full reset the emonpi?


(Lycle Park) #1

when I restart emonHUB only, then emonpi cant receive data from emonTX.

handleInput69() start
[emonPi.29.00] E i5 g60 @ 433 MHz q0 USA 0
handleInput69() end
handleInput69() start
handleInput69() start
 E i5 g60 @ 433 MHz q0 USA 0
handleInput69() end
OK 5 0 0 0 0 0 0 0 0 233 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (-0)
OK 5 0 0 0 0 0 0 0 0 234 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (-0)

but when I restart(power off then on ) emonpi, thenemonhub can receive data from emontx.

emonPi V2.90
OpenEnergyMonitor.org
startup...
 RF_freq 1 nodeID 5 networkGroup 60 RF_PowerLevel 30 RF_freq: bandToRFM69() band =1
43
43
bandToRFM69() band =1
43
LCD found i2c 0x3F
CT 1 Cal: 78.87
CT 2 Cal: 78.87
VRMS AC ~1.78V
AC NOT detected - Apparent Power calc enabled
Assuming VRMS: 220V
no CT detected
Detect 1 DS18B20
RFM69CW Init:
Node 5 Freq 433Mhz Network 60

Available commands:
  <nn> i     - set node IDs (standard node ids are 1..30)
  <n> b      - set MHz band (4 = 433, 8 = 868, 9 = 915)
  <nnn> g    - set network group (RFM12 only allows 212, 0 = any)
  <n> c      - set collect mode (advanced, normally 0)
  ...,<nn> a - send data packet to node <nn>, request ack
  ...,<nn> s - send data packet to node <nn>, no ack
  ...,<n> p  - Set AC Adapter Vcal 1p = UK, 2p = USA
  v          - Show firmware version
  <n> q      - set quiet mode (1 = don't report bad packets)
OK 5 0 0 0 0 0 0 0 0 234 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (-0)
OK 9 241 255 0 0 0 0 0 0 96 89 184 11 184 11 184 11 184 11 184 11 184 11 1 0 0 0 (-68)
OK 5 0 0 0 0 0 0 0 0 234 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (-0)

so are there any way for reset emonpi from remote ?


Unreliable content with RFM69C and emonBase
(Paul) #2

Initially I didn’t recognize some of the serial output such as

handleInput69() start

I have since found and older post by you and suspect you are using LowPowerLabs rather than JeeLib. As far as I’m aware this isn’t an issue on JeeLib based emonPi’s so I would suggest looking closer at the code and Lib. But if you cannot get it sorted, or prefer to have a manual reset option (IMO the emonpi image should have one) all you need to do is pulse the reset line of the emonpi addon board (used for programming) to 0v via the Pi’s GPIO pin 7, here’s a little script I use

#!/usr/bin/env python

import RPi.GPIO as GPIO
import time

pin = 7 # P1-7 (BCM pin 4 or WiringPi pin 7)

try:
	GPIO.setmode(GPIO.BOARD)
	GPIO.setup(pin, GPIO.OUT)
	GPIO.output(pin, GPIO.HIGH)
	time.sleep(0.12)
	GPIO.output(pin, GPIO.LOW)
	GPIO.cleanup()
except Exception as e:
	print(e)

can also be downloaded and installed with

#rpi-rw       # not required on latest emonpi image
sudo wget https://openenergymonitor.org/forum-archive/sites/default/files/reset_rfm2pi.txt -O /usr/bin/reset_rfm2pi
sudo chmod +x /usr/bin/reset_rfm2pi

after which just issuing the command reset_rfm2pi from the commandline (any cwd) will reset the emonpi board.

It would be good to see this triggered from a button in emoncms to save you ssh’ing in and/or so that users could “find” a newly attached AC or CT sensors etc.


Problems recognising a temp sensor on emonPi
(Robert Wall) #3

Seconded.


(Paul) #4

I raised an issue for this feature request


(Robert Wall) #5

I should have added “The FAQ has a note about this, because many users are completely bewildered when the front end doesn’t reset when they reboot the Pi.”

If we ever go to the front end accumulating kWh, then there’s an argument to not automatically restart the front end. Until then, the expectation seems to be that the front end resets when the Pi is rebooted. But it doesn’t.


(Paul) #6

I agree, IMO there is rarely a good argument for rebooting, resetting or restarting things. In the case of the emonpi, the discovery portion of the startup() could be wrapped in a function and triggered from a serial command (as well as called during startup), but that would demand some work in emonhub as it has sole access to the emonpi serial port under normal running.

But this reset would work as a stop gap and also for debugging issues and special circumstances like this thread and/or when rfm2pi/emonpi “lock ups” occur.


(Lycle Park) #7

Thanks. That was I wanted.
I will add the script.