Skip to content

Eddy0815/dbus-shelly-em-pvinverter

 
 

Repository files navigation

dbus-shelly-em-pvinverter

Integrate Shelly EM into Victron Energies Venus OS

Purpose

With the scripts in this repo it should be easy possible to install, uninstall, restart a service that connects the Shelly EM to the VenusOS and GX devices from Victron. Idea is inspired on @fabian-lauer project and @vikt0rm linked below.

Inspiration

This project is my first on GitHub and with the Victron Venus OS, so I took some ideas and approaches from the following projects - many thanks for sharing the knowledge:

How it works

My setup

  • 3-Phase installation
  • Shelly EM with latest firmware (20220209-094317/v1.11.8-g8c7bb8d)
    • Measuring AC output of PV-Inverter on phase L3
    • Connected to Wifi netowrk "A" with a known IP
  • Shelly 3EM used as a grid meter
  • Venus OS on Raspberry PI 4 4GB version 1.1 - Firmware v2.84
    • No other devices from Victron connected
    • Connected to Wifi netowrk "A"

Details / Process

As mentioned above the script is inspired by @fabian-lauer dbus-shelly-3em-smartmeter and vikt0rm dbus-shelly-1pm-pvinverter implementation. So what is the script doing:

  • Running as a service
  • connecting to DBus of the Venus OS com.victronenergy.pvinverter.http_{DeviceInstanceID_from_config}
  • After successful DBus connection Shelly EM is accessed via REST-API - simply the /status is called and a JSON is returned with all details A sample JSON file from Shelly EM can be found here
  • Serial/MAC is taken from the response as device serial
  • Paths are added to the DBus with default value 0 - including some settings like name, etc
  • After that a "loop" is started which pulls Shelly EM data every 500ms from the REST-API and updates the values in the DBus

Thats it 😄

Pictures

Tile Overview Remote Console - Overview SmartMeter - Values SmartMeter - Device Details

Install & Configuration

Get the code

Just grap a copy of the main branche and copy them to a folder under /data/ e.g. /data/dbus-shelly-em-pvinverter. After that call the install.sh script.

The following script should do everything for you:

wget https://github.com/Eddy0815/dbus-shelly-em-pvinverter/archive/refs/tags/main.zip
unzip main.zip "dbus-shelly-em-pvinverter-main/*" -d /data
mv /data/dbus-shelly-em-pvinverter-main /data/dbus-shelly-em-pvinverter
chmod a+x /data/dbus-shelly-em-pvinverter/install.sh
/data/dbus-shelly-em-pvinverter/install.sh
rm main.zip

⚠️ Check configuration after that - because service is already installed an running and with wrong connection data (host, username, pwd) you will spam the log-file

Change config.ini

Within the project there is a file /data/dbus-shelly-em-pvinverter/config.ini - just change the values - most important is the deviceinstance, custom name and phase under "DEFAULT" and host, username and password in section "ONPREMISE". More details below:

Section Config vlaue Explanation
DEFAULT AccessType Fixed value 'OnPremise'
DEFAULT SignOfLifeLog Time in minutes how often a status is added to the log-file current.log with log-level INFO
DEFAULT Deviceinstance Unique ID identifying the shelly 1pm in Venus OS
DEFAULT CustomName Name shown in Remote Console (e.g. name of pv inverter)
DEFAULT Phase Valid values L1, L2 or L3: represents the phase where pv inverter is feeding in
ONPREMISE Host IP or hostname of on-premise Shelly EM web-interface
ONPREMISE Username Username for htaccess login - leave blank if no username/password required
ONPREMISE Password Password for htaccess login - leave blank if no username/password required

Used documentation

Discussions on the web

This module/repository has been posted on the following threads:

About

Integrate Shelly EM into Victron Energies Venus OS as a pv inverter

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 87.9%
  • Shell 12.1%