Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- automation:
- - id: e43f1a0a-6625-4830-b372-7c62c048c919
- alias: Alexa luci rimaste accese (evento sul gruppo luci)
- mode: parallel
- max: 10
- trigger:
- - platform: event
- event_type: state_changed
- condition:
- - "{{ trigger.event.data.entity_id.startswith('light.') }}"
- - "{{ trigger.event.data.new_state.state == 'on' }}"
- - "{{ trigger.event.data.entity_id in expand(states['group.tutte_le_luci']) | map(attribute='entity_id') | list }}"
- - condition: time
- after: "07:00:00"
- before: "22:00:00"
- action:
- - wait_template: "{{ is_state(trigger.event.data.entity_id, 'off') }}"
- timeout: 00:01:00
- - if:
- - "{{ is_state(trigger.event.data.entity_id, 'on') }}"
- then:
- - alias: "Richiamo script spegnimento tramite actionable"
- service: script.turn_on
- target:
- entity_id: script.light_actionable_turn_off
- data:
- variables:
- target: "{{ trigger.event.data.entity_id }}"
- script:
- light_actionable_turn_off:
- alias: "Richiede se spegenre una luce"
- description: "Richiede tramite Alexa Actionable Notification se spegnere una luce"
- mode: queued
- max: 10
- fields:
- target:
- name: "Luce da spegnere"
- description: "Indica la luce da spegnere tramite richiesta con Alexa Actionable Notification"
- selector:
- entity:
- domain: light
- example: "light.strip_soggiorno"
- sequence:
- - service: notify.notify
- data:
- message: >
- Mi risulta che la luce {{ state_attr(target, "friendly_name") }} sia rimasta accesa. Vuoi spegnerla?
- - service: script.activate_alexa_actionable_notification
- data:
- alexa_device: "{{ states('sensor.last_alexa') }}"
- event_id: actionable_notification_prova_luce
- text: >
- Mi risulta che la luce {{ state_attr(target, "friendly_name") }} sia rimasta accesa. Vuoi spegnerla?
- - wait_for_trigger:
- - platform: event
- event_type: alexa_actionable_notification
- id: ResponseYes
- event_data:
- event_id: actionable_notification_prova_luce
- event_response: ResponseYes
- - platform: event
- event_type: alexa_actionable_notification
- id: ResponseNo
- event_data:
- event_id: actionable_notification_prova_luce
- event_response: ResponseNo
- timeout:
- hours: 0
- minutes: 0
- seconds: 15
- milliseconds: 0
- continue_on_timeout: false
- - choose:
- - conditions:
- - "{{ wait.trigger.event.data.event_response_type == 'ResponseYes'}}"
- sequence:
- - service: notify.alexa_media
- data:
- target: "{{ states('sensor.last_alexa') }}"
- data:
- type: tts
- message: ok
- - service: light.turn_off
- target:
- entity_id: "{{ target }}"
- - conditions:
- - condition: template
- value_template: "{{ wait.trigger.event.data.event_response_type == 'ResponseNo'}}"
- sequence:
- - service: notify.alexa_media
- data:
- target: "{{ states('sensor.last_alexa') }}"
- data:
- type: tts
- message: ok
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement