All Projects → seanauff → metermon

seanauff / metermon

Licence: MIT License
Dockerized rtlamr wrapper that outputs formatted JSON messages over mqtt

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to metermon

Home Assistant EDP Box
Integração das EDP Box com Home Assistant Core
Stars: ✭ 91 (+378.95%)
Mutual labels:  mqtt, meter
modbus4mqtt
Modbus TCP <-> MQTT glue. YAML configuration. Robust.
Stars: ✭ 21 (+10.53%)
Mutual labels:  mqtt
RPI-Examples
Examples of using the IoT JumpWay with the Raspberry Pi 3.
Stars: ✭ 77 (+305.26%)
Mutual labels:  mqtt
SuperLEDstrip
No description or website provided.
Stars: ✭ 13 (-31.58%)
Mutual labels:  mqtt
emqx-retainer
EMQ X Retainer
Stars: ✭ 19 (+0%)
Mutual labels:  mqtt
emqx-docs-en
EMQ X Broker Documentation
Stars: ✭ 12 (-36.84%)
Mutual labels:  mqtt
kotori
A flexible data historian based on InfluxDB, Grafana, MQTT and more. Free, open, simple.
Stars: ✭ 73 (+284.21%)
Mutual labels:  mqtt
chat21-ionic
A ionic v5 and Angular 8 desktop and mobile chat
Stars: ✭ 69 (+263.16%)
Mutual labels:  mqtt
roataway-web
Roataway web site
Stars: ✭ 15 (-21.05%)
Mutual labels:  mqtt
tmessage
CLI based messaging tool
Stars: ✭ 17 (-10.53%)
Mutual labels:  mqtt
remote-pad-gui
Desktop app to start remote pad services to help you get started
Stars: ✭ 17 (-10.53%)
Mutual labels:  mqtt
AnkhSVN
AnkhSVN provides first class Subversion support for all recent Visual Studio versions.
Stars: ✭ 54 (+184.21%)
Mutual labels:  scm
ha-watermeter
Data provider for smartmeter watermeter.
Stars: ✭ 20 (+5.26%)
Mutual labels:  mqtt
jMQTT
Jeedom plugin to interface as a client with an MQTT broker.
Stars: ✭ 16 (-15.79%)
Mutual labels:  mqtt
WeConnect-mqtt
MQTT Client that publishes data from Volkswagen WeConnect
Stars: ✭ 14 (-26.32%)
Mutual labels:  mqtt
Cicada-FW
IoT Communications Module for Energy Access. An easy way to get production ready, bi-directional communications for your IoT embedded device. Proiect supported by the EnAccess Foundation - https://enaccess.org
Stars: ✭ 12 (-36.84%)
Mutual labels:  mqtt
gmqtt
Golang MQTT Broker.
Stars: ✭ 75 (+294.74%)
Mutual labels:  mqtt
sunricher-wifi-mqtt
control Sunricher LED devices using MQTT
Stars: ✭ 14 (-26.32%)
Mutual labels:  mqtt
micro-mqtt
A lightweight MQTT client with a complete feature set for embedded scenarios.
Stars: ✭ 13 (-31.58%)
Mutual labels:  mqtt
dlibox
Home automation that does not depend on the internet
Stars: ✭ 26 (+36.84%)
Mutual labels:  mqtt

metermon

Metermon is a dockerized rtlamr wrapper that connects to an existing rtl_tcp instance and outputs formatted messages over MQTT for consumption by other software (e.g. telegraf for storage in influxdb and display in grafana, or import into Home Assistant).

The script can be run using docker (takes care of all dependencies) or standalone. It is designed to run on Raspberry Pi or similar.

All credit for rtlamr goes to bemasher.

Usage

  1. Have a MQTT broker you can connect to. I use Mosquitto.

  2. Ensure you have a rtl_tcp instance that is listening for new connections. I use this docker container.

  3. Run the container or script using instructions below.

  4. Subscribe to the mqtt output topic, metermon/output, with the data consumer of your choice.

  5. Process with your data consumer of choice. An example telegraf config is provided.

Output format

By default, metermon outputs JSON messages to the metermon/output mqtt topic. The metermon prefix can be changed by setting the MQTT_TOPIC_PREFIX environment variable. Metermon will then send its output messages on [MQTT_TOPIC_PREFIX]/output. Note that adding a trailing / to MQTT_TOPIC_PREFIX will create an empty level.

