Automation temperature only once

Hi!

for my 3d-printer I am using the following automation to get a telegram message as soon as the bed is heated:

alias: Octoprint_Bett_aufgeheizt
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.octoprint_actual_bed_temp
    above: sensor.octoprint_target_bed_temp
condition:
  - condition: state
    entity_id: binary_sensor.octoprint_printing
    state: "off"
  - condition: numeric_state
    entity_id: sensor.octoprint_actual_bed_temp
    above: 30
action:
  - service: telegram_bot.send_message
    data:
      message: Bett aufgeheizt
mode: single

Now, when temperature falls a little bit and raises again, I am getting a telegram message every time.
How can I change this to only get a message when the bed is heated first time?
Best regards and thanks in advance,
Otto

Use a threshold helper. The hysteresis prevents the over-under-rince-repeat effect

Thanks a lot. Unfortunately the treshold helper only works with fixed values, not relative ones.
To explain what I mean:
one time the 3d-printer has a target bed temperature of 60 degress, for a different material 90 degrees are needed.
And, please correct me if I am wrong, treshold only can handle fixed values. What I would need (I think) would be something that can handle that within - lets say - plus/minus 5 degrees of the target temperature. Does anyone maybe know a trick?
Coming from fhem, I used one (or some) lines of perl for simple things like this, but with HA, I am still a little bit lost…

One easy way to do this without a lot of complex scripting would be to create a helper entity called “Bed Preheated” and once you get notified it sets it to true and then that becomes a criteria for future notifications (if input_boolean.bed_preheated == false) and then another automation when your print is done to reset that back for the next time.

Sometimes it’s easy to try to over engineer a solution when a fairly simple one might work out instead.

Thanks a lot! This will work for me :slight_smile:
And you are right. Sometimes you do not see the simple things…

I use a lot of similar solutions in my HA. One thing I have learned, though, is to not always trust that external integrations like Octoprint (which I also use) will fire your automations properly, so I build in a failsafe I call “Midnight Resets” that just makes sure all things like this go back to their default value each night so it doesn’t mess me up in the future.

this is a really good idea. I have something similar in fhem…