Looking for knowlage to advance some automation triggers

I am looking for a way to get a more advance trigger or condition in some automations or conditions.

  1. Temperature: It is easy to trigger by temperature. Does anyone have an idea to advance the automation to detect the change direction. Currently, the automation triggers when the temperature increases to the target and again when it decreases back to the target.

  2. Energy Detection. I am trying to get an automation for when the coffee is done brewing…


    I can easily detect the start of the brew, Does anyone have ideas hew to detect the completion?

  1. check this, Trend seems the way but read first
    Determine if temperature is increasing or decreasing - Configuration - Home Assistant Community (home-assistant.io)

  2. you can add a condition when power = 0 for x seconds AND power was > 0 more than (say) 20 sec ago

Regarding energy detection, there are blueprints about this.
This is the one I use for my washing machine:
https://community.home-assistant.io/t/notify-or-do-something-when-an-appliance-like-a-dishwasher-or-washing-machine-finishes/254841
Maybe it helps you, too.

I’m assuming you want to catch the sensor going to zero at around the 6:23 mark in the graph?

if so you can pretty easily do it by just using a “for” in the trigger:

trigger:
  - platform: state
    entity_id: sensor.your_sensor
    to: '0'
    for: 
      seconds: 30

or if the sensor doesn’t really go to 0 then use a numeric state trigger instead:

trigger:
  - platform: numeric_state
    entity_id: sensor.your_sensor
    below: 5 # or whatever
    for: 
      seconds: 30

as for #1 maybe you should give us more info on your desired use case. What are you trying to do that using the current automation doesn’t?

Thanks for the suggestion. It is very much like my last try. Only problem is that for some reason the energy monitor detects something at various times and then it clears activation the automation. Thus what I was hoping to achieve is a method to detect the current increase from coffee start (Activation) then the delay that the power was decreased to 0 for 30 seconds. Here is what I currently have:

alias: coffee
id: coffee
description: Coffee Monitor
trigger:
  - platform: numeric_state
    entity_id: sensor.kasa_smart_plug_151_current
    for:
      hours: 0
      minutes: 0
      seconds: 30
    below: '0.5'
condition: []
action:
  - service: notify.alexa_media
    data:
      message: >-
        Good Morning! The best part of wakeing up, is Folgers in your cup! Come
        and get it!
      title: Coffee Notification
      target:
        - media_player.kitchen
        - media_player.bed_room
        - media_player.computer_room
      data:
        type: announce
mode: single

@vingerha had a suggestion that is in line of what I am looking for, unfortunately, I am not able to determine the required syntax for his suggested condition:

How long are those spurious signals?

if they are literally just spikes here is what I think might work:

trigger the automation on the power going above 1000w for several seconds (based on it being long enough to filter the spurious signals).

then in the actions use a wait for trigger to go below some value (you used .5 above) before the notification is sent.

You might need to use a timeout as well but that’s up to you.

something like this:

alias: coffee
id: coffee
description: Coffee Monitor
trigger:
  - platform: numeric_state
    entity_id: sensor.kasa_smart_plug_151_current
    for:
      hours: 0
      minutes: 0
      seconds: 30
    above: 1000
condition: []
action:
  - wait_for_trigger:
      - platform: numeric_state
        entity_id: sensor.kasa_smart_plug_151_current
        for:
          hours: 0
          minutes: 0
          seconds: 30
        below: '0.5'
    timeout:
      minutes: 15
    continue_on_timeout: false  
  - service: notify.alexa_media
    data:
      message: >-
        Good Morning! The best part of wakeing up, is Folgers in your cup! Come
        and get it!
      title: Coffee Notification
      target:
        - media_player.kitchen
        - media_player.bed_room
        - media_player.computer_room
      data:
        type: announce
mode: single

be aware tho that if HA restarts during the time the automation is waiting for the trigger the automation will be reset and won’t perform the notification.

but (depending on how vital your coffee notification is… :yawning_face: :weary:) it doesn’t seem like the end of the world if the automation fails to notify you your coffee is done. :laughing:

there are ways around that too but it gets more complicated.