Assistant coding question

I have a victron multiplus 2.
I am trying to write the code so that AC2 out provides power whenever AC1 in has shore power OR whenever the aux input is closed. Obviously, I would still like power out when I have shore power AND the aux switch is closed.

I can write the code for the aux switch, but then the AC2 relay doesn’t automatically switch when shore power is connected.

I can write the code for the shore to switch the AC2 relay on, but the it ignores the aux switch.

Can anyone help by suggesting the correct code so that I can switch the AC2 relay on and off using shore power and/or the aux input?

Combining multiple Assistants

Multiple Assistants can be used in one unit. For example the Programmable Relay is often used multiple times. When doing so; this is how they are evaluated:

- an ON condition always has priority over an OFF condition - multi criteria in the ON ( or OFF ) list go by the OR principle

Since you want an OR relation between the two inputs, you need at least three relay assistants, two to set the relay to on, and another to set it to off.

This should do the trick. First assistant sets the relay on when the ACin is available, OR second assistant set the relay on when the aux1 is closed, OR third assistant sets the relay off when both ACin is not available and Aux1 is open.

OR and AND relationships are not that obvious in the assistants, and its been a while since i last used one, so its possible that this also doesnt work as you wish.

Thanks, I will test it out this coming weekend.

Can anyone else confirm that this should work, or maybe offer any alternative solutions?

The explanation of the AND and OR is clear and logical.

Unfortunately, the three assistants don’t want to play to the same logic.

When set up exactly as you stated, I need both ac coming in and the aux switch set to on to get ac2 out.

It seems that everything is working to AND logic only!

Any ideas, please?

If you want to run AND (two need to be true) then combine the two conditions in one assistant.

On is always prioritised over off. So if any 1 of the on is true in the separate list, it will be on.

AC2 is automatically on or off depending on availability of ac in.

Just write one assistant for the aux option. It must have an on and an off assistant for that

I want to run OR for the ON function (hence 2 assistants) and AND for the OFF FUNCTION (combined in one assistant), as per the earlier code.

But however I try, I cannot produce the result I am looking for.

You state that Ac2 is always on when shore power is connected. Not true - as soon as I add an assistant to switch on ac2 via the aux1, it stops / overrides the automatic control of ac2 by the shore power.

Check out the code provided in the second reply. Do you agree that it should work? It meets the AND and OR requirements, but it simply doesn’t work.

The order of the assistants in the list also matter, so maybe try to move them up and down in the list.

Also try to do it step by step, only adding one condition → test → add another condition → …

(the one from chirgri) Your third one for the off condition both have to be true for it to be off. In other word if it is alreaady on, then it will just be on and not change state.

Add one for on if ac… One for off if ac…

Then add your aux for on condition. (Possibly you may have to move it up the list to above the off for ac not available.) Like suggested, maybe not.

It is very simple programming. Very easy to overcomplicate and then mess up the logic. There is no reasoning like in our heads.

Yes the third assistant is exactly as I want it.

I want EITHER condition (shore power OR aux 1) to switch on ac2. I want BOTH conditions (shore power removed AND aux1 off) to switch Ac2 off.

I believe the provided code should do this. But it doesn’t.

If I just add a single assistant to switch Ac2 on when aux1 closes, this works. But then shore power input doesn’t switch on ac2.

When I add two assistants, one for shore power on and the other for aux1 (which as 2 separate assistants means OR), both have to be on to activate ac2.

Is the logic wrong in my head, or is there an issue with the assistants and the ac2 relay?

I havent had an issue and used AUX to override ac2 out before, but these days use node red more for programming.

Is this with the ac2 on assistant as well?