How do you pass an MQTT payload to delay?

@VDRainer I am getting that drift about the HMI, believe me :wink:

Thanks for the help. I was not likely to get there. What you have provided I can use to go back to help files to get better picture of how some of the subtleties work. Good job you.

You can use the editor and the .yaml together for automations. If you setup automations in the editor, they will be saved in automations.yaml. You can write your own automations in this file manually. If you use a unique ĂŹd for the automation, it will show up the next time in the editor. But be aware, not all things setup in that file are shown in the editor, but they still work!

This is one manually written automation, that is shown in the editor and is changeable via both ways:

- id: alarm_door_home_open
  alias: "Alarm: HaustĂźre offen"
  trigger:
  - entity_id: binary_sensor.door_home_contact
    platform: state
    to: 'on'
    for: 00:01:30
  action: 
  - data:
      message: "W O H N U N G S T Ü R E   O F F E N"
      notification_id: door_alarm
      title: Achtung!
    service: persistent_notification.create

Yeah, I must be fu%#ing crazy to think that.

:roll_eyes:

No I’m not. Not sure where you get that idea.

1 Like

Thanks @paddy0174, but you missed the point about passing the delay via MQTT payload and not by hard coding delays in yaml. Interesting the idea of using persistent_notification.create instead of notify.notify. I will look into that thanks.

@flamingm0e, have a look at the solution that was offered by @VDRainer. So yes you were hung up on payload as state, and @VDRainer was not.

You’re kidding right?

The only time I mentioned state is when you were talking about using an MQTT sensor. Try to follow along.

I have been using MQTT for over 5 years, and HA for over 3 now. I’m not a moron, and I told you you needed to use data_template: but it was more fun to act like a sarcastic ass when YOU were the one asking for help, huh?

@flamingm0e yes, I ask for help and then need filter out the unhelp. So I get it, it burns you that I did not use your “help”. :hugs:

So, taking the guidance from @VDRainer, tuning for my ESPHome sprinkler system, the yaml for automations.yaml looks like this (for sprinkler zone 3 of 4):

- id: '1580020382806'
  alias: Water Zone 3 Variable Timer
  description: ''
  trigger:
  - platform: mqtt
    topic: /ha/sprinkler/zone_3
  condition: []
  action:
  - device_id: d8f968bdc8d845a2a8c0a5049fff31c5
    domain: switch
    entity_id: switch.zone_3
    type: turn_on
  - delay: '{{ trigger.payload }}'
  - device_id: d8f968bdc8d845a2a8c0a5049fff31c5
    domain: switch
    entity_id: switch.zone_3
    type: turn_off

Noting that the device_id is the one allocated to my ESP sprinkler system by HA so it will or should be different for any device you, the friendly reader, will use. Same for the automation id. I just clipped my yaml out raw, to avoid transcription errors when posting.

Noting, that yaml started as the automation captured from the HMI but wasn’t working for me, as explained above. I edited it up in the automations.yaml from that broken attempt. So, I am still to play with device_id to see if I can also use “sprinkler” instead, directly in the yaml. Noting “sprinkler” was the name I gave to my ESPHome gadget I designed. The “sprinkler” is what the hmi uses to resolve down to the gibberish (random) number.

Many example user yaml tend to use human friendly names - I still need find help file reference to describe this random id story, probably in developers side. Only curious mind you, as it works now I am less interested in touching it.

Thanks again for all those who had a positive approach to helping.

You brought the anger of @flamingm0e by patronizing him and you don’t even realize it. His help was 100% correct and you over looked it because of your poor yaml skills.

Don’t throw around false statements and you wont get hate back…

@petro did you hear about the two AI chat systems that learned “conversation” by “watching” social media and user groups? Two drunk researchers in the AI lab decided late one night, after a serious party, to connect the two AI chat bots together. The chat bots started arguing in 5 minutes flat. Thank you sooo much four your contribution to AI research. If we only new that all we had do to pretend to have human intelligence was to be rude when to someone when they didn’t understand something and be irrational when they tried paraphrasing back what they thought what you meant in your random stabs of know it all then … phew this a long sentence … then we have spent too much on AI. By the way, that was sarcasm. Me not understanding was me not understanding.

Ya and you clearly still don’t understand