Skip to content

emersonsc/rpi-power-monitor-mqtt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

rpi-power-monitor-mqtt

Publish data from rpi-power-monitor to MQTT

Building on the amazing work at https://github.com/David00/rpi-power-monitor/wiki, this script will export data from influx and send it to an MQTT server. My specific use case for this is to bring the data into Home Assistant, but this could certainly used for many other purposes.

Prerequisites

You'll need to install the InfluxDB and Mosquitto clients that the script uses.

apt-get install influxdb-client mosquitto-clients

Installation

Install The Script

Copy the powermon-mqtt.sh script to /home/pi

Set Up Cron

Edit the cron tab with the command "crontab -e" and enter the example below, substituting your MQTT server and prefix. If your server uses authentication, edit the script and update the variables.

Example cron tab:

* * * * * /home/pi/powermon-mqtt.sh [mqtt-server] [mqtt-prefix]

Add To Home Assistant

This can be added to Home Assistant as an MQTT sensor, such as:

- platform: mqtt
  name: "Powermon CT 0"
  state_topic: "powermon/ct_0/power"
  icon: mdi:electron-framework
  unit_of_measurement: 'W'

- platform: mqtt
  name: "Powermon Power Home"
  state_topic: "powermon/home_load/power"
  icon: mdi:electron-framework
  unit_of_measurement: 'W'

You can also add an integration sensor which will add this power source to the Energy Grid.

- platform: integration
  source: sensor.powermon_power_home
  name: powermon_energy_spent
  unit_prefix: k
  round: 6

About

Publish data from rpi-power-monitor to MQTT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%