#Automation problem - inconsistent control of hot water thermostat with a Shelly Switch

1 messages · Page 1 of 1 (latest)

topaz meteor
#

Hi everyone! First ever post for me. In short, I've had HA running at home for about 5 months but haven't done much with it. I've got a Shelly switch connected to it with 3 digital temperature sensors to monitor water temperature top and bottom of roof mounted solar hot water service and roof cavity temperature. Thankfully the 'switch off' automation for the switch appears to work consistently but the turning on the switch to match to conditions I'm trying to articulate isn't working consistently. (My wife absolutely HATES cold showers in the morning so I need to get this right! 🥶 ) Can someone tell me what I'm doing wrong and how I can fix it. I get access to 'off peak' power between about 1am to 7am so all I want the automation to do is turn the switch on if the thermostat temp sensor is at or below a certain temperature (50 degrees) between the hours of say 2am to 7am. I'm Happy for a YAML solution if that's easiest for someone out there too. Thanks in advance for help 😃

Also, I'm a pretty time poor guy but keen to learn so if anyone can recommend bite sized automation training projects they've found good value when getting started, happy for recommendations! I possibly just need to invest more time as it's all probably right under my nose but I haven't seen it yetmindblown !!

safe plaza
rustic iglooBOT
#

@topaz meteor To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

topaz meteor
# safe plaza Can you post the yaml of the automation in a code block?

Sure! Here it is:

'''
alias: Hot Water On with temp
description: >-
Turns on the Shelly Switch if the temperature sensors allow based on rules
below
triggers:

  • type: temperature
    device_id: 91aa9cac0233bbc0db9cac6876932e4f
    entity_id: 33e35bb44be3587c04471af4912ffe62
    domain: sensor
    trigger: device
    below: 50
    conditions:
  • condition: and
    conditions:
    • condition: time
      before: "07:00:00"
    • condition: time
      after: "02:00:00"
      weekday:
      • sun
      • mon
      • tue
      • wed
      • thu
      • fri
      • sat
        actions:
  • type: turn_on
    device_id: 91aa9cac0233bbc0db9cac6876932e4f
    entity_id: cb705a2b1c1916f0a232038563873fd8
    domain: switch
    mode: single
    '''
safe plaza
safe plaza
#

you are not using backticks

topaz meteor
# safe plaza put 3 backticks on either side of the code. This symbol: ` ``` then it will look...
alias: Hot Water On with temp
description: >-
  Turns on the Shelly Switch if the temperature sensors allow based on rules
  below
triggers:
  - type: temperature
    device_id: 91aa9cac0233bbc0db9cac6876932e4f
    entity_id: 33e35bb44be3587c04471af4912ffe62
    domain: sensor
    trigger: device
    below: 50
conditions:
  - condition: and
    conditions:
      - condition: time
        before: "07:00:00"
      - condition: time
        after: "02:00:00"
        weekday:
          - sun
          - mon
          - tue
          - wed
          - thu
          - fri
          - sat
actions:
  - type: turn_on
    device_id: 91aa9cac0233bbc0db9cac6876932e4f
    entity_id: cb705a2b1c1916f0a232038563873fd8
    domain: switch
mode: single
safe plaza
# topaz meteor ``` alias: Hot Water On with temp description: >- Turns on the Shelly Switch i...

Ok I think I see the issue:
your trigger only fires when the sensor goes from above to below 50 so if it is already below 50 when your time condition becomes correct it doesnt fire unless it would go up and down again.

probably the easiest solution here is to change your trigger to trigger on every change of the sensor by removing the below 50.
then add a condition instead which checks if the temp is below 50.
you could also add a 2nd trigger to run in a time pattern every 5 minutes or something to ensure its constantly checking.

#

other notes:
on the 2nd time condition, if you are triggering every day you dont need to include weekdays as without it specified it will trigger on all days.

you also don't need to and the 2 conditions in this context because conditions are anded by default.

topaz meteor
safe plaza
topaz meteor
topaz meteor
# safe plaza Yup, No worries.

I've edited in the simple automation area (no YAML) and following is what I've got now. Note that there is now no trigger so can this still work?

description: >-
  Turns on the Shelly Switch if the temperature sensors allow based on rules
  below
