question

vikt0rm avatar image
vikt0rm asked

Shelly 1PM as PV Inverter in VenusOS

Hi community,

inspired by the dbus-shelly-3em-smartmeter from @fabian-lauer, I created my own dbus-shelly-1pm-pvinverter GitHub project to use a Shelly 1PM in VenusOS as a PV inverter. Maybe some one else find it useful.

Here are some screenshots from my current setup with these three Shelly devices (2x1PM and 3EM):

venus-os-tile-overview.pngvenus-os-remote-console-overview.pngvenus-os-shelly1pm-pvinverter-devicedetails.pngvenus-os-shelly1pm-pvinverter.png

Venus OSEnergy Metermultiple inverters
2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

brekkis avatar image brekkis commented ·

Moin Moin,


Kannst du mir (oder hier der Community) das angepasste Script zukommen lassen?

Ich habe folgendes Problem:

Setup: Multiplus 2, Raspi mit Venus OS, PV-Inverter, Shelly 1PM als Leistungsmesser an PV-Anlage, Batterie, .... alles läuft soweit.

Gestern mit dem Script hier den Shelly ins Venus-System eingebunden, leider wird der Wert der PV-Anlage als positiver "Verbraucher" angezeigt und zum Hausverbrauch (AC-loads) addiert und somit funktioniert die Einspeise-/Batterielade-/-Entladeregelung nicht.

Habe mir das Script hier mal angeschaut und würde jetzt folgende Zeilen im Script anpassen:

# send data to DBus

self._dbusservice[f'/Ac/{phase}/Voltage'] = voltage

self._dbusservice[f'/Ac/{phase}/Current'] = current

self._dbusservice[f'/Ac/{phase}/Power'] = power

self._dbusservice[f'/Ac/{phase}/Energy/Forward'] = energy / 1000 / 60

ändern zu:

# send data to DBus

self._dbusservice[f'/Ac/{phase}/Voltage'] = voltage

self._dbusservice[f'/Ac/{phase}/Current'] = (-1)** current

self._dbusservice[f'/Ac/{phase}/Power'] = (-1)** power

self._dbusservice[f'/Ac/{phase}/Energy/Forward'] = (-1)** energy / 1000 / 60


Bitte um Hilfe.


Danke und Gruß

Brekkis


**********************************english version****************************

Can you send me (or here the community) the customized script?


I have the following problem:


Setup: Multiplus 2, Raspi with Venus OS, PV inverter, Shelly 1PM as power meter on PV system, battery, .... everything is working so far.


Yesterday with the script here the Shelly integrated into the Venus system, unfortunately the value of the PV system is displayed as a positive "consumer" and added to the house consumption (AC loads) and thus the feed / battery charge / discharge control does not work.


I have looked at the script here and would now adjust the following lines in the script:

***See code upwards***

regards Brekkis


0 Likes 0 ·
brekkis avatar image brekkis commented ·

Moin Moin,


Kannst du mir (oder hier der Community) das angepasste Script zukommen lassen?

Ich habe folgendes Problem:

Setup: Multiplus 2, Raspi mit Venus OS, PV-Inverter, Shelly 1PM als Leistungsmesser an PV-Anlage, Batterie, .... alles läuft soweit.

Gestern mit dem Script hier den Shelly ins Venus-System eingebunden, leider wird der Wert der PV-Anlage als positiver "Verbraucher" angezeigt und zum Hausverbrauch (AC-loads) addiert und somit funktioniert die Einspeise-/Batterielade-/-Entladeregelung nicht.

Habe mir das Script hier mal angeschaut und würde jetzt folgende Zeilen im Script anpassen:

# send data to DBus

self._dbusservice[f'/Ac/{phase}/Voltage'] = voltage

self._dbusservice[f'/Ac/{phase}/Current'] = current

self._dbusservice[f'/Ac/{phase}/Power'] = power

self._dbusservice[f'/Ac/{phase}/Energy/Forward'] = energy / 1000 / 60

ändern zu:

# send data to DBus

self._dbusservice[f'/Ac/{phase}/Voltage'] = voltage

self._dbusservice[f'/Ac/{phase}/Current'] = (-1)* current

self._dbusservice[f'/Ac/{phase}/Power'] = (-1)*power

self._dbusservice[f'/Ac/{phase}/Energy/Forward'] = (-1)* energy / 1000 / 60


Bitte um Hilfe.


Danke und Gruß

Brekkis


**********************************english version****************************

Can you send me (or here the community) the customized script?


