Trigger an automation using a comparison

Hi there
I’m trying to wrap my head around automations (using the UI if possible). I’m trying to automate our hot water cylinder so it either uses Solar (if there is enough to go around) or is off until the ‘off peak’ rates kick in (eg: stop me manually switching it between Day and Night mode)

Here’s the idea:

  • Check at 3:30pm if 1) the Battery is greater than 90%, 2) the current solar production is greater than 3500w and 3) the current load is less than 3500w. If Yes, turn on the Hot Water Cylinder & set input_booleanToggle for isHotWaterOn to true [I have this one working]
  • Assuming now the hot water cylinder is on I want to now:
  • Constantly evaluate the current load vs the current solar production, if the load becomes greater than the solar production, turn the Hot Water Cylinder off & set the boolean to false.

Here’s the scenario:

  • Bright clear sunny day
  • Kids come home from school, and have afternoon showers (eg: some time from 4pm through 6pm)
  • I want the Hot Water to reheat using the solar
  • However we’re often also starting to cook dinner at the time the kids are showering, the oven or induction hob will then be on, with the Hot Water Cylinder and this will no doubt draw more power than the solar is producing at this stage in the day - so we should turn off the HWC
  • The HWC can then be turned on after midnight where it can reheat either using battery power OR (invariably AND) grid - but at the lower night rate. (this bit is a simple time automation - I have that working)

I’m really struggling to see how to have a constantly running automation that is checking the Solar to Load comparison - how do I do this?

Why don’t you create a template binary_sensor for * Constantly evaluate the current load vs the current solar production, if the load becomes greater than the solar production, turn the Hot Water Cylinder off & set the boolean to false. and use this as a trigger for your automation?

1 Like

Thanks @merwone …I’m so new to all this :slight_smile:

I’ll give that a go - it sounds like it might work for me

trigger:
  - platform: numeric_state
    entity_id: sensor.solar_production
    below: sensor.current_load
    for: "00:05:00"
condition:
action:
  - service: switch.turn_off
    target:
      entity_id: switch.whc
  - service: input_boolean.turn_off
    target:
      entity_id: switch.ishotwateron
1 Like

@Didgeridrew that’s awesome - thank you