Skip to content

Commit

Permalink
git push origin emon-piMerge branch 'alexandrecuer-emon-pi' into emon-pi
Browse files Browse the repository at this point in the history
  • Loading branch information
glynhudson committed Dec 10, 2018
2 parents 5501f1d + bd7b336 commit 96932ae
Show file tree
Hide file tree
Showing 6 changed files with 233 additions and 347 deletions.
162 changes: 4 additions & 158 deletions conf/interfacer_examples/modbus/modbusTCP.emonhub.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

[hub]
### loglevel must be one of DEBUG, INFO, WARNING, ERROR, and CRITICAL
loglevel = INFO
loglevel = DEBUG


### Uncomment this to also send to syslog
Expand All @@ -31,38 +31,15 @@ loglevel = INFO
modbus_IP = 192.168.1.10 # ip address of client to retrieve data from
modbus_port = 502 # Portclient listens on
[[[runtimesettings]]]
# list of names of items being retrieved
rName = Inverter_status,AC_power_watts,AC_LifetimekWh,DayWh,mppt1,mppt2,Vmppt1,Vmppt2,PhVphA,PhVphB,PhVphC
# List of starting registers for items listed above
register = 40118,40092,40102,502,40285,40305,40284,40304,40086,40088,40090
# List of # of registers used for each item
nReg = 1,2,2,4,1,1,1,1,2,2,2
# Data type for each item above
rType = uint16,float32,float32,uint64,uint16,uint16,uint16,uint16,float32,float32,float32
# nodeid used to match with node definition in nodes section below. Can be set to any integer value not previously used.
nodeId = 12
# Channel to publish data to should leave as ToEmonCMS
pubchannels = ToEmonCMS,
# time in seconds between checks, This is in addition to emonhub_interfacer.run() sleep time of .01
# use this value to set the frequency of data retrieval from modbus client
interval = 1

### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module
[[RFM2Pi]]
Type = EmonHubJeeInterfacer
[[[init_settings]]]
com_port = /dev/ttyAMA0
com_baud = 38400 # 9600 for old RFM12Pi
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
subchannels = ToRFM12,

group = 210
frequency = 433
baseid = 5 # emonPi / emonBase nodeID
quiet = true # Report incomplete RF packets (no implemented on emonPi)
calibration = 230V # (UK/EU: 230V, US: 110V)
# interval = 0 # Interval to transmit time to emonGLCD (seconds)
interval = 10

[[MQTT]]

Expand All @@ -74,31 +51,19 @@ loglevel = INFO
mqtt_passwd = emonpimqtt2016

[[[runtimesettings]]]
pubchannels = ToRFM12,
subchannels = ToEmonCMS,

# emonhub/rx/10/values format
# Use with emoncms Nodes module
node_format_enable = 1
node_format_enable = 0
node_format_basetopic = emonhub/

# emon/emontx/power1 format - use with Emoncms MQTT input
# https://github.com/openenergymonitor/emonhub/blob/emon-pi/conf/emonhub.conf
nodevar_format_enable = 1
nodevar_format_basetopic = emon/

[[emoncmsorg]]
Type = EmonHubEmoncmsHTTPInterfacer
[[[init_settings]]]
[[[runtimesettings]]]
pubchannels = ToRFM12,
subchannels = ToEmonCMS,
url = https://emoncms.org
apikey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
senddata = 1 # Enable sending data to Emoncms.org
sendstatus = 1 # Enable sending WAN IP to Emoncms.org MyIP > https://emoncms.org/myip/list
sendinterval= 30 # Bulk send interval to Emoncms.org in seconds


#######################################################################
####################### Nodes #######################
#######################################################################
Expand All @@ -107,125 +72,6 @@ loglevel = INFO

## See config user guide: http://github.com/openenergymonitor/emonhub/blob/master/configuration.md

