Help with automation trigger (numeric state)

Hi…

I’m trying to get an automation working but I can’t seem to get it to trigger on numeric state change.

my goal…
turn my pool pump to low when the temp difference of my solar sensor is greater then 19 (and keep it on as long as the temp difference is above 19)

I have a separate automation to turn the pump off when the solar temp diff is below 20

my sensor works and reports the correct values

  sensor:
    - platform: template
      sensors:
# SOLAR TEMP DIFF
        solar_temp_diff:
          value_template: "{{ states('sensor.pentair_airtemp') | int - states('sensor.pentair_soltemp') | int }}"

I have used this format for other automations and it works fine

alias: pool - solar circulation (on)
description: turn pool pump to L if solar temp diff greater than 20
trigger:
  - platform: numeric_state
    entity_id: sensor.solar_temp_diff
    above: '19'
condition: []
action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.pentair_pooll
mode: single

For some reason, it appears the automation does NOT recognize the trigger on numeric_state

your input is appreciated.

Thank

Dave

Hi dave, I have a doubt, you said you want to turn on the pump above 19 and turn off pump below 20. 19 is also below 20. If you meant you want to stop the pump above 20, I have tried to combine both your automations together by using the choose action type and also template triggering. You may need to change some things according to your settings.

alias: pool - solar circulation
description: ''
mode: single
trigger:
  - platform: state
    entity_id: sensor.solar_temp_diff
condition: []
action:
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ states(''sensor.solar_temp_diff'') | float <= 20 }}'
        sequence:
          - service: switch.turn_off
            target:
              entity_id: switch.water_pump
      - conditions:
          - condition: template
            value_template: '{{ states(''sensor.solar_temp_diff'') | float >= 19 }}'
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.water_pump
    default: []
1 Like

Thank you for this!!!

Yes, basically want to turn my solar circulation pump on/off at 20. Changed up the value template based on what you sent accordingly.

" >= 20 turn on
" < 20 turn off

I didn’t even think that was an option.

Newish to homeassistant and still thinking within the constraints of my old automation system.

The more I use/learn homeassistant, the more I’m wondering what took me so long to find it!

I’m using the GUI to setup automations and was under the impression that you could not just pick an “entity” or a “device” as a trigger without filling in the additional information (to, from, for, etc…)

This tidbit of information has allowed me to cut the number of automations I was using in half! I was previously using separate automations for on and off.

Thank you again!

d

while we are at it… is there a better way to do this???

shutdown MariaDB before automated SambaBackup runs and then restart MariaDB once backup is complete.

My automated backup runs at 01:00 and this is what I have tried so far. It appears to be working, but am unable to track the process down in the logs to verify.

alias: backup - shutdown/restart mariadb
description: ''
trigger:
  - platform: time
    at: '12:59:45'
condition: []
action:
  - service: hassio.addon_stop
    data:
      addon: core_mariadb
  - wait_for_trigger:
      - platform: state
        entity_id: sensor.samba_backup
        to: SUCCEEDED
        attribute: last_backup
  - service: hassio.addon_start
    data:
      addon: core_mariadb
mode: single

Since you are looing for automated snapshot process, I would highly recommend this addon.


This can do snapshots with addons turned on and then turn them off, also it can upload snapshots to google drive which can be one more redundancy factor. There are lots more features and the addon is worth it.