Home solar infrastructure (with Peimar Inverter) monitoring based on Raspberry Pi 3 B+ using Grafana, InfluxDB, Custom Python Collector and Shelly EM.

Overview

raspberry-solar-mon

Home solar infrastructure (with Peimar Inverter) monitoring based on Raspberry Pi 3 B+ using Grafana, InfluxDB, Custom Python Collector and Shelly EM.

My solar infrastructure:

My monitoring system:

  • Shelly EM + 120A Clamp to measure the electrical consumption of my house
  • Raspberry Pi 3 B+ with Raspbian OS
  • Grafana 7.5.5
  • InfluxDB 1.8.5
  • Telegraf 1.18.2
  • Custom python multithread collector for get metrics from Peimar Inverter and Shelly EM (compliant with Python 3)

Inverter Peimar, Shelly EM and Raspberry are connected to wifi network of my house.

EMDev1 EMDev2 Inverter1 Inverter2 EM Analysis1 Analysis2 Analysis3 Analysis4 Trend

Environment installation

  • Install Raspbian OS on your Raspberry Pi 3 B+
  • Install Grafana, InfluxDB and Telegraf on your Raspbian and enable services to starting automatically at system boot.
  • Install Python 3.7 if it's missing on your system.

InfluxDB configuration

  • Login via SSH with username pi.

  • Add to .bashrc of the user pi the following alias: alias influx='influx -precision rfc3339'

  • Reload .bashrc with the following command: source .bashrc

  • Copy configuration file influxdb.conf from repository folder influxdb to /etc/influxdb/ path of your installation.

  • Edit file influxdb.conf and disable authetication in [http] section: auth-enabled = false

  • Restart service and launch influxdb client with following command: influx

  • Create databases and users with grants:

    CREATE DATABASE peimar
    CREATE DATABASE telegraf

    CREATE USER admin WITH PASSWORD p4ssw0rd WITH ALL PRIVILEGES
    CREATE USER peimar WITH PASSWORD p31m4r
    CREATE USER telegraf WITH PASSWORD t3l3gr4f

    GRANT ALL ON peimar TO peimar
    GRANT ALL ON telegraf TO telegraf

    CREATE RETENTION POLICY "one_month" ON "telegraf" DURATION 4w REPLICATION 1
    CREATE RETENTION POLICY "ten_years" ON "peimar" DURATION 520w REPLICATION 1

    ALTER RETENTION POLICY "one_month" ON "telegraf" DURATION 4w REPLICATION 1 DEFAULT
    ALTER RETENTION POLICY "ten_years" ON "peimar" DURATION 520w REPLICATION 1 DEFAULT

  • Edit file influxdb.conf and enable authetication in [http] section: auth-enabled = true

  • Restart InfluxDB service: sudo systemctl restart influxdb.service

The database peimar contains the metrics of the Inverter and Shelly EM.
The database telegraf contains the metrics of Raspberry Pi and weather forecast from OpenWeather.

Telegraf configuration

  • Copy configuration file telegraf.conf from repository folder telegraf to /etc/telegraf/ path of your installation.
  • Copy configuration file openweather.conf from repository folder telegraf/telegraf.d to /etc/telegraf/telegraf.d path of your installation.
  • Register your account on OpenWeather, then insert infrastructure location and your id in openweather.conf.
  • Restart Telegraf service: sudo systemctl restart telegraf.service

Python collector configuration

  • Copy folder peimar from repository folder python_collector to /usr/lib/python3.7 path in your installation.

  • Copy folder shelly from repository folder python_collector to /usr/lib/python3.7 path in your installation.

  • Install python module for connection to Influx databases: sudo pip install influxdb

  • Copy all files from repository folder init.d to /etc/init.d path in your installation.

  • Make the script peimar-inverter in the init.d directory executable by changing its permission: sudo chmod +x peimar-inverter

  • Make the script shelly-em in the init.d directory executable by changing its permission: sudo chmod +x shelly-em

  • Create folder peimar in /var/log path of your installation (owner: pi, group: pi).

  • Create folder shellyem in /var/log path of your installation (owner: pi, group: pi).

  • Enable all daemons at boot system:

    sudo update-rc.d peimar-inverter defaults
    sudo update-rc.d shelly-em defaults

  • Change the IPs of the Inverter and Shelly EM to those of your network in the config.py files:

    /usr/lib/python3.7/peimar/inverter/config.py
    /usr/lib/python3.7/shelly/emeter/config.py

  • Change timezone of your infrastructure in config.py file of peimar daemon:

    timezone = pytz.timezone("Europe/Rome")

  • Reboot system.

For the management of daemons:
/etc/init.d/peimar-inverter {start|stop|forcekill|status|restart|reload}
/etc/init.d/shelly-em {start|stop|forcekill|status|restart|reload}

Grafana configuration

  • Copy configuration file grafana.ini from repository folder grafana to /etc/grafana/ path of your installation.

  • Copy image file how_solar_power_works.png from repository folder grafana/images to /usr/share/grafana/public/img path of your installation.

  • Install Grafana plugins grafana-clock-panel and larona-epict-panel with following command:

    sudo grafana-cli plugins install grafana-clock-panel
    sudo grafana-cli plugins install larona-epict-panel
    cd /var/lib/grafana/plugins/
    sudo chown -R grafana:grafana grafana-clock-panel
    sudo chown -R grafana:grafana larona-epict-panel

  • Restart Grafana service: sudo systemctl restart grafana-server.service

  • Import all dashboards from repository folder grafana/dashboards.

