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
HACS gives you a powerful UI to handle downloads of all your custom needs.

HACS (Home Assistant Community Store) Manage (Install, track, upgrade) and discover custom elements for Home Assistant directly from the UI. What? HAC

HACS 3.2k Jan 04, 2023
A raspberrypi tools for python

raspberrypi-tools how to install: first clone this project: git clone https://github.com/Ardumine/rpi-tools.git then go to the folder cd rpi-tools and

1 Jan 04, 2022
AERO 421: Spacecraft Attitude, Dynamics, and Control Final Project.

AERO - 421 Final Project Redevelopment Spacecraft Attitude, Dynamics, and Control: Simulation to determine and control a satellite's attitude in LEO.

Gagandeep Thapar 3 Dec 16, 2022
E-Ink Magic Calendar that automatically syncs to Google Calendar and runs off a battery powered Raspberry Pi Zero

E-Ink Magic Calendar that automatically syncs to Google Calendar and runs off a battery powered Raspberry Pi Zero

2.8k Dec 30, 2022
Get the AltAz coordinates for a given object using astropy and output on a OLED screen.

Star Coordinates Get the AltAz coordinates for a given object using astropy and output on a OLED screen. As a very very newcomer to the astronomy scen

Craig Cmehil 1 Jan 31, 2022
A iot Bike sytem based on RaspberryPi, Ardiuino

Cyclic 's Kernel ---- A iot Bike sytem based on RaspberryPi, Ardiuino, etc 0x1 What is This? Cyclic 's Kernel is an independent System With self-produ

Retr0mous 2 Oct 09, 2022
Extremely simple PyBadge examples to demonstrate different aspects of CircuitPython using PyBadge hardware.

BeginnerPyBadge I purchased a PyBadge recently. I'm new to hardware. I was surprised how hard it was to find easy examples demonstrating how different

Rubini LaForest 2 Oct 21, 2021
Open source home automation that puts local control and privacy first.

Home Assistant Open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiast

Home Assistant 57k Jan 01, 2023
A simple Picobot project implemented in Python

Python-Picobot A simple Picobot project implemented in Python About Explanation This is my first programming project. Picobot use rules.txt file which

Shayan Shiravani 0 Apr 03, 2022
Raspberry Pi Pico as a Rubber Ducky

Raspberry-Pi-Pico-as-a-Rubber-Ducky Kurulum Raspberry Pi Pico cihazınız için CircuitPython'u indirin. Boot düğmesine basılı tutarken cihazı bir USB ba

Furkan Enes POLATOĞLU 6 Dec 13, 2022
FERM: A Framework for Efficient Robotic Manipulation

Framework for Efficient Robotic Manipulation FERM is a framework that enables robots to learn tasks within an hour of real time training.

Ruihan (Philip) Zhao 111 Dec 31, 2022
Like htop (CPU and memory usage), but for your case LEDs. 😄

Like htop (CPU and memory usage), but for your case LEDs. 😄

Derek Anderson 3 Dec 08, 2021
a fork of the OnionShare software better optimized for lower spec lightweight machines and ARM processors

OnionShare-Optimized A fork of the OnionShare software better optimized for lower spec lightweight machines and ARM processors such as Raspberry Pi or

ALTPORT 4 Aug 05, 2021
Tool to create 3D printable terrain with integrated path/road part files (Single material 3d printer)

BACKGROUND This has been an ongoing project of mine for a few months now. I run trails a lot and original the goal was to create a function to combine

9 Apr 26, 2022
Raspberry Pi Power Button - Wake/Power Off/Restart(Double Press)

Control Raspberry pi with physically attached button. Wake, Power Off, and Restart (Double Press) . Python3 script runs as a service with easy installation.

Stas Yakobov 16 Oct 22, 2022
Code for the paper "Planning with Diffusion for Flexible Behavior Synthesis"

Planning with Diffusion Training and visualizing of diffusion models from Planning with Diffusion for Flexible Behavior Synthesis. Guided sampling cod

Michael Janner 310 Jan 07, 2023
Modi2-firmware-updater - MODI+ Firmware Updater With Python

MODI+ Firmware Updater 실행 준비 python3(파이썬3.9 혹은 그 이상의 버전)를 컴퓨터에 설치 python3 -m pip

LUXROBO 1 Feb 04, 2022
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
A script for performing OTA update over BLE on ESP32

A script for performing OTA update over BLE on ESP32

Felix Biego 18 Dec 15, 2022
Final-project-robokeeper created by GitHub Classroom

RoboKeeper! Jonny Bosnich, Joshua Cho, Lio Liang, Marco Morales, Cody Nichoson Demonstration Videos Grabbing the paddle: https://youtu.be/N0HPvFNHrTw

Cody Nichoson 1 Dec 12, 2021