4 minute read

One immersion in one cylinder. OpenHAB commands a Shelly Plus 1. The Shelly pulls in a Schneider contactor. The contactor switches the element.

Do not put the element on the Shelly. The nameplate says 16 A, and a 2.5 kW element is about 11 A, so that is not the reason. The terminals are for a control circuit. This unit already reads 65 °C inside, relay off, in the hot press. Leave the cylinder thermostat and the thermal cut-out in the element circuit. The contactor must not bridge them. Get an electrician to rate the contactor for the element and for continuous duty. No coil voltage here. I do not have one recorded.

Sink and bath are labels. Both close the same relay. There is no tank probe.

The snippets are Rules DSL, names changed. A few live details are simplified, and marked.

Number ImmersionMode   // 0 off, 1 or 2 on
Switch Immersion       // Shelly output, contactor coil
Switch HouseAway
Switch CheapRate       // ON while the cheap window is open
Switch BathNight
Switch EarlyDeparture
Switch SchoolHolidays
Number InverterChargeSetpoint

HouseAway is a Switch in this sketch. Live, away is a time-of-day string. Same test. CheapRate is flipped so it reads normally. Live, that flag is on when you are outside the window. The edge is the same: water off when the cheap window ends.

Mode drives the relay. The live rule waits 500 ms before ON. Leftover from a second relay. Dropped.

rule "immersion follows mode"
when
    Item ImmersionMode changed
then
    if (ImmersionMode.state == 0) {
        Immersion.sendCommand(OFF)
    } else if (ImmersionMode.state == 1 || ImmersionMode.state == 2) {
        Immersion.sendCommand(ON)
    }
end

05:00 if the house is not away. 04:00 only on bath night or an early start, and only if the inverter is already charging above 2 kW. A positive setpoint is charge, not discharge. Away means both adults are out. Children at home do not count, so the morning boost stays off.

rule "morning immersion"
when
    Time cron "0 0 4,5 ? * * *"
then
    if (HouseAway.state != ON) {
        if (now.getHour == 4) {
            if ((BathNight.state == ON || EarlyDeparture.state == ON)
                    && (InverterChargeSetpoint.state as Number) > 2000) {
                ImmersionMode.sendCommand(2)
            }
        } else {
            ImmersionMode.sendCommand(2)
        }
    }
end

Off at the end of the cheap window. Here that is 06:00. Not at teatime. The 17:00 to 19:00 peak does not switch this load. Use your own window.

rule "immersion off when cheap window ends"
when
    Item CheapRate changed from ON to OFF
then
    if (ImmersionMode.state != 0) {
        ImmersionMode.sendCommand(0)
    }
end

Saturday is a normal morning. The long run is Sunday, and only if tomorrow is a school day. A Monday bank holiday arms it too, unless it is school holidays. Arming does not start the element. Another rule, not pasted here, turns it on from 11:00 until evening or 18:00, whichever is first. Evening is sunset minus 90 minutes, so winter ends earlier. A manual off in that window comes back after about 15 minutes unless bath night is also off.

isBankHoliday is not an OpenHAB built-in. You need your own calendar. 1 is tomorrow, 0 is today.

rule "arm bath night"
when
    Time cron "0 1 1 * * ? *"
then
    if ((now.getDayOfWeek == SUNDAY && !isBankHoliday(1))
            || (now.getDayOfWeek == MONDAY && isBankHoliday(0))) {
        if (SchoolHolidays.state == OFF) {
            BathNight.sendCommand(ON)
        }
    }
end

Manual boosts expire. Sink 40 minutes, bath 2 hours. The mode itself expires after 2 hours. That only runs while OpenHAB is up.

Number ImmersionMode { expire="2h,command=0" }
Switch SinkBoost { expire="40m,command=OFF" }
Switch BathBoost { expire="120m,command=OFF" }

rule "sink boost"
when
    Item SinkBoost received command ON
then
    ImmersionMode.sendCommand(1)
end

rule "bath boost"
when
    Item BathBoost received command ON
then
    ImmersionMode.sendCommand(2)
end

EarlyDeparture is a switch I flip the night before. Not a weather rule. The forecast is read out at bedtime. It does not command the immersion. The only hot-water effect is the 04:00 start. The same switch turns a slow charger on at 23:00. Different load.

If OpenHAB dies, the expires die with it. Auto-off on the Shelly is off, and its 04:30 schedule is disabled. A relay left on stays on. Do not enable that device schedule as a backup. It would heat every morning with nobody home. A power cut brings the Shelly back matching its switch input. Here that input is off, so it fails off. It will not start the morning by itself.

No tank temperature. If house load drops under 2400 W, a rule guesses the thermostat has opened and says so once. Not during the 05:00 boost. Fit a probe if you want to know.

Copy the split, the cheap-hour off, the occupancy check, and expires that run on the controller. Do not put a 16 A relay on the element, and do not copy 02:00 to 06:00 unless that is your tariff.