Value of MQTT_TOPIC_PREFIX mqtt output topic
metermon metermon/output
sensors/meters sensors/meters/output
sensors/meters/ sensors/meters//output

JSON keys

The JSON message has a single level with the following keys:

Key Example Description
Protocol SCM The protocol of the received message. See here for the list.
Type Electric The meter type of the received message, converted to generic utility type, e.g. "Electric", "Gas", or "Water". See here for mapping of numeric ERT type.
ID 29163678 The unique ID of the meter the received message originated from.
Consumption 96948.54 The current consumption value in the received message, processed into standard units (Ex.: electric meters report in 1/100 kWh, metermon divides this value by 100 to get kWh).
Unit kWh The unit that metermon has converted the value to. Metermon decides this by knowing the type of meter and/or the protocol.

If the METERMON_SEND_RAW environment variable is set to true, metermon will send the entire unprocessed JSON message received from rtlamr to the [MQTT_TOPIC_PREFIX]/raw topic.

If the METERMON_SEND_BY_ID environment variable is set to true, metermon will also send the processed JSON message received from rtlamr to the [MQTT_TOPIC_PREFIX]/[UNIQUE_ID_OF_METER] topic. This, combined with the use of the RTLAMR_FILTERID environment variable, can make it easier for parsing just a few meters into Home Assistant.

Status Messages

Metermon will report its status on the [MQTT_TOPIC_PREFIX]/status topic via retained messages. Metermon reports Online once it connects to the broker. Upon disconnect, the broker will report Offline.

Performance Tuning

By adjusting the RTLAMR_SYMBOLLENGTH environment variable, sample rates can be modified to reduce CPU load. See documentation of this feature here and a discussion of the potential performance impacts here.

Running via Docker

Pull the image. If using raspberry pi or similar use arm in place of [tag]. The latest tag will pull the amd64 image:

docker pull seanauff/metermon:[tag]

Start the container with all default environment variables:

docker run -d seanauff/metermon:[tag]

Start the container with modified environment variables:

docker run -d -e MQTT_BROKER_HOST=[host] -e RTL_TCP_SERVER=[server] seanauff/metermon:[tag]

Environment Variables

Variable Default Value Notes
MQTT_BROKER_HOST 127.0.0.1 IP or hostname of MQTT broker
MQTT_BROKER_PORT 1883 Port of MQTT broker
MQTT_CLIENT_ID metermon Change this if the default is already in use by another client
MQTT_USERNAME Username for connecting to MQTT broker when using auth. TLS not currently supported
MQTT_PASSWORD Password for connecting to MQTT broker when using auth. TLS not currently supported
MQTT_TOPIC_PREFIX metermon Set the prefix to use for the MQTT topic that messages are sent to
RTL_TCP_SERVER 127.0.0.1:1234 server:port that your rtl_tcp instance is listening on
RTLAMR_MSGTYPE all List of message types to listen for. See rtlamr config
RTLAMR_FILTERID List of meter IDs to look for. See rtlamr config
RTLAMR_SYMBOLLENGTH 72 Adjust sample rate by setting the length of each symbol. See rtlamr wiki
RTLAMR_UNIQUE true Suppress duplicate messages from each meter. See rtlamr config
METERMON_SEND_RAW false Set to true to enable sending the raw json from rtlamr to the [MQTT_TOPIC_PREFIX]/raw topic
METERMON_SEND_BY_ID false Set to true to enable sending the processed json to the [MQTT_TOPIC_PREFIX]/[UNIQUE_ID_OF_METER] topic.
METERMON_ELECTRIC_DIVISOR 100.0 Change this to correct the electricity units that your meter reports in to kWh
METERMON_WATER_DIVISOR 10.0 Change this to correct the water units that your meter reports in to gal

Troubleshooting

If you receive meter messages with rtlamr but they are not showing up in metermon, it is likely that metermon doesn't recognize the "Endpoint Type" of your meter. This can be easily fixed so please open an issue with the rtlamr output and meter type (gas, electric, water) and I can add it.

Build the image yourself

Clone the repository and build the image:

git clone https://github.com/seanauff/metermon.git
docker build -t seanauff/metermon metermon
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].