Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 105784

Enable automation, execute code after 10 seconds of activation

$
0
0

Hi Guys,

i have an automation that is disabled by default. If i enable that automation it should execute the sequence when the automation is enabled for 10 seconds and than disables it self.

this is my automation:

alias: Ganglicht automatisch ausschalten
description: ""
trigger:
  - alias: Wenn die Automatisation eine bestimmte Zeit lang aktiv ist
    platform: state
    entity_id:
      - automation.disable_floorlight
    to: "on"
    for:
      hours: 0
      minutes: 0
      seconds: 10
condition: []
action:
  - service: light.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: light.grossraum
    alias: Licht im Gang ausschalten
  - alias: Automatisierung wieder beenden
    service: automation.turn_off
    metadata: {}
    data:
      stop_actions: false
    target:
      entity_id: automation.disable_floorlight
mode: restart

The action will not take place. But the message “run” is displayed (in german “ausgeführt”).

This is behind a click on the message “run”:

variables:
  trigger:
    id: "0"
    idx: "0"
    alias: Wenn die Automatisation eine bestimmte Zeit lang aktiv ist
    platform: state
    entity_id: automation.disable_floorlight
    from_state:
      entity_id: automation.disable_floorlight
      state: "off"
      attributes:
        id: "1707771353464"
        last_triggered: "2024-02-19T23:16:38.461101+00:00"
        mode: restart
        current: 0
        friendly_name: Ganglicht automatisch ausschalten
      last_changed: "2024-02-19T23:17:22.294759+00:00"
      last_updated: "2024-02-19T23:17:22.294759+00:00"
      context:
        id: 01HQ1THS7PTSR8BZ38MAC70MCW
        parent_id: null
        user_id: null
    to_state:
      entity_id: automation.disable_floorlight
      state: "on"
      attributes:
        id: "1707771353464"
        last_triggered: "2024-02-19T23:16:38.461101+00:00"
        mode: restart
        current: 0
        friendly_name: Ganglicht automatisch ausschalten
      last_changed: "2024-02-19T23:17:26.597630+00:00"
      last_updated: "2024-02-19T23:17:26.597630+00:00"
      context:
        id: 01HQ1THXE58TMWTVSDA4GYJXPQ
        parent_id: null
        user_id: a83f5e7aa5e84a639fbfb0b6ec492796
    for:
      __type: <class 'datetime.timedelta'>
      total_seconds: 10
    attribute: null
    description: state of automation.disable_floorlight
context:
  id: 01HQ1THXE58TMWTVSDA4GYJXPQ
  parent_id: null
  user_id: a83f5e7aa5e84a639fbfb0b6ec492796

Why?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 105784

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>