I have the following problem:


Setup: Multiplus 2, Raspi with Venus OS, PV inverter, Shelly 1PM as power meter on PV system, battery, .... everything is working so far.


Yesterday with the script here the Shelly integrated into the Venus system, unfortunately the value of the PV system is displayed as a positive "consumer" and added to the house consumption (AC loads) and thus the feed / battery charge / discharge control does not work.


I have looked at the script here and would now adjust the following lines in the script:

***See code upwards***

regards Brekkis


0 Likes 0 ·
18 Answers
baxter avatar image
baxter answered ·

Sir you are my hero. Exactly what i was waiting for ...

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

qualle888 avatar image
qualle888 answered ·
Hello, thank you. This works very well. Is there a way to add a 2nd and 3rd Shelly1PM as an inverter to VenusOS. Is it possible to run the script more often?

Thanks very much. Sorry for my bad English
 
                
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

vikt0rm avatar image vikt0rm commented ·

Hi @Qualle888, yes you can install more than one instances of the script. In my setup I use two instances for example.

You can copy your first instance by simply logging in to your venus os over ssh and run:

cp /data/dbus-shelly-1pm-pvinverter /data/dbus-shelly-1pm-pvinverter2

Configure the second instance and run

/data/dbus-shelly-1pm-pvinverter2/install.sh
0 Likes 0 ·
elko avatar image
elko answered ·

Hello,

can you also build something like this, e.g. to integrate the Sonoff POW device with Tasmota?

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

vikt0rm avatar image vikt0rm commented ·
Hi elko,

I don‘t have these devices you mentioned in my setup. But I guess when there is an API then it should be no problem to adapt my code to fit your needs. You can simply create a fork of my project an do your adaptions on your fork.

0 Likes 0 ·
stundenblume avatar image stundenblume commented ·
Hi @elko,

I use this MQTT-dbus driver to generate a "pvinverter" and write with Tasmota via rules into the corresponding topics.
Best regards,
Sebastian


0 Likes 0 ·
stefdewilde avatar image
stefdewilde answered ·

Do you use this with a huawei sun2000?

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

vikt0rm avatar image vikt0rm commented ·
No it is one of these blue grid tie inverter with built in power limiter that is widely used in the DIY community.
0 Likes 0 ·
stefdewilde avatar image stefdewilde vikt0rm commented ·
Oh okay. Anyway I installed my 1PM and your project and it works like a charm.


Using a Huawei Sun2000 as (second) inverter.

Thanks for the project and your time!

0 Likes 0 ·
cwaxe avatar image
cwaxe answered ·

Hello @vikt0rm,

thanks a lot for your script.
Is it also possible to install it on a Multiplus II GX?
I have tried to do that but i cannot see my Shelly 1 PM in the device list.
How can i check if the service is running correctly or where can i find the logfiles?

Thank you in advance.

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

stefdewilde avatar image stefdewilde commented ·

I have it installed on a Multiplus II GX!

Connect through it with the internal IP

The follow this: https://www.victronenergy.com/live/ccgx:root_access

Step 1 and 2. Then use Putty (common for ssh access) and login (root and your password you set) and run the script provided by viktrom. It will install.

Then use the command 'nano /data/dbus-shelly-1pm-pvinverter/config.ini ' and change the ip adress to the ip of the shelly and login if needed.

After a few seconds the device will show in your victron device list :)

0 Likes 0 ·
stundenblume avatar image
stundenblume answered ·

Hello @vikt0rm,
do you know which "dbus channels" are minimal necessary for a pvinverter to work?
I use this MQTT Devices driver to generate a pvinverter, but it won't work with a second one. VRM don't calculate the phases correctly, but replaces the first one with the second one.
Thanks, Sebastian

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

elko avatar image
elko answered ·

Hello @vikt0rm
after a restart the PV inverter kept disappearing.
What can I do?

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

elko avatar image elko commented ·
@vikt0rm 
I would be very happy if you could help me with my problem.
0 Likes 0 ·
elko avatar image elko commented ·
The entry /data/dbus-shelly-1pm-pvinverter/install.sh in the rc.local seems to be removed after a restart. The file has the permissions 777
0 Likes 0 ·
zwiebacksaege avatar image
zwiebacksaege answered ·

Hi all

as i connected my pv on acout1 as the only Device i think about using this Script and taking the acout values directly from dbus.

currently my only idea is to Grab them over mqtt from the venus. can anyone tell me if i can get them directly from dbus in this Script?

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