Owner
cislow
cislow
A Python class for controlling the Pimoroni RGB Keypad for Raspberry Pi Pico

rgbkeypad A Python class for controlling the Pimoroni RGB Keypad for the Raspberry Pi Pico. Compatible with MicroPython and CircuitPython. keypad = RG

Martin O'Hanlon 43 Nov 11, 2022
ArduinoWaterHeaterIOT - IoT Probe of a solar PV water heating system - Arduino, Python, MQTT, MySQL

ArduinoWaterHeaterIOT IoT Probe of a solar PV water heating system - Arduino, Raspberry Pi, Python, MQTT, MySQL The Arduino sends the AC and DC watts

Jacques Fourie 1 Jan 11, 2022
Hook and simulate global keyboard events on Windows and Linux.

keyboard Take full control of your keyboard with this small Python library. Hook global events, register hotkeys, simulate key presses and much more.

BoppreH 3.2k Dec 30, 2022
Iec62056-21-mqtt - Publish DSMR P1 telegrams acquired over IEC62056-21 to MQTT

IEC 62056-21 Publish DSMR P1 telegrams acquired over IEC62056-21 to MQTT. -21 is

Marijn Suijten 1 Jun 05, 2022
CircuitPython library for the CH559 USB to Serial chip

CH559 (USB to Serial) CircuitPython Library Why? Because you might want to get keyboard/mouse/gamepad/HID input into your CircuitPython projects witho

Guy Dupont 3 Nov 19, 2022
🏡 My Home Assistant Configs. Be sure to 🌟 my repo to follow the updates!

Home Assistant Configuration Here's my Home Assistant configuration. I have installed HA on a Lenovo ThinkCentre M93P Tiny with an Intel Dual-Core i5-

iLyas Bakouch 25 Dec 30, 2022
Raspberry Pi Pico and LoRaWAN from CircuitPython

Raspberry Pi Pico and LoRaWAN from CircuitPython Enable LoRaWAN communications on your Raspberry Pi Pico or any RP2040-based board using CircuitPython

Alasdair Allan 15 Oct 08, 2022
Example code and projects for FeatherS2 and FeatherS2 Neo

FeatherS2 & FeatherS2 Neo This repo is a collection of code, firmware, and files

Unexpected Maker 5 Jan 01, 2023
Home solar infrastructure (with Peimar Inverter) monitoring based on Raspberry Pi 3 B+ using Grafana, InfluxDB, Custom Python Collector and Shelly EM.

raspberry-solar-mon Home solar infrastructure (with Peimar Inverter) monitoring based on Raspberry Pi 3 B+ using Grafana, InfluxDB, Custom Python Coll

cislow 10 Dec 23, 2022
🌱 - WebhookHard◞ Fines Educativos ◟

v1.0.0 WebhookHardware ¿Que es WebhookHardware? WebhookHardware se trata de un proyecto tratado para sacar informacion sobre el hardware de tus victim

3 Jun 14, 2021
A small Python app to converse between MQTT messages and 433MHz RF signals.

mqtt-rf-bridge A small Python app to converse between MQTT messages and 433MHz RF signals. This acts as a bridge between Paho MQTT and rpi-rf. Require

David Swarbrick 3 Jan 27, 2022
ok-system-helper是一个简单的系统硬件的实时信息收集工具,使用python3.x开发

ok-system-helper ok-system-helper是一个简单的系统硬件的实时信息收集工具,使用python3.x开发,支持哪些硬件:CPU、内存、SWAP、磁盘、网卡流量。用户可在自己的项目中直接引入、开箱即用,或者结合flask等web框架轻松做成http接口供前端调用,亦可通过注

xlvchao 1 Feb 08, 2022
Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED.

RPie-keyboard-game Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED. Randem LED (general output) is lit up on rasberrypi rand

Shawn Dowling 1 Oct 24, 2021
Simple python3 implementation of microKanren with lots of type annotations for clarity

MicroKanren-py This is (yet another) python implementation of microKanren. It's a reasonably 1:1 translation of the code provided in the paper, but ev

Erik Derohanian 3 Dec 10, 2022
Red Light Green Light Robot

Red Light Green Light Robot The primary problem addressed by our project is robotic follower behavior i.e. maintaining distance from a moving target.

Will Romano 2 Nov 20, 2021
PyLog - Simple keylogger that uses pynput to listen to keyboard input.

Simple keylogger that uses pynput to listen to keyboard input. Outputs to a text file and the terminal. Press the escape key to stop.

1 Dec 29, 2021
DIY split-flap display

The goal is to make a low-cost display that's easy to fabricate at home in small/single quantities (e.g. custom materials can be ordered from Ponoko or similar, and other hardware is generally availa

Scott Bezek 2.5k Jan 05, 2023
Robo Arm :: Rigging is a rigging addon for Blender that helps animating industrial robotic arms.

Robo Arm :: Rigging Robo Arm :: Rigging is a rigging addon for Blender that helps animating industrial robotic arms. It construct serial links(a kind

2 Nov 18, 2021
A Python program that makes it easy to manage modules on a CircuitPython device!

CircuitPython-Bundle-Manager-v2 A Python program that makes it easy to manage modules on a CircuitPython device! The CircuitPython Bundle Manager v2 i

Ckyiu 1 Dec 18, 2021
A simple small scale electric car was build which can be driven by remote control and features a fully autonomous parking procedure.

personal-autonomous-parking-car-raspberry A simple electric car model was build using Raspbery pi. The car has remote control and autonomous operation

Kostas Ziovas 2 Jan 26, 2022