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.

You might also like...
SALUS THERMOSTAT Custom component for Home-Assistant
SALUS THERMOSTAT Custom component for Home-Assistant

Home-Assistant Custom Components Custom Components for Home-Assistant (http://www.home-assistant.io) Salus Thermostat Climate Component My device is R

Nordpool_diff custom integration for Home Assistant

nordpool_diff custom integration for Home Assistant Requires https://github.com/custom-components/nordpool Applies non-causal FIR differentiator1 to N

Smart EQ connect - Custom Integration for Home Assistant
Smart EQ connect - Custom Integration for Home Assistant

Smart EQ Connect platform as a Custom Component for Home Assistant.

Windhager myComfort custom component for Home Assistant

Windhager myComfort custom component for Home Assistant

Home Assistant custom components MPK-Lodz

MPK Łódź sensor This sensor uses unofficial API provided by MPK Łódź. Configuration options Key Type Required Default Description name string False MP

Custom component for MPC-HC for home-assistant
Custom component for MPC-HC for home-assistant

mpc_hc The current mpchc integration in homeassistant violates ADR0004, so it will be deleted from core. This is just the existing integration copied

Home assiatant Custom component: Camera Archiver

Camera archiver Archive your ftp camera meadia files on other ftp with files renaming and event creation. Event can be used for send information to el

A lightweight script for updating custom components for Home Assistant

Updater for Home Assistant This is a lightweight script for updating custom components for Home Assistant. If for some reason you do not want to use H

This Home Assistant custom component adds support for controlling Midea dehumidiferes on local network.

This is a custom component for Home assistant that adds support for Midea dehumidifier appliances via the local area network. midea-dehumidifier-lan H

Comments
  • Home assistant core

    Home assistant core

    Hi! I also have the Peimar inverter but the installation of my HA is core and does not support the addon. Is it possible to convert the addon into a custom_component? Thank you

    opened by andreapazzo 2
Owner
cislow
cislow
Philippe 1 Jan 9, 2022
Huawei Solar sensors for Home Assistant

Huawei Solar Sensors This integration splits out the various values that are fetched from your Huawei Solar inverter into separate HomeAssistant senso

Thijs Walcarius 151 Dec 31, 2022
Automate gate/garage door opening via 433.92MHz emitter with Raspberry Pi, Home Assistant and Homekit.

Automate opening your garage door / gate Summary This project sums up how I automated opening my garage door using a Raspberry PI, a 433Mhz emitter, H

Julien Fouilhé 29 Nov 30, 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
BMP180 sensor driver for Home Assistant used in Raspberry Pi

BMP180 sensor driver for Home Assistant used in Raspberry Pi Custom component BMP180 sensor for Home Assistant. Copy the content of this directory to

747Developments 1 Dec 17, 2021
Ha-rpi gpio - Home Assistant Raspberry Pi GPIO Integration

Home Assistant Raspberry Pi GPIO custom integration This is a spin-off from the

Shay Levy 98 Dec 24, 2022
Resmed_myair_sensors - This is a Home Assistant custom component to pull daily CPAP data from ResMed's myAir service using an undocumented API

resmed_myair This component will set up the following platforms. Platform Description sensor Show info from the myAir API. Installation Using the tool

Preston Tamkin 17 Dec 29, 2022
Home Assistant custom integration for Yi cameras: yi-hack-MStar, yi-hack-Allwinner and yi-hack-Allwinner-v2

yi-hack Home Assistant integration Overview yi-hack Home Assistant is a custom integration for Yi cameras (or Sonoff camera) with one of the following

roleo 131 Jan 3, 2023
Home Assistant custom integration for e-distribución

e-Distribución is an energy distribution company that covers most of South Spain area. If you live in this area, you probably are able to register into their website to get some information about your power demand, energy consumption, or even cycle billing (in terms of consumptions).

VMG 17 Sep 7, 2022
Custom component for Home Assistant that integrates Candy/Haier Wi-Fi washing machines (also known as Simply-Fi).

Candy Home Assistant component Custom component for Home Assistant that integrates Candy/Haier Wi-Fi washing machines (also known as Simply-Fi). This

Olivér Falvai 61 Dec 29, 2022