zwiebacksaege avatar image zwiebacksaege commented ·
got it solved by replacing the shelly Web request function with a dbus call for the ACout of the Multiplus-VEBus-Service.
0 Likes 0 ·
styrx avatar image
styrx answered ·

Would it also be possible to display individual loads instead of pv inverters with several Shelly 1PMs in the VRM?

e.g. washer, dryer, stove, oven...

unbenannt.png




unbenannt.png (51.4 KiB)
2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

zwiebacksaege avatar image zwiebacksaege commented ·
das ist sicher nicht schwer.

Für jeden Shelly einfach einen neuen Dienst mit eigener ID starten und als Typ Verbraucher anstelle von PV wählen

0 Likes 0 ·
minioh avatar image minioh zwiebacksaege commented ·
Hallo,


wo definiere ich in den Script den Typ Verbraucher?


Danke


0 Likes 0 ·
minioh avatar image
minioh answered ·

@vikt0rm

Are there already plans for Shelly Gen 2 support, e.g. Shelly 1 Plus PM or Shelly PRO? Thank you in advance.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

styrx avatar image
styrx answered ·

Unfortunately I cannot get any further and could not find the place in the script where the type is specified.

I could also imagine that the sign for a consumer must also be reversed for "/Ac/Power" and "/Ac/Energy/Forward"?

It would be ideal if it could also be specified in the config.ini whether it is a generator or a load.


Ich komme leider auch nicht weiter und konnte auch nicht die Stelle im Skript finden, wo der Typ festgelegt wird.

Außerdem könnte ich mir vorstellen, dass auch das Vorzeichen für einen Verbraucher umgekehrt werden muss bei "/Ac/Power" und "/Ac/Energy/Forward"?

Optimal wäre es, wenn in der config.ini festgelegt werden könnte, ob es sich um einen Verbraucher oder Erzeuger handelt.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

minioh avatar image
minioh answered ·

Hallo, ich habe 2 Shelly 1PM als PV Inverter eingeunden und diese werden auch sofort auf der Console und im VRM angezeigt. Allerdings fehlt bei mit im VRM und auch in der Console die Anzeige der Phase. Hier in den Beispiel Fotos werden die Phasen mit angezeigt.
Die Config Datei ist korrekt ausgefüllt. An was kann das liegen?
In der Detailansicht in der Geräteliste wird die Phase korrekt angezeigt.


===========================


Hello, I connected 2 Shelly 1PM as PV inverters and they are immediately displayed on the console and in the VRM. However, the display of the phase is missing in the VRM and also in the console. Here in the example photos, the phases are shown. The config file is filled out correctly. What could be the reason? The phase is displayed correctly in the detail view in the device list.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

styrx avatar image
styrx answered ·

Hmm... the developer vikt0rm has not been here in the forum since April. Maybe we should ask him at Github for support?


Hmm... der Entwickler vikt0rm war seit April nicht mehr hier im Forum. Vielleicht sollten wir es bei Github versuchen, ob er hier unterstützen kann?

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

styrx avatar image
styrx answered ·

I have now read something and experimented a lot.

Unfortunately, Victron does not have a load as a "servicename" (e.g. com.victronenergy.load), but only the service names specified in the D-Bus API, e.g .: com.victronenergy.charger, com.victronenergy.inverter, com.victronenergy.battery, com.victronenergy.pvinverter, ...

Depending on the service name, the paths are specified here that can be filled with values, e.g. "/Ac/Power" or "/Ac/Current" at "com.victronenergy.pvinverter".

So I tried it as a PV inverter and transmitted the values negatively. Unfortunately, however, all PV inverters are added and not listed individually, which did not lead to the desired result.

I also tried "com.victronenergy.system" and "com.victronenergy.vebus". Unfortunately without success. These service names were not listed as other independent devices.

However, I have now rewritten RalfZim's script and adapted it to my needs. So my Fronius Smart Meter is now displayed as a standalone device:

1655370352404.png


Ich habe mich nun in die Materie etwas eingelesen und viel experimentiert.

Leider gibt es seitens Victron keinen Verbraucher als "servicename" (z.B.: com.victronenergy.load), sondern nur die in der D-Bus API angegebenen service names, z.B.: com.victronenergy.charger, com.victronenergy.inverter, com.victronenergy.battery, com.victronenergy.pvinverter, ...

Je nach service name sind dann auch hier die Pfade vorgegeben, die mit Werten gefüllt werden können, z.B. "/Ac/Power" oder "/Ac/Current" bei "com.victronenergy.pvinverter".

