Automation with Reference to Condition in Notification Message

Normally, if it’s an entity in the trigger, I’d have no issues referencing it in the notification message using ‘trigger.to_state’. However, because I’m using ‘time_pattern’ I’ve had to move the entity check into the condition portion of the automation.

- alias: 'Lo Temp ALARM!'
  mode: restart
  description: ''
  trigger:
    - platform: time_pattern
      minutes: '/15'
  condition:
    - condition: numeric_state
      entity_id: sensor.reef_temperature_f
      below: '77'
    #   for: 00:05:00
  action:
    - service: notify.mobile_app_iphone12
      data:
        title: 'ALARM! Reef Temp < 25°C / 77°F'
        message: "Temp now is [HOW TO REFERENCE sensor.reef_temperature_f HERE], go get the backup heater!"

Seems somewhat backwards in terms of layman’s logic, but the time interval to me should be the condition, and the temperature threshold should be the trigger. Either way, everythign in this automation works as expected, just looking for the actual temp to be referenced in the message. Help with that bit of code would be appreciated.

If there’s a better/different way to do this automation, I wouldn’t mind changing it up so that it makes more sense.

message: "Temp now is {{states('sensor.reef_temperature_f') }}, go get the backup heater!"

Seeing that, I feel embarrassed to have even posted this. Was racking my brain to find something associated with the condition …

1 Like

I’m trying to achieve just what this topic title says but mine is a multiple OR condition. Can this be achieved with a template? I know it’s possible with trigger data but I can’t find how to reference a condition?

2 Likes

@Morphy Did you ever figure out if this was possible ?

No, I don’t think so sorry

I ended up getting a bit of inspiration and doing it like this:

1 Like

I did my automation in a different way which didn’t require the condition data in the end. Handy to know though!