article

Ole Saether avatar image
Ole Saether posted

Service to turn Multiplus on/off via digital input

EDIT: Edited for Venus v3.0x. See below

A frequent requested feature of mine (and others on forums discussing off gird systems) is a means to turn on or off the MultiPlus with a switch. With a stand-alone Multiplus you can connect an external switch but when the Multiplus is connected to a CCGX or VGX the external switch does not work and you have to dig deep into the remote console to turn the Multiplus on/off.

I have created a service that monitors a digital input and when it goes from high to low it turns the Multiplus ON if is is OFF and OFF if it is ON.

I had to create a new digital input type: #12, "Inverter control".

Below is a link to the python service repository. Patches for the gui-files and dbus-digitalinputs service can be found in the "diffs" folder. Under releases there are prebuilt installers for Venus GX and Raspberry PI.

https://github.com/osaether/dbus-inverter-ctrl.git

For those of you that want to build it, here is the Bitbake recipe with instructions:

https://github.com/osaether/meta-dbus-inverter-ctrl

Use at your own risk!

Ole

cerbo gxVenus GX - VGXRaspberry Pi
66 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.

Ole Saether avatar image Ole Saether commented ·

Tried this on 2.30~39 today and it does not work as expected. I get python errors when writing to the dbus so there must have been a change in dbus lately. I will get back when I have figured it out.

0 Likes 0 ·
Ole Saether avatar image Ole Saether Ole Saether commented ·

Issues fixed now and repo updated.

0 Likes 0 ·
Ole Saether avatar image Ole Saether commented ·

I tried it out his weekend and it works very well. See video below. This feature is most useful for off-grid systems where the zero load power of the inverter will drain the batteries in the winter months where we have no or very little sun.

Your browser does not support HTML5 video.

0 Likes 0 ·
Elimac avatar image Elimac Ole Saether commented ·

Will it be possible also to change to "Charger mode" remotely?

0 Likes 0 ·
Ole Saether avatar image Ole Saether Elimac commented ·

Hi, yes that would be possible but in the repo above it is ON/OFF.

0 Likes 0 ·
Bob (Victron Energy Staff) avatar image Bob (Victron Energy Staff) ♦♦ Ole Saether commented ·

Hi,

did you already know the 'safety switch' assistant in the MultiPlus? It can be used driven by an Aux input of the Multi (and as this Aux input can also be wired to the Venus relay you can even switch remotely -> watch out where you power the Venus device from);

Regards,

Bob

0 Likes 0 ·
1554807349096.png (41.5 KiB)
Mark avatar image Mark ♦♦ Bob (Victron Energy Staff) ♦♦ commented ·

My understanding is that the 'safety switch' assistant ONLY switches off the AC output & NOT the actual inverter, accordingly there will still be a stand-by current/power draw of >20W, which is the primary reason for wanting to fully switch off the unit.

0 Likes 0 ·
1554864442278.png (50.1 KiB)
Ole Saether avatar image Ole Saether Mark ♦♦ commented ·

Yes that is why I did it like this. I want to turn off the Multuplus. Same behavior as in the GUI. See below.

0 Likes 0 ·
multi2.jpg (38.5 KiB)
multi1.jpg (45.0 KiB)
vicrvusr avatar image vicrvusr Bob (Victron Energy Staff) ♦♦ commented ·

A note to Bob (Victron Energy Staff): Another reason why this alternate method of switching the Multiplus on and off is important is the Safety Switch assistant cannot be used in conjunction with the Li-Ion BMS assistant, as documented in the assistant itself:


You can guess what kind of batteries I have...

0 Likes 0 ·
capture.jpg (16.4 KiB)
permariusteigen avatar image permariusteigen Ole Saether commented ·

Thank you. This is the one I've been waiting for, to get the power system on the offgrid cabin that I want it. Needed to get the WAF (Wife acceptance factor) too. :)


And thanks to Espen (cabin neighbor) who helped me with the setup.

0 Likes 0 ·
Ole Saether avatar image Ole Saether permariusteigen commented ·

Your'e welcome!


Is your cabin in Norway?

0 Likes 0 ·
permariusteigen avatar image permariusteigen Ole Saether commented ·

I live on spitsbergen. And have a cabin up here too.

0 Likes 0 ·
joe-d avatar image joe-d Ole Saether commented ·

Hello Ole,

I really need this mod but am new to adding services to my Venus. Is there a tutorial or a step by step procedure you can point me to on how to add this service to my Venus? I am an engineer but just new to programming this type of device. Thanks Joe

0 Likes 0 ·
Ole Saether avatar image Ole Saether joe-d commented ·

Hi Joe,


I have not updated this in a while but I think it should work on the latest Venus release.

But please note that I have only tested this in my system with a Venus GX and a Multiplus 24/3000. Use at your own risk!

You can find an installable file here:
https://github.com/osaether/dbus-inverter-ctrl/releases/tag/v0.8

For Venus GX you need the file with "8hf" in the name.

To get the file into your Venus device there are a few methods. The simplest way is to log into your Venus device with SSH and download it directly from github with this command:

wget https://github.com/osaether/dbus-inverter-ctrl/releases/download/v0.8/dbus-inverter-ctrl_0.8-r0_cortexa8hf-neon.ipk


Then install it using this command:

opkg install dbus-inverter-ctrl_0.8-r0_cortexa8hf-neon.ipk


That's it. The service will start automatically.

0 Likes 0 ·
joe-d avatar image joe-d Ole Saether commented ·

Hello Ole, Thanks so much for this Newbie :-)

I have the same Venus GX and the similar Multiplus 12/3000, so i should be ok.

When i first installed this and it appeared on my Venus digital input settings but when i select it, the bullet is selected momentarily but "Input one" stays at the last selected input (disabled), also "inverter Control" does not seem to work (when i GND pin 1). Then I edited /data/conf/settings.xml file and changed the type to 10 (as you described to Espen previously). Now the Inverter Control setting sticks. But now I get a fault when my shore-power is connected " AC-Input: Not available" . If shore-power is disconnected, all is normal (also appears than Grounding pin 1 does nothing). Also, not sure how the pulse meters work, but they do not change when inputs are grounded)


0 Likes 0 ·
Ole Saether avatar image Ole Saether joe-d commented ·

Hi Joe,

Clicking the bullet does nothing. I tried to get rid of it in the GUI but I have not spent much time on that. If you want to control your Multiplus from the GUI then you don't need my module: Just click on the Multiplus in the menu and select Switch->On.

I don't know why this module don't work when shore-power is connected. I have used it with a generator without problems.

I am sorry. but I don't know anything about pulse meters. Please note that my module triggers on the edge from high to low (gnd). Wiring it to GND permanently will not work.

0 Likes 0 ·
joe-d avatar image joe-d Ole Saether commented ·

I want to control the Inverter On/OFF via a momentary contact closure, so I would like to get your module to work. I think the muliplus issue is unrelated which I will look at. For my info, is there a way, to go back to the original Victron GX version (i.e. back-out your mod in case i did something wrong)?

0 Likes 0 ·
Ole Saether avatar image Ole Saether joe-d commented ·

yes, you can uninstall it by logging into your Venus and run this command:


opkg remove dbus-inverter-ctrl


0 Likes 0 ·
joe-d avatar image joe-d Ole Saether commented ·

Hi Ole, its working perfectly! I can now turn the inverter off and on from a key fob :-). Thanks so much for posting this and the help to get there.

Joe

0 Likes 0 ·
joe-d avatar image joe-d joe-d commented ·

Hi Ole, Venus has a new OS v2.62 today. If I upgrade the Venus firmware, Could i potentially loose this feature and have to redo? If so, i would i fix this? Thanks

0 Likes 0 ·
joe-d avatar image joe-d Ole Saether commented ·

Hi Ole, Venus has a new OS v2.65. I have v2.60 installed now and your mod works great. If I upgrade the Venus firmware, could I potentially loose this feature and have to redo anything? If yes, what would I need to change to fix operating with 2.65 and allow future upgrades w/o changes? Thanks

0 Likes 0 ·
Ole Saether avatar image Ole Saether joe-d commented ·

Hi Joe,


Yes, you need to install it again after upgrading to v2.65. You don't need to change anything, just run the installer again.
I can't speak of future upgrades but I will update the script if needed.

/Ole

0 Likes 0 ·
joe-d avatar image joe-d Ole Saether commented ·

Hello Ole

It looks like script does not work with the latest OS2.81 (3 Feb). Can you verify for me? and if so, can you update it?

Thanks

Joe

0 Likes 0 ·
joe-d avatar image joe-d Ole Saether commented ·

I am running Venus OS 2.82 and i get the following after i try to install the script:

Any ideas?

-------------------

root@beaglebone:~# opkg install dbus-inverter-ctrl_0.8-r0_cortexa8hf-neon.ipk

Collected errors:

* Solver encountered 1 problem(s):

* Problem 1/1:

* - nothing provides python-dbus needed by dbus-inverter-ctrl-0.8-r0.cortexa8hf-neon

*

* Solution 1:

* - do not ask to install dbus-inverter-ctrl-0.8-r0.cortexa8hf-neon

root@beaglebone:~#

0 Likes 0 ·
joe-d avatar image joe-d joe-d commented ·

can anyone help?

0 Likes 0 ·
Rune Eilertsen avatar image Rune Eilertsen commented ·

If was on when input is high, and inverter off when input is low would help more.

Because else you need som feedback to know if you turn the inverter on or off.

Then also bms and other security switch would benefit as well.

0 Likes 0 ·
Ole Saether avatar image Ole Saether Rune Eilertsen commented ·

Hi @Rune Eilertsen Yes that is easy to change but I prefer a momentary push-button for my application. In the button in the video above the light is wired to the AC out of the inverter.

I will update the example so that this can be configured. When I have time...

1 Like 1 ·
espen avatar image espen commented ·

Hi Ole,

This is a long awaited feature. Unfortunately, I don't get it to work.

On “Digital Input 1”, when I select “Inverter Control”, it goes back to “Disabled”.

The service “dbus-inverter-ctrl” is up and running, and the Multiplus is on tty05.

(My push-button on the digital input 1 is also confirmed to work, as when input1 is set to pulse-meter it counts the pulses.)

/Espen

0 Likes 0 ·
Ole Saether avatar image Ole Saether espen commented ·

Hi @Espen. I am suspecting that I have not got the Type settings correct. If you are comfortable editing files on your Venus, stop the inverter-ctrl service:

svc -d /service/dbus-inverter-ctrl

Edit the file /data/conf/settings.xml and scroll down to <Digitalinput> and find the <_1> section and change the Type to 10:

<Type default="0" max="10" type="i" silent="False" min="0">10</Type>

Save the file and exit, then reboot your Venus.

0 Likes 0 ·
espen avatar image espen Ole Saether commented ·

Hi Ole,

Thank you. I can confirm that the settings is working now.

I'll go to the cabin later today to also check the powerbutton on the venus .

/Espen H

0 Likes 0 ·
espen avatar image espen espen commented ·

Hi,

I can confirm that it’s working now!

Thank you so much Ole :)

/Espen

0 Likes 0 ·
joe-d avatar image joe-d espen commented ·

what does "Multiplus is on tty05" mean?

Thanks

0 Likes 0 ·
vicrvusr avatar image vicrvusr commented ·

Hi, I'd like to install this on an rpi running venus os. I found out the image hasn't been made for the rpi. I'm lost as to how to go about building or manually installing it. I can manually edit the patches in easily enough, but don't know where to go from there. Please be kind to me as I'm pretty new at Yocto and the Victron-specific stuff.

Thanks in advance for any help, this will help my WAF of my install with the Multiplus greatly!.

0 Likes 0 ·
Ole Saether avatar image Ole Saether vicrvusr commented ·