Also habe ich es doch als PV-Inverter versucht und die Werte negativ übermittelt. Leider werden dadurch aber alle PV-Inverter addiert und nicht einzeln aufgeführt, was nicht zum gewünschten Ergebnis führte.

Ich habe mich auch an "com.victronenergy.system" und "com.victronenergy.vebus" versucht. Leider ohne Erfolg. Diese service names wurden nicht als weitere eigenständige Geräte aufgeführt.

Allerdings habe ich jetzt das Skript von RalfZim umgeschrieben und an meine Bedürfnisse angepasst. Somit wird jetzt auch mein Fronius Smart Meter als eigenständiges Gerät angezeigt:

1655370352404.png


1655370352404.png (24.8 KiB)
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

brekkis avatar image brekkis commented ·

Moin Moin,


Kannst du mir (oder hier der Community) das angepasste Script zukommen lassen?

Ich habe folgendes Problem:

Setup: Multiplus 2, Raspi mit Venus OS, PV-Inverter, Shelly 1PM als Leistungsmesser an PV-Anlage, Batterie, .... alles läuft soweit.

Gestern mit dem Script hier den Shelly ins Venus-System eingebunden, leider wird der Wert der PV-Anlage als positiver "Verbraucher" angezeigt und zum Hausverbrauch (AC-loads) addiert und somit funktioniert die Einspeise-/Batterielade-/-Entladeregelung nicht.

Habe mir das Script hier mal angeschaut und würde jetzt folgende Zeilen im Script anpassen:

# send data to DBus

self._dbusservice[f'/Ac/{phase}/Voltage'] = voltage

self._dbusservice[f'/Ac/{phase}/Current'] = current

self._dbusservice[f'/Ac/{phase}/Power'] = power

self._dbusservice[f'/Ac/{phase}/Energy/Forward'] = energy / 1000 / 60

ändern zu:

# send data to DBus

self._dbusservice[f'/Ac/{phase}/Voltage'] = voltage

self._dbusservice[f'/Ac/{phase}/Current'] = (-1)** current

self._dbusservice[f'/Ac/{phase}/Power'] = (-1)** power

self._dbusservice[f'/Ac/{phase}/Energy/Forward'] = (-1)** energy / 1000 / 60


Bitte um Hilfe.


Danke und Gruß

Brekkis


**********************************english version****************************

Can you send me (or here the community) the customized script?


I have the following problem:


Setup: Multiplus 2, Raspi with Venus OS, PV inverter, Shelly 1PM as power meter on PV system, battery, .... everything is working so far.


Yesterday with the script here the Shelly integrated into the Venus system, unfortunately the value of the PV system is displayed as a positive "consumer" and added to the house consumption (AC loads) and thus the feed / battery charge / discharge control does not work.


I have looked at the script here and would now adjust the following lines in the script:

***See code upwards***

regards Brekkis


0 Likes 0 ·
elektrowolf avatar image
elektrowolf answered ·

Mithilfe eines Freundes habe ich den Shelly Plus 1PM zum laufen gebracht. Die Rest api zu den Plus Geräten ist geändert worden. Die Doku auf Github ist allerdings noch nicht geupdatet.
https://github.com/MaKess/dbus-shelly-1pm-pvinverter

Allerdings hatte ich das Problem das der Shelly Plus sehr wärmeempfindlich ist und sich immer wieder resettet. Das heißt der Shelly rebootet mehrmals am Tag und somit der Wechselrichter auch. Ich habe im Shelly eine Auto on Timer auf 0,1s eingestellt damit ich den Wechselrichter auch bei Stromausfall sofort wieder an geht. Zusätzlich habe ich das Problem, dass der Max power protection immer wieder an geht obwohl ich es deaktiviert habe. Habt ihr beim Shelly 1PM auch Überhitzungsprobleme?

5 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

domii666 avatar image domii666 commented ·

ist das dann wirklich für den Plus PM? weil im Link ja noch alles auf das alte Skript verweist, danke dir auf alle Fälle mal! der 1 Plus PM ist deutlich besser finde ich.

0 Likes 0 ·
pau1phi11ips avatar image pau1phi11ips commented ·

This one works with the Plus 1 PM. I did intend on making the code a bit neater and submit a PR so the original code could support the 1 PM and the Plus but haven't got around to it yet.
https://github.com/pau1phi11ips/dbus-venus-mqqt-pvinverter