[[5]]
nodename = emonpi
[[[rx]]]
names = power1,power2,power1pluspower2,vrms,t1,t2,t3,t4,t5,t6,pulsecount
datacodes = h, h, h, h, h, h, h, h, h, h, L
scales = 1,1,1,0.01,0.1,0.1,0.1,0.1,0.1,0.1,1
units = W,W,W,V,C,C,C,C,C,C,p

[[6]]
nodename = emontxshield
[[[rx]]]
names = power1, power2, power3, power4, vrms
datacode = h
scales = 1,1,1,1,0.01
units =W,W,W,W,V

[[7]]
nodename = emontx4
[[[rx]]]
names = power1, power2, power3, power4, vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse
datacodes = h,h,h,h,h,h,h,h,h,h,h,L
scales = 1,1,1,1,0.01,0.1,0.1, 0.1,0.1,0.1,0.1,1
units =W,W,W,W,V,C,C,C,C,C,C,p

[[8]]
nodename = emontx3
[[[rx]]]
names = power1, power2, power3, power4, vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse
datacodes = h,h,h,h,h,h,h,h,h,h,h,L
scales = 1,1,1,1,0.01,0.1,0.1, 0.1,0.1,0.1,0.1,1
units =W,W,W,W,V,C,C,C,C,C,C,p

[[9]]
nodename = emontx2
[[[rx]]]
names = power1, power2, power3, power4, vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse
datacode = h
scales = 1,1,1,1,0.01,0.1,0.1, 0.1,0.1,0.1,0.1,1
units =W,W,W,W,V,C,C,C,C,C,C,p

[[10]]
nodename = emontx1
[[[rx]]]
names = power1, power2, power3, power4, vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse
datacode = h
scales = 1,1,1,1,0.01,0.1,0.1, 0.1,0.1,0.1,0.1,1
units =W,W,W,W,V,C,C,C,C,C,C,p

[[19]]
nodename = emonth1
[[[rx]]]
names = temperature, external temperature, humidity, battery
datacode = h
scales = 0.1,0.1,0.1,0.1
units = C,C,%,V

[[20]]
nodename = emonth2
[[[rx]]]
names = temperature, external temperature, humidity, battery
datacode = h
scales = 0.1,0.1,0.1,0.1
units = C,C,%,V

[[21]]
nodename = emonth3
[[[rx]]]
names = temperature, external temperature, humidity, battery
datacode = h
scales = 0.1,0.1,0.1,0.1
units = C,C,%,V

[[22]]
nodename = emonth4
[[[rx]]]
names = temperature, external temperature, humidity, battery
datacode = h
scales = 0.1,0.1,0.1,0.1
units = C,C,%,V
[[23]]
nodename = emonth5
[[[rx]]]
names = temperature, external temperature, humidity, battery, pulsecount
datacodes = h,h,h,h,L
scales = 0.1,0.1,0.1,0.1,1
units = C,C,%,V,p

[[24]]
nodename = emonth6
[[[rx]]]
names = temperature, external temperature, humidity, battery, pulsecount
datacodes = h,h,h,h,L
scales = 0.1,0.1,0.1,0.1,1
units = C,C,%,V,p

[[25]]
nodename = emonth7
[[[rx]]]
names = temperature, external temperature, humidity, battery, pulsecount
datacodes = h,h,h,h,L
scales = 0.1,0.1,0.1,0.1,1
units = C,C,%,V,p

[[26]]
nodename = emonth8
[[[rx]]]
names = temperature, external temperature, humidity, battery, pulsecount
datacodes = h,h,h,h,L
scales = 0.1,0.1,0.1,0.1,1
units = C,C,%,V,p

[[11]]
nodename = 3phase
[[[rx]]]
names = powerL1, powerL2, powerL3, power4, Vrms, temp1, temp2, temp3, temp4, temp5, temp6
datacode = h
scales = 1,1,1,1,0.01,0.1,0.1,0.1,0.1,0.1,0.1
units =W,W,W,W,V,C,C,C,C,C,C

