Git Product home page Git Product logo

venus.dbus-sma-smartmeter's Introduction

venus.dbus-sma-smartmeter

A service for Venus OS, reading smart meter data from a SMA system (SMA-EM Speedwire Broadcast) and making the values available on dbus.

The Python script listen to the SMA-EM broadcast and publishes information on the dbus, using the service name com.victronenergy.grid. This makes the Venus OS work as if you had a physical Victron Grid Meter installed.

Configuration

Not needed

Installation

  1. Copy the files to the /data folder on your venus:

    • /data/dbus-sma-smartmeter/dbus-sma-smartmeter.py
    • /data/dbus-sma-smartmeter/kill_me.sh
    • /data/dbus-sma-smartmeter/service/run
  2. Set permissions for files:

    chmod 755 /data/dbus-sma-smartmeter/service/run

    chmod 755 /data/dbus-sma-smartmeter/kill_me.sh

    chmod 755 /data/dbus-sma-smartmeter/rc.local

  3. Get two files from the velib_python and install them on your venus:

    • /data/dbus-sma-smartmeter/vedbus.py
    • /data/dbus-sma-smartmeter/ve_utils.py
  4. Add a symlink to the file /data/rc.local:

    ln -s /data/dbus-sma-smartmeter/service /service/dbus-sma-smartmeter

    Or if that file does not exist yet, store the file rc.local from this service on your Raspberry Pi as /data/rc.local . You can then create the symlink by just running rc.local:

    make it executable with

    chmod 755 /data/rc.local

    /data/rc.local

    The daemon-tools should automatically start this service within seconds.

Debugging

You can check the status of the service with svstat:

svstat /service/dbus-sma-smartmeter

It will show something like this:

/service/dbus-sma-smartmeter: up (pid 10078) 325 seconds

If the number of seconds is always 0 or 1 or any other small number, it means that the service crashes and gets restarted all the time.

When you think that the script crashes, start it directly from the command line:

python /data/dbus-sma-smartmeter/dbus-sma-smartmeter.py

and see if it throws any error messages.

If the script stops with the message

dbus.exceptions.NameExistsException: Bus name already exists: com.victronenergy.grid"

it means that the service is still running or another service is using that bus name.

Within repo you find a script speedwire_test.py. You can run it on your target machine to see whether UDP Broadcast is received. The script just listen an print received values on console. There is no dependency to VenusOS, means it should run on any Linux box where Python is installed

Output should look like this:

pregardcounter: 5861.8kWh
surplus: 0.0W
surpluscounter: 7532.98kWh
L1_voltage: 237.09V
L2_voltage: 226.54V
L3_voltage: 222.84V
L1_pregard: 251.1W
L2_pregard: 0.0W
L3_pregard: 5.9W
L1_surplus: 0.0W
L2_surplus: 214.2W
L3_surplus: 0.0W
power: 42.9W
L1_power: 251.1W
L2_power: -214.2W
L2_power: 5.9W
L1_current: 1.06A
L2_current: -0.95A
L3_current: 0.03A
pregard: 18.3W
pregardcounter: 5861.8kWh
surplus: 0.0W
surpluscounter: 7532.98kWh
L1_voltage: 237.26V
L2_voltage: 226.1V
L3_voltage: 222.97V
L1_pregard: 242.5W
L2_pregard: 0.0W
L3_pregard: 0.0W
L1_surplus: 0.0W
L2_surplus: 223.1W
L3_surplus: 1.1W
power: 18.3W
L1_power: 242.5W
L2_power: -223.1W
L2_power: -1.1W
L1_current: 1.02A
L2_current: -0.99

Restart the script

If you want to restart the script, for example after changing it, just run the following command:

/data/dbus-sma-smartmeter/kill_me.sh

The daemon-tools will restart the script within a few seconds.

Hardware

It should work with

  • SMA-EM10
  • SMA-EM20
  • SHM-2.0

venus.dbus-sma-smartmeter's People

Contributors

waldmensch1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.