0 Likes 0 ·
bg30 avatar image bg30 pau1phi11ips commented ·

@pau1phi11ips: I tested your code with my shelly plus 1pm. Unfortunatly i can't see the shelly in the victron console. I find no logfile. The value in rc.local seems correctly.

0 Likes 0 ·
rittschie avatar image rittschie commented ·

Hallo elektrowolf, habe selbst versucht die "dbus-shelly-1pm-pvinverter.py" soweit zu bearbeiten das es mit der "Shelly plus 1pm" läuft. Leider keinen Erfolg. Die Parameter die z.B. http://ip_adresse/rpc/Shelly.GetStatus beim Shelly plus 1pm raushaut, unterscheiden sich leider zu sehr, als das ich dort einen Ansatz finde. Deine modifizierte dbus-shelly-1pm-pvinverter.py würde mich interessieren. Kannst Du mir diese zukommen lassen?

0 Likes 0 ·
elektrowolf avatar image elektrowolf rittschie commented ·

Der Link ist mit dem angepassten Skript:

https://github.com/MaKess/dbus-shelly-1pm-pvinverter

1 Like 1 ·
brekkis avatar image
brekkis answered ·

Moin Moin,


Kannst du mir (oder hier der Community) das angepasste Script zukommen lassen?

Ich habe folgendes Problem:

Setup: Multiplus 2, Raspi mit Venus OS, PV-Inverter, Shelly 1PM als Leistungsmesser an PV-Anlage, Batterie, .... alles läuft soweit.

Gestern mit dem Script hier den Shelly ins Venus-System eingebunden, leider wird der Wert der PV-Anlage als positiver "Verbraucher" angezeigt und zum Hausverbrauch (AC-loads) addiert und somit funktioniert die Einspeise-/Batterielade-/-Entladeregelung nicht.

Habe mir das Script hier mal angeschaut und würde jetzt folgende Zeilen im Script anpassen:

# send data to DBus

self._dbusservice[f'/Ac/{phase}/Voltage'] = voltage

self._dbusservice[f'/Ac/{phase}/Current'] = current

self._dbusservice[f'/Ac/{phase}/Power'] = power

self._dbusservice[f'/Ac/{phase}/Energy/Forward'] = energy / 1000 / 60

ändern zu:

# send data to DBus

self._dbusservice[f'/Ac/{phase}/Voltage'] = voltage

self._dbusservice[f'/Ac/{phase}/Current'] = (-1)* current

self._dbusservice[f'/Ac/{phase}/Power'] = (-1)*power

self._dbusservice[f'/Ac/{phase}/Energy/Forward'] = (-1)* energy / 1000 / 60


Bitte um Hilfe.


Danke und Gruß

Brekkis


**********************************english version****************************

Can you send me (or here the community) the customized script?


I have the following problem:


Setup: Multiplus 2, Raspi with Venus OS, PV inverter, Shelly 1PM as power meter on PV system, battery, .... everything is working so far.


Yesterday with the script here the Shelly integrated into the Venus system, unfortunately the value of the PV system is displayed as a positive "consumer" and added to the house consumption (AC loads) and thus the feed / battery charge / discharge control does not work.


I have looked at the script here and would now adjust the following lines in the script:

***See code upwards***

regards Brekkis


2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

hias0815 avatar image
hias0815 answered ·

Hello, i noticed a rather interesting "Bug" If i switch of one of my Shellys to off. The last amount of Power wich was send to the grid is frozen in the Venus OS. Also if i switch the shelly on aggain. Workarround is to reboot the cerbo, then everything is fine again.
Do you have any solutions?

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

pau1phi11ips avatar image pau1phi11ips commented ·

Hi, you should be able to run this to restart it without having to reboot the Cerbo

/data/dbus-shelly-pvinverter/restart.sh

I'm not sure how you'd automate that though.

0 Likes 0 ·
houser avatar image
houser answered ·

Hello,

This is interesting, but I don't get the concept, as my German is not what it should be, but I have extensive knowledge from Shellies of various kinds and have meny working in my installs. So what exactly do these Shelly PM1 do in this setup? Just concept wise basic in a sentence or two? Curious..

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

hias0815 avatar image hias0815 commented ·
They measuring the power which is produced by the (any brand/not native supported)solar inverter and sent it to the cerbo
1 Like 1 ·
houser avatar image houser hias0815 commented ·

So just as a power meter then? That part I get. It said something about as a "PV inverter". Ah well. Thanks!

0 Likes 0 ·