Hi! I have now built an installer for rpi and uploaded to github. It's the file, dbus-inverter-ctrl_0.6-r0_cortexa7hf-neon-vfpv4.ipk here:

https://github.com/osaether/dbus-inverter-ctrl/releases/tag/v0.6


You will probably have to change the digital input pin in the scripts.

0 Likes 0 ·
vicrvusr avatar image vicrvusr Ole Saether commented ·

Thanks! Yes, I suspect I'll have to change the inputs, I could not find any kind of mapping from Rpi to the Venus GUI's input number so I'll just play with them on the bench until I find one that switches in the GUI and use that one. Getting another Rpi just in case I'm too fumble fingered...

0 Likes 0 ·
vicrvusr avatar image vicrvusr Ole Saether commented ·

It's working on the Pi now! Thanks very much for writing this and supporting us!

I was able to use the same input however I did have to correct the type settings from your reply to Espen above. The Multiplus address changed since it was on a USB port. Once I fixed that it worked like a charm! I also changed the off mode to charge only (replaced the 4 with a 1 in two places in the python service script).


For reference here's a chart of the Rpi inputs used by the Venus OS, I used pin 29, pulled it low and reversed the polarity in the inverter control setup, though that may not have made any difference:

Rpi Pin # GPIO # Device Instance Normal state
37 26 5 low
35 19 4 low
33 13 3 low
31 6 2 high
29 5 1 high
1 3V3 pull low pins hi thru 10k
39 GND pull hi pins low thru 10k
0 Likes 0 ·
espen avatar image espen commented ·

Hi Ole,

I did see in your release notes that you removed "inverter control" from the mainpage. (over to service?)

But I have it still on the main page.

0 Likes 0 ·
Ole Saether avatar image Ole Saether espen commented ·

Hi @Espen I checked and you are right. I will try to figure out another way to do this. I was gone in some earlier versions of Venus.

0 Likes 0 ·
Ole Saether avatar image Ole Saether commented ·

This service does not work with Venus v2.30~50. I don't know why yet. Reverting back to Venus 2.30~47 and it works. We need to wait for the ~50 release notes from @mvader (Victron Energy Staff) to see if there is a change related to this. Maybe they changed how the digital inputs work?

0 Likes 0 ·
Ole Saether avatar image Ole Saether Ole Saether commented ·

The Venus 2.30~50 release notes are out now and there are no changes related to this. Despite that, this service is working fine on ~47 but not on ~50. I will try to debug it but my impression is that Victron don't want us to create custom services. Given the lack of feedbcak from Victron in this thread.


0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ Ole Saether commented ·

Hi @osaether, . Found and fixed now; in v2.31~2 test version at this moment.

Sorry for not recognising this sooner and thanks for reporting

0 Likes 0 ·
Ole Saether avatar image Ole Saether mvader (Victron Energy) ♦♦ commented ·

I tried v2.31~2 now and the digital input works as expected. Thanks!

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ Ole Saether commented ·

Ps. You wrote:

> I will try to debug it but my impression is that Victron don't want us to create custom services.

Not at all. I think its an honour that people like you spend so much time building on top of our work.

The lack of response sometimes is that its difficult to debug / help with software not under our control. And a lack of time. Also for me there is only 24h in a day.

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ Ole Saether commented ·

Ps2: next time, be aware that for digital inputs (and lots of other things in Venus OS); you can see all changes here: https://github.com/victronenergy/meta-victronenergy/commits/master


The commit making the bug is in there (quite far down) and the fix is now the second last from the top.


You’ll see v2.40 there. To understand v2.31; read the “maintenance releases” chapter in the readme in the venus repo.

Thanks


0 Likes 0 ·
kvittern avatar image kvittern commented ·

Hello,

Is this still working with Venus OS 2.60.

Installed it successfully, but when I’ll try to choose inverter under digital input, it reverts back to disable. I also tried to do the change to the settings.xml file (0-10) as described in an other comment here.

Any idea?


Regards Rune

0 Likes 0 ·
vicrvusr avatar image vicrvusr kvittern commented ·