[[12]]
nodename = fronius
[[[rx]]]
Expand Down
43 changes: 4 additions & 39 deletions conf/interfacer_examples/modbus/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,6 @@ versions on init to the log file change the Type setting to EmonFroniusModbusTcp
There is a sample modbusTCP.emonhub.conf file located in this directory.
The rType and datacodes must match. Use the table below to assist.

```
<table class="tg">
<tr>
<th class="tg-yw4l">register type</th>
<th class="tg-yw4l">datacode</th>
</tr>
<tr>
<td class="tg-yw4l">int16</td>
<td class="tg-yw4l">h</td>
</tr>
<tr>
<td class="tg-yw4l">uint16</td>
<td class="tg-yw4l">H</td>
</tr>
<tr>
<td class="tg-yw4l">unint32</td>
<td class="tg-yw4l">I</td>
</tr>
<tr>
<td class="tg-yw4l">uint64</td>
<td class="tg-yw4l">Q</td>
</tr>
<tr>
<td class="tg-yw4l">float32</td>
<td class="tg-yw4l">F</td>
</tr>
</table>
```

### Sample interfacer config within emonhub.conf

Sample configuration for modbus TCP clients
Expand All @@ -46,29 +17,20 @@ Sample configuration for modbus TCP clients
[[ModbusTCP]]
# this interfacer retrieves register information from modbusTCP clients
# retrieve register information from modbus TCP documentation for your inverter.
# Information here is designed for Fronius Symo 3 phase inverter.
Type = EmonModbusTcpInterfacer
[[[init_settings]]]
modbus_IP = 192.168.1.10 # ip address of client to retrieve data from
modbus_port = 502 # Portclient listens on
[[[runtimesettings]]]
# list of names of items being retrieved
# This example retrieves the Inverter status, AC power in watts being produced, AC Lifetime KWh produced,
# KWh produced for current day,
rName = Inverter_status,AC_power_watts,AC_LifetimekWh,DayWh,mppt1,mppt2,Vmppt1,Vmppt2,PhVphA,PhVphB,PhVphC
# List of starting registers for items listed above
register = 40118,40092,40102,502,40285,40305,40284,40304,40086,40088,40090
# List of # of registers used for each item
nReg = 1,2,2,4,1,1,1,1,2,2,2
# Data type for each item above
rType = uint16,float32,float32,uint64,uint16,uint16,uint16,uint16,float32,float32,float32
# nodeid used to match with node definition in nodes section below. Can be set to any integer value not previously used.
nodeId = 12
# Channel to publish data to should leave as ToEmonCMS
pubchannels = ToEmonCMS,
# time in seconds between checks, This is in addition to emonhub_interfacer.run() sleep time of .01
# use this value to set the frequency of data retrieval from modbus client
interval = 1
interval = 10
```

### Sample Node declaration in emonhub.conf
Expand All @@ -78,6 +40,9 @@ Node ID must match node ID set in interfacer definition above
[[12]]
nodename = fronius
[[[rx]]]
# list of names of items being retrieved
# This example retrieves the Inverter status, AC power in watts being produced, AC Lifetime KWh produced,
# KWh produced for current day,....
names = Inverter_status,AC_power_watts,AC_LifetimekWh,DayWh,mppt1,mppt2,Vmppt1,Vmppt2,PhVphA,PhVphB,PhVphC
datacodes = H,f,f,Q,H,H,H,H,f,f,f
scales = 1,0.1,0.1,1,1,1,1,1,0.1,0.1,0.1
Expand Down
2 changes: 0 additions & 2 deletions src/emonhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@ def _update_settings(self, settings):
if not 'Type' in I:
continue
self._log.info("Creating " + I['Type'] + " '%s' ", name)
if I['Type'] in ('EmonModbusTcpInterfacer','EmonFroniusModbusTcpInterfacer') and not pymodbus_found :
self._log.error("Python module pymodbus not installed. unable to load modbus interfacer")
# This gets the class from the 'Type' string
interfacer = getattr(ehi, I['Type'])(name,**I['init_settings'])
interfacer.set(**I['runtimesettings'])
Expand Down
Loading

0 comments on commit 96932ae

Please sign in to comment.