How to get an automation that reads the current state of a sensor

Hi all, hope you are well. Just need some help here, had HA for sometime but hardly do much with it. So my request might need step by step instructions but hopefully i will easily follow.

In simple i have 11 wiser radiator valves with battery level sensor, i understand automations can go from ‘when level drops below X from X then action’ but what i want is a notification to my iphone, after HA has checked daily all my sensors and if any are currently showing 20% or less. This is more of a reminder to force me to change the batteries, the from and to values only show once the value has changed, i need to read the values daily not when it changes. hope that makes sense.

here is my example, where the below or above text goes i typed ‘equals’ just to get my point more clearly across, thank you in advance. ps. if i can multiple entities that would be great and also i want the automation to check daily at a certain time as i know most times i will be free then to do something about the battery.

alias: New Automation
description: ‘check daily value of battery levels’
trigger:

  • platform: numeric_state
    entity_id: sensor.wiser_itrv_upstairs_hallway_battery
    equals: ‘20’
    condition:
  • condition: time
    after: ‘13:00:00’
    action:
  • device_id: XXXXXX(to be replaced with real ID)
    domain: mobile_app
    type: notify
    message: change battery
    mode: single

FYI, hiding device_id is pointless as it does not pose a security threat to your system. I’ts just a unique_id that HA uses to identify your device in the system. If anyone copied the code, it wouldn’t work for them, nor would it tell them what the device is. TLDR: You’re wasting your time hiding it.


Change to a time trigger instead of a numeric state trigger with a condition.

trigger:
- platform: time
  at: "13:00"
condition:
- condition: or
  conditions:
  - platform: state
    entity_id: sensor.wiser_itrv_upstairs_hallway_battery
    to: 20
  - platform: numeric_state
    entity_id: sensor.wiser_itrv_upstairs_hallway_battery
    below: 20
actions:
- device_id: XXXXXX(to be replaced with real ID)
  domain: mobile_app
  type: notify
  message: change battery
  mode: single

or… just below 21 :slight_smile: