Wireless MeterLogger for Kamstrup heat energy meters and pulse based meters
Clone or download
Permalink
Failed to load latest commit information.
documentation changed time waiting after disconnecting from network before staring … Aug 20, 2017
driver added missing ets_isr_unmask to esp8266.h Sep 1, 2017
espfstest no stdint.h neeeded Mar 5, 2016
firmware Set 112th Byte = 3 in esp_init_data_default.bin Oct 21, 2017
html added mqtt host configuration via web setup Feb 21, 2018
impulse-meter-pcb @ 87ada19 updated submodules Oct 19, 2017
include ESP_CONST_DATA __attribute__((aligned(4))) __attribute__((section(".i… May 25, 2018
lib/heatshrink Replace strcmp() with strncmp(). Feb 25, 2018
meterlogger_doxygen @ a5710a9 METER_SERIAL_LEN 8 -> 10 Oct 28, 2017
mkespfsimage removed reset_watchdog(MQTT_WATCHDOG_ID) in sample_timer_func() since… Mar 12, 2018
modules disabled use of NULL_MODE, possible cause of crashing May 25, 2018
mqtt Put keepAliveTick in more sensible location Aug 25, 2018
pcb+power @ 739016e METER_SERIAL_LEN 8 -> 10 Oct 28, 2017
test unreversed detection of NO_AUTO_CLOSE Feb 28, 2018
tools initial version Mar 6, 2015
user setting MEMLEAK_DEBUG and implementing check_memleak_debug_enable() f… May 28, 2018
.gitignore hack to get it to reconnect on weak wifi Nov 2, 2016
.gitmodules moved impulse-meter-pcb to submodule Oct 19, 2017
Dockerfile updated Dockerfile to build sdk 3.0.0 May 26, 2018
LICENSE Create LICENSE Oct 17, 2017
Makefile setting MEMLEAK_DEBUG and implementing check_memleak_debug_enable() f… May 28, 2018
README.md added clear_cron via cron Apr 5, 2018
README_esphttpd + esphttpd Mar 6, 2015
README_mqtt.md rename Mar 11, 2015
cert.h prepare for ssl Sep 25, 2015
private_key.h prepare for ssl Sep 25, 2015
webpages.espfs removed reset_watchdog(MQTT_WATCHDOG_ID) in sample_timer_func() since… Mar 12, 2018

README.md

MeterLogger

MeterLogger is a custom daughterboard you can insert in Kamstrup Meters and get them to transmit their samples to a remote MQTT server. MeterLogger is part of the Nabovarme orgnaization.

Check out the WIKI for more details!

Build details

To build and flash for KMP type meter (Multical 601):

KEY=ef500c9268cf749016d26d6cbfaaf7bf AP=1 make clean all flashall  

To build and flash for en61107, sub type Multical 66 C:

EN61107=1 KEY=ef500c9268cf749016d26d6cbfaaf7bf AP=1 make clean all flashall  

To build and flash for en61107, sub type Multical 66 B:

MC_66B=1 KEY=ef500c9268cf749016d26d6cbfaaf7bf AP=1 make clean all flashall  

To build and flash for KMP/en61107 type, forced as flow meter:

FORCED_FLOW_METER=1 KEY=ef500c9268cf749016d26d6cbfaaf7bf AP=1 make clean all flashall  

To build and flash for impulse based electricity meter:

IMPULSE=1 KEY=ef500c9268cf749016d26d6cbfaaf7bf AP=1 make clean all flashall  

To configure wireless network:

SERIAL=9999999 KEY=ef500c9268cf749016d26d6cbfaaf7bf make wifisetup  

BUILD OPTIONS
DEBUG=1
enable serial debugging

DEBUG_NO_METER=1
dont wait for meter to answer

DEBUG_SHORT_WEB_CONFIG_TIME=1
dont wait for web config

IMPULSE=1
meter type is impulse based (100 mS)

EN61107=0
meter type is KMP (Multical 601)

EN61107=1
meter type is en61107, sub type Multical 66 C

MC_66B=1
meter type is en61107, sub type Multical 66 B

FORCED_FLOW_METER=1
meter is forced to run as a flow meter and close when volume is reached

AUTO_CLOSE=1
automatically check if energy is larger than the value set by open_until mqtt command

THERMO_NO=0
thermo actuator is normal closed

THERMO_NO=1
thermo actuator is normal open

THERMO_ON_AC_2
thermo actuator connected on ac 2

LED_ON_AC=1
use led to indicate ac state

SERIAL=9999999
serial number for meter used for device's SSID: IMPULSE meters EL_9999999 and other Kamstrup meters KAM_9999999. Used in make wifisetup target and if DEBUG_NO_METER=1

KEY=ef500c9268cf749016d26d6cbfaaf7bf master key for crypto, 16 bytes Fist 8 bytes hex encoded (ef500c9268cf7490) is wifi setup password. Master key is sha256 hashed to 32 bit and first first 16 bytes is aes key and last 16 bytes is hmac sha256 key.

Crypto is applies on mqtt packages like: first 32 bytes of mqtt_message contains hmac sha256, next 16 bytes contains IV last part is aes encrypted data

AP=1 enable wireless extender; wireless AP enables open source lwip and uses more memory so mqtt buffer is smaller when this option is set.

MQTT format for messages sent to meter

Topic Message
/config/v2/9999999/[unix time]/ping
/config/v2/9999999/[unix time]/open [unix time]
/config/v2/9999999/[unix time]/open_until [kWh when meter should close]
/config/v2/9999999/[unix time]/open_until_delta [[kWh when meter should close as delta]
/config/v2/9999999/[unix time]/close [unix time]
/config/v2/9999999/[unix time]/status
/config/v2/9999999/[unix time]/set_cron minute=30&hour=&day_of_month=&month=&day_of_week=&command=open
/config/v2/9999999/[unix time]/set_cron minute=30&hour=&day_of_month=&month=&day_of_week=&command=close
/config/v2/9999999/[unix time]/set_cron minute=30&hour=&day_of_month=&month=&day_of_week=&command=set_ssid_pwd=ssid=the_ssid&pwd=secret
/config/v2/9999999/[unix time]/set_cron minute=30&hour=&day_of_month=&month=&day_of_week=&command=clear_cron
/config/v2/9999999/[unix time]/cron
/config/v2/9999999/[unix time]/clear_cron [unix time]
/config/v2/9999999/[unix time]/ping
/config/v2/9999999/[unix time]/version
/config/v2/9999999/[unix time]/uptime
/config/v2/9999999/[unix time]/vdd
/config/v2/9999999/[unix time]/rssi
/config/v2/9999999/[unix time]/ssid
/config/v2/9999999/[unix time]/scan
/config/v2/9999999/[unix time]/set_ssid [ssid]
/config/v2/9999999/[unix time]/set_pwd [pwd]
/config/v2/9999999/[unix time]/set_ssid_pwd [ssid=name&pwd=secret]
/config/v2/9999999/[unix time]/wifi_status
/config/v2/9999999/[unix time]/start_ap [start ap + save to flash if changed]
/config/v2/9999999/[unix time]/stop_ap [stop ap + save to flash if changed]
/config/v2/9999999/[unix time]/ap_status
/config/v2/9999999/[unix time]/reconnect
/config/v2/9999999/[unix time]/save (only pulse meter)
/config/v2/9999999/[unix time]/mem
/config/v2/9999999/[unix time]/reset_reason

MQTT format for messages sent from meter

Topic Message
/sample/v2/9999999/[unix time] heap=20000&t1=25.00 C&t2=15.00 C&tdif=10.00 K&flow1=0 l/h&effect1=0.0 kW&hr=0 h&v1=0.00 m3&e1=0 kWh&
/cron/v2/9999999/[unix time] 12
/ping/v2/9999999/[unix time]
/version/v2/9999999/[unix time] [sdk version]-[git version]
/status/v2/9999999/[unix time] [open
/open_until/v2/9999999/[unix time] [kWh when meter should close]
/open_until_delta/v2/9999999/[unix time] [kWh when meter should close]
/uptime/v2/9999999/[unix time] [uptime in seconds]
/vdd/v2/9999999/[unix time] [power supply voltage level]
/rssi/v2/9999999/[unix time] [rssi of the wifi it is connected to (in dBm, 31 if fail)]
/ssid/v2/9999999/[unix time] [ssid of the wifi it is connected to]
/set_ssid/v2/9999999/[unix time] [ssid of the wifi it is set to connect to]
/set_pwd/v2/9999999/[unix time] [password for the wifi it is set to connect to]
/set_ssid_pwd/v2/9999999/[unix time] [combined ssid and password for the wifi it is set to connect to]
/scan_result/v2/9999999/[unix time] [ssid=Loppen Public&rssi=-51&channel=11]
/wifi_status/v2/9999999/[unix time] [connected or disconnected]
/ap_status/v2/9999999/[unix time] [started or stopped]
/save/v2/9999999/[unix time] (only pulse meter) saved
/mem/v2/9999999/[unix time] heap=9672
/reset_reason/v2/9999999/[unix time]