#Popup to deactivate automations for a specific time

1 messages · Page 1 of 1 (latest)

hollow sail
#

I have designed and implemented a cool popup that I can access via a chip on my dashboards that allows users to turn off an automation for one of a few predefined time frames.

#

It translates to "automatic lighting"

fickle valley
#

Nice 👍
Where can we find the code?

hollow sail
#

Automation:

- id: '1715224972896'
  alias: Büro Licht Auto
  description: ''
  trigger:
  - platform: state
    entity_id:
    - input_boolean.buro_licht_auto
    from: 'off'
    to: 'on'
    id: turn_on
  - platform: event
    event_type: light_auto_off
    event_data:
      entity: input_boolean.buro_licht_auto
    id: event
  condition: []
  action:
  - if:
    - condition: trigger
      id:
      - turn_on
      - turn_off
    then:
    - stop: ''
  - service: input_boolean.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: input_boolean.buro_licht_auto
  - delay: '{{trigger.event.data.time}}'
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.buro_licht_auto
  mode: restart

Script:

light_auto_off:
  alias: Light Auto Off
  sequence:
  - event: light_auto_off
    event_data:
      entity: '{{ entity }}'
      time: '{{ time }}'
  mode: parallel

Popup:

action: fire-dom-event
browser_mod:
  service: browser_mod.popup
  data:
    content:
      type: vertical-stack
      title: Automatische Beleuchtung
      cards:
      - type: custom:mushroom-entity-card
        entity: "[[licht_auto]]"
        tap_action:
          action: toggle
      - type: custom:mushroom-chips-card
        chips:
        - type: template
          content: 10 Minuten
          tap_action:
            action: call-service
            service: script.light_auto_off
            service_data:
              entity: "[[licht_auto]]"
              time: "00:10:00"
          hold_action: none
          double_tap_action: none
        - type: template
          content: 30 Minuten
          tap_action:
            action: call-service
            service: script.light_auto_off
            service_data:
              entity: "[[licht_auto]]"
              time: "00:30:00"
          hold_action: none
          double_tap_action: none
        - type: template
          content: 1 Stunde
          tap_action:
            action: call-service
            service: script.light_auto_off
            service_data:
              entity: "[[licht_auto]]"
              time: "01:00:00"
          hold_action: none
          double_tap_action: none
        - type: template
          content: 3 Stunden
          tap_action:
            action: call-service
            service: script.light_auto_off
            service_data:
              entity: "[[licht_auto]]"
              time: "03:00:00"
          hold_action: none
          double_tap_action: none
        - type: template
          content: 12 Stunden
          tap_action:
            action: call-service
            service: script.light_auto_off
            service_data:
              entity: "[[licht_auto]]"
              time: "12:00:00"
          hold_action: none
          double_tap_action: none
        - type: template
          content: 1 Tag
          tap_action:
            action: call-service
            service: script.light_auto_off
            service_data:
              entity: "[[licht_auto]]"
              time: "24:00:00"
          hold_action: none
          double_tap_action: none
        - type: template
          content: 3 Tage
          tap_action:
            action: call-service
            service: script.light_auto_off
            service_data:
              entity: "[[licht_auto]]"
              time: "48:00:00"
          hold_action: none
          double_tap_action: none