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 ·
Show more comments
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 ·
Show more comments
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 ·
Show more comments
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 ·
Show more comments
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 ·
Show more comments
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 ·
Show more comments
huit avatar image huit commented ·

Just commenting to say I got this working on a cerbo gx. I replaced two references to the inverter device in the dbus_inverter_ctrl.py file.

"com.victronenergy.vebus.ttyO5" => "com.victronenergy.vebus.ttyS4"

I just ran the raspberry pi (cortex A7) installer and modified the copy that gets installed into /opt/victronenergy/. It would be handy to have a custom installer but i haven't used bitbake before so this will do for now.

Thanks @osaether for sharing!

0 Likes 0 ·
bigbadbob76 avatar image bigbadbob76 huit commented ·

Hi @huit and @osaether I need to do some mods to dbus_inverter_ctrl.py too. (I need to use ttyUSB1)

I tried copying it out of it's folder (using filezilla) after installing it, modifying it and copying it back where it belongs, then making it executable using chmod 775, but python doesn't compile it automatically.

I have edited .py files on venus like this before and it has usually automatically compiled the the .py file as a .pyc file the first time it is run after copying back. but not this time. :-(

I have tried compiling it using py_compile /opt/victronenergy/dbus-inverter-ctrl/dbus_inverter_ctrl.py but it throws me an error.

Can you advise if that's the way you did your edit and how did you compile it?

Cheers.

Bob.

0 Likes 0 ·
huit avatar image huit bigbadbob76 commented ·

I just edited it in place using vim probably in a secure shell. As such I didn't change permissions or anything. I imagine you can just match the permissions / ownership it is installed with. You shouldn't need to compile anything, the python interpreter will make a compiled version (e.g. bytecode file, .pyc) if it wants to when it runs it for the first time. Are you sure it is being called in the first place?

FYI don't have it working right now as it broke on firmware upgrade and I haven't had time to work out a fix and didn't want to roll back.

0 Likes 0 ·
bigbadbob76 avatar image bigbadbob76 huit commented ·

Thanks @huit

Yes, as you say I expected the interpreter to make a compiled version the first time.

I'll check that it is actually being called but it was before I edited the tty port.

more investigation needed my end. cheers for your help. :-)

I'm using venus v2.66 so I'm hopeful it will work and I can then edit it it to change from "on" to "Invert only" depending on MPPT state.

0 Likes 0 ·
Show more comments
bigbadbob76 avatar image bigbadbob76 commented ·

Hi Osaether.

This looks like it would help me in a project to improve solar priority.

I have been trying to get venus (on a pi) to switch inverter mode based on solar charger state.

Your service should help me there I think.

Thanks for your work.

Bob.

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

Hello everyone, I had this service working but after updating my Venus GX OS to v2.82, and now when I attempt to re-install the ipk, I get the following error shown below.

Does anyone know how to correct this?

Thanks for any help

Joe

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

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 ·
Ole Saether avatar image Ole Saether commented ·

Hello!
Today I updated the repo for Venus v3.0. Installers for Venus GX and Raspberry PI 2 under Releases in the repo above (please star the repo if you like it :-)

I have also created a repository with the Bitbake recipe in case you want to create an installer for different hardware:
https://github.com/osaether/meta-dbus-inverter-ctrl

0 Likes 0 ·

Article

Contributors

_OS_ contributed to this article