Making my Azorra ACE 200 smart

Hi All,

Normally I can find all my answers on the forum here, but now I have a challenge. I have a somewhat smart water heater, it has some smart grid connections which I want to use when my solar panels are active. The smart grid option consists of 4 modes selected by 2 inputs:

connection D.I1 and D.I2,
When both D.I1 and D.I2 are inactive - Normal: the heater operates “normal”. Comfort up to 55 celsius
D.I1 Active, D.I2 inactive - Off: The heater turns off
D.I1 inactive, D.I2 active - Economy: The heater heats up to 65 celsius without backup element
D.I1 and D.I2 both active - High Economy: The heater heats up to 75 celsius with electrical backup element.

I have connected a board with 4 relay switches (I only have to use two but this was the only one who suited my needs) and have configured this board in HA so there are 4 switches available. I can put the heater in the desired mode by selecting each switch manually.

I created a “virtual switch” for High Economy and this seems to work, this is my config:

switch:
  - platform: template
    switches:
      copy:
        friendly_name: "High Economy"
        turn_on:
          - service: switch.turn_on
            target:
              entity_id: switch.4_433_schakelaar_1
          - service: switch.turn_on
            target:
              entity_id: switch.4_433_schakelaar_2
        turn_off:
          - service: switch.turn_off
            target:
              entity_id: switch.4_433_schakelaar_1
          - service: switch.turn_off
            target:
              entity_id: switch.4_433_schakelaar_2

This works, but doesn’t get updated when I switch one of the switches manually.

Idealy I want to create a selector switch to switch between the modes for the water heater, Is this something which could be done in configuration.yaml and how would I setup something like this ?

In the future I want to automate the different states based on the power I am feeding back to the grid from my solar panels. So when I am producing energy I want to select one of the heater modes, or turn of the heater when there is no solar production.

I hope anyone has some Ideas on how to configure this.