Giter VIP home page Giter VIP logo

dbus-fronius-smart-meter's Introduction

dbus-fronius-smart-meter

Integrate Fronis Meter smart meter into Victron Energies Venus OS

image

image

Purpose

With the scripts in this repo it should be easy possible to install, uninstall, restart a service that connects the Fronis Meter to the VenusOS and GX devices from Victron. Idea is pasend on @RalfZim project 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

  • Fronius Primo 5 with Smart Meter TS 100A-1

    • 1-Phase installation (normal for Spain)
    • Wired connected
  • Raspberry Pi 4 with Venus OS - Firmware v2.90-17

    • No other devices from Victron connected
    • Wired connected

Details / Process

As mentioned above the script is inspired by @RalfZim fronius smartmeter implementation. So what is the script doing:

  • Running as a service
  • connecting to DBus of the Venus OS com.victronenergy.grid.http_40
  • After successful DBus connection Fronis Meter is accessed via REST-API A sample JSON file from Fronis Meter can be found here
  • Serial 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 Fronis Meter data every 800ms (can be modified in the settings file) from the REST-API and updates the values in the DBus

Thats it ๐Ÿ˜„

Install & Configuration

Get the code

Just grap a copy of the main branche and copy them to /data/dbus-fronius-smart-meter. After that call the install.sh script.

The following script should do everything for you:

wget https://github.com/ayasystems/dbus-fronius-smart-meter/archive/refs/heads/main.zip
unzip main.zip "dbus-fronius-smart-meter-main/*" -d /data
mv /data/dbus-fronius-smart-meter-main /data/dbus-fronius-smart-meter
chmod a+x /data/dbus-fronius-smart-meter/install.sh
/data/dbus-fronius-smart-meter/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

Stop service

svc -d /service/dbus-fronius-smart-meter

Start service

svc -u /service/dbus-fronius-smart-meter

Reload data

/data/dbus-fronius-smart-meter/restart.sh

View log file

cat /data/dbus-fronius-smart-meter/current.log

Change config.ini

Within the project there is a file /data/dbus-fronius-smart-meter/config.ini - just change the values - most important is the host, username and password in section "ONPREMISE". More details below:

Afther change the config file execute restart.sh to reload new settings how to

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
ONPREMISE Host IP or hostname of on-premise Fronis Meter web-interface
ONPREMISE MeterID Your meter ID
ONPREMISE intervalMs Interval time in ms to get data from Fronius

image

Used documentation

dbus-fronius-smart-meter's People

Contributors

ayasystems avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

realdognose l0tzi

dbus-fronius-smart-meter's Issues

Freezes when LAN connection is briefly interrupted

EDIT: I'm unable to reproduce my own issue by only unplugging and reconnecting the ethernet cable from the PI. There must be another issue in my LAN.

I noticed that it freezes the last reported value from Fronius SmartMeter after being interrupted from LAN, while other services continue reporting on reconnection (e.g. Fronius Inverter).

Reboot always fixes it.

  • On Raspberry PI 4 with Venus v2.92

No connection issue

Hi,
I'm having trouble connecting to the meter.
Here is the error msg:
root@raspberrypi2:/data/dbus-fronius-smart-meter# python dbus-fronius-smart-meter.py
2023-09-18 17:01:30,775 root ERROR com.victronenergy.grid
2023-09-18 17:01:30,786 root CRITICAL Error at main
Traceback (most recent call last):
File "dbus-fronius-smart-meter.py", line 248, in main
pvac_output = DbusFroniusMeterService(
File "dbus-fronius-smart-meter.py", line 28, in init
self.dbusservice = VeDbusService("{}.http{:02d}".format(servicename, deviceinstance))
File "/opt/victronenergy/dbus-systemcalc-py/ext/velib_python/vedbus.py", line 78, in init
self._dbusname = dbus.service.BusName(servicename, self._dbusconn, do_not_queue=True)
File "/usr/lib/python3.8/site-packages/dbus/service.py", line 144, in new
raise NameExistsException(name)
dbus.exceptions.NameExistsException: Bus name already exists: com.victronenergy.grid.http_40
root@raspberrypi2:/data/dbus-fronius-smart-meter# /data/dbus-fronius-smart-meter/restart.sh
root@raspberrypi2:/data/dbus-fronius-smart-meter# python dbus-fronius-smart-meter.py
2023-09-18 17:03:07,726 root ERROR com.victronenergy.grid
2023-09-18 17:03:08,621 root CRITICAL Error at main
Traceback (most recent call last):
File "dbus-fronius-smart-meter.py", line 248, in main
pvac_output = DbusFroniusMeterService(
File "dbus-fronius-smart-meter.py", line 52, in init
self._dbusservice.add_path('/Serial', self._getFronisSerial())
File "dbus-fronius-smart-meter.py", line 71, in _getFronisSerial
if not meter_data['Body']['Data']['Details']['Serial']:
KeyError: 'Details'
root@raspberrypi2:/data/dbus-fronius-smart-meter#

The host ip, is the Fronius Inverter IP?

config.ini
[DEFAULT]
AccessType = OnPremise
SignOfLifeLog = 1

[ONPREMISE]
Host=192.168.1.105
MeterID = 1
intervalMs = 800
CustomName = VIR1 Fronius Smart Meter
Role = grid
#Role = acload
#Role = genset
#Role = pvinverter

Thanks for the help

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.