Confirmed, this broke upon upgrade to 2.60. Also reinstalled the service (opkg --force-reinstall) with no change. Fortunately there is an option to boot into the backup version (I had 2.33) which restored the switch operation. Thanks, devs, as that kept DW happy!

0 Likes 0 ·
vicrvusr avatar image vicrvusr vicrvusr commented ·

Resolved the issue with 2.60, at least the one I had. The install script changes /opt/victronenergy/dbus_digitalinputs.py and it was not changed when I forced the install script to run again. To resolve I manually edited the file and applied the changes in dbus_digitalinputs.diff which is in osaether's github repository here.


There are also several .qml files that the install script changes so all should be verified, they are located in /opt/victronenergy/gui/. The diff files are the first three files here.

Hopefully this will help you @Kvittern.

0 Likes 0 ·
bathnm avatar image bathnm commented ·

@osaether, Can I ask a couple of questions on this. Is this designed to be be used with a MOM switch connected to the digital input or an on/off switch?

Looking at your code the last change you made was to the line

if int(value["Value"])==3:

You changed the value from 3 to 2. What does teh value 2 mean?

0 Likes 0 ·
Ole Saether avatar image Ole Saether bathnm commented ·

Hi @Bathnm yes, it is designed to be used with a MOM switch. You can use it with a ON/OFF switch as well but then you need to modify the script so that it reads the switch continuously to keep the inverter and switch in sync. With a MOM switch you can turn off the inverter elsewhere and turn it on again with the MOM switch. You cannot do that with an ON/OFF switch.

I changed the value from 3 (switch = ON) to 2 (switch = OFF) such that the inverter turns on when you release the button.


0 Likes 0 ·
bathnm avatar image bathnm Ole Saether commented ·

@osaether, Thank you great explanation why a MOM is better than switch, had not thought about ANO situation switching it off and then being out of sync. I suspect that is the issue with the VE.Bus BMS and why the mode capability is disabled on VenusOS and why a DMC is required.

Out of interest why did you'd decide to react to the off rather than on?

0 Likes 0 ·
Ole Saether avatar image Ole Saether bathnm commented ·

@Bathnm When the script reacted on "ON" it sometimes did not turn on. I guess this is because the switch generates ripples. With reacting on "OFF" it works every time with the switch I have.

0 Likes 0 ·
bathnm avatar image bathnm Ole Saether commented ·

@osaether, Is your MOM a close or open when pushed. Just trying to get my head around the logic. With a standard MOM, there would be a circuit until it is pushed, on pushing it would open the circuit and then remake on release. Therefore my logic, and have not tested says that pushing the button should trigger and off and releasing trigger an on. Have I missed something?

0 Likes 0 ·
Ole Saether avatar image Ole Saether bathnm commented ·

@Bathnm This is the switch I use:
https://www.ebay.com/itm/302775850762?ViewItem=&item=302775850762

Are you having trouble getting my script to work?


0 Likes 0 ·
bathnm avatar image bathnm Ole Saether commented ·

@osaether, I am remote from my system at the moment, so just reading the code and trying to work out how it all works. Looks like the switch can be wired to both make the circuit and break the circuit when it is pushed. In a few weeks time I'll be on the boat again and will play and debug.

0 Likes 0 ·
espen avatar image espen commented ·

Hi Ole,

Have you tried to do the same thing with node red?

0 Likes 0 ·
espen avatar image espen espen commented ·

I did a setup for this in Node-Red, and got it working.

It's my first time I've tried Node-Red, so not sure if this is the correct/best way to do it.

Here is the code (to many characters to insert here): penyacom.org/p?q=VnBEdkw

0 Likes 0 ·
am48293 avatar image am48293 espen commented ·

Hi espen,

Could you possibly repost that scritp - i belive it expired

0 Likes 0 ·
Ole Saether avatar image Ole Saether espen commented ·

Hi Espen,
No I have not tried this with Node-Red.

0 Likes 0 ·
Show more comments

Article

Contributors

_OS_ contributed to this article