triggers: []
conditions:
  - condition: and
    conditions:
      - condition: time
        before: "07:00:00"
      - condition: time
        after: "02:00:00"
      - type: is_temperature
        condition: device
        device_id: 91aa9cac0233bbc0db9cac6876932e4f
        entity_id: 33e35bb44be3587c04471af4912ffe62
        domain: sensor
        below: 50
actions:
  - type: turn_on
    device_id: 91aa9cac0233bbc0db9cac6876932e4f
    entity_id: cb705a2b1c1916f0a232038563873fd8
    domain: switch
mode: single
safe plaza
#

This means any time the temp sensor changes at all it will trigger and check to see if its below 50 and also if it is within the time

topaz meteor
# safe plaza This means any time the temp sensor changes at all it will trigger and check to ...

How about this?

alias: Hot Water On with temp
description: >-
  Turns on the Shelly Switch if the temperature sensors allow based on rules
  below
triggers:
  - type: turned_off
    device_id: 91aa9cac0233bbc0db9cac6876932e4f
    entity_id: cb705a2b1c1916f0a232038563873fd8
    domain: switch
    trigger: device
conditions:
  - condition: and
    conditions:
      - condition: time
        before: "07:00:00"
      - condition: time
        after: "02:00:00"
      - type: is_temperature
        condition: device
        device_id: 91aa9cac0233bbc0db9cac6876932e4f
        entity_id: 33e35bb44be3587c04471af4912ffe62
        domain: sensor
        below: 50
actions:
  - type: turn_on
    device_id: 91aa9cac0233bbc0db9cac6876932e4f
    entity_id: cb705a2b1c1916f0a232038563873fd8
    domain: switch
mode: single
safe plaza
#

add trigger, entity, state. then select the temp sensor entity.

topaz meteor
# safe plaza no

Is it as simple as this?

alias: Turn on Shelly between 2–6am if temp < 50°C
triggers:
  - entity_id: 33e35bb44be3587c04471af4912ffe62
    below: 50
    trigger: numeric_state
conditions:
  - condition: time
    after: "02:00:00"
    before: "06:00:00"
actions:
  - type: turn_on
    device_id: 91aa9cac0233bbc0db9cac6876932e4f
    entity_id: cb705a2b1c1916f0a232038563873fd8
    domain: switch
mode: single
topaz meteor
# safe plaza no

Sorry I think I'm missing something your trying to teach me as this seems the same as what I did in the beginning.

safe plaza
safe plaza
#

your current set up is doing the following:
If it is between 0200 and 0600 and the temp changes from above 50 to below 50 then trigger.
if its already below 50 and remains there then it does not trigger.

topaz meteor
#

sorry but can you define a state trigger? Is that like if the switch is off?

topaz meteor
safe plaza
#

state trigger
time condition
numeric state condition

#

this means if its below 50 already but it changes from 49 -> 48 then it will trigger and check that its below 50 and within time condition

#

you could also add a time pattern trigger too just to be extra sure.

#

This means it will check every 5 minutes too.

topaz meteor
# safe plaza you could also add a time pattern trigger too just to be extra sure.
alias: Turn on Shelly between 2–6am if temp < 50°C
triggers:
  - trigger: state
    entity_id:
      - sensor.hot_water_temp_sensors_and_off_peak_switch_temperature
  - trigger: time_pattern
    minutes: "5"
conditions:
  - condition: time
    after: "02:00:00"
    before: "06:00:00"
  - type: is_temperature
    condition: device
    device_id: 91aa9cac0233bbc0db9cac6876932e4f
    entity_id: 33e35bb44be3587c04471af4912ffe62
    domain: sensor
    below: 50
actions:
  - type: turn_on
    device_id: 91aa9cac0233bbc0db9cac6876932e4f
    entity_id: cb705a2b1c1916f0a232038563873fd8
    domain: switch
mode: single
#

Hopefully this is better now.

safe plaza
#

"5" means "the 5th minute"
0205, 0305, etc...
whereas
/5 means "every 5th minute"
0205, 0210, etc...

#
triggers:
  - trigger: state
    entity_id:
      - sensor.hot_water_temp_sensors_and_off_peak_switch_temperature
  - trigger: time_pattern
    minutes: /5
#

this will make it more reliable.

#

as it will constantly check every 5 minutes as well as every time the temp sensor updates.

topaz meteor
#

OK - made that change. Thanks for persevering with me!!

safe plaza
#

now it should trigger a bunch more and on the trigger it will check conditions and if its the right time and its <50 it will turn on the switch.

safe plaza
topaz meteor