Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- homeassistant:
- customize:
- package.node_anchors:
- customize: &customize
- package: 'Package Anti Jammer'
- version: 'v1.0 29/04/2022'
- author: 'Calas'
- expose: &expose
- <<: *customize
- haaska_hidden: false
- homebridge_hidden: false
- ################################################################################
- ## Input Boolean
- ###################################################
- input_boolean:
- anti_jammer_controllo:
- name: Controllo Anti Jammer
- icon: mdi:wifi-strength-alert-outline
- ################################################################################
- ## Input UMBER
- ###################################################
- input_number:
- anti_jammer_high_availability_vote:
- name: Anti Jammer HA vote soglia
- icon: mdi:counter
- min: 1
- max: 5
- step: 1
- unit_of_measurement: 'Voti'
- ################################################################################
- ## Counter
- ###################################################
- counter:
- anti_jammer_high_availability_vote:
- initial: 0
- step: 1
- ################################################################################
- ## Script
- ###################################################
- script:
- anti_jammer_counter_increment:
- sequence:
- - service: counter.increment
- target:
- entity_id: counter.anti_jammer_high_availability_vote
- anti_jammer_counter_decrement:
- sequence:
- - service: counter.decrement
- target:
- entity_id: counter.anti_jammer_high_availability_vote
- ################################################################################
- ## Automations
- ###################################################
- automation:
- - alias: Anti Jammer counter_startup
- id: f2b626dbdb867435c96e14acf3657c81
- trigger:
- - platform: homeassistant
- event: start
- action:
- - service: counter.reset
- target:
- entity_id: counter.anti_jammer_high_availability_vote
- - delay: '00:00:30'
- - service_template: >
- {% if is_state('binary_sensor.antifurto_stato', 'on') %}
- script.anti_jammer_counter_increment
- {% endif %}
- - service_template: >
- {% if is_state('binary_sensor.abat_jour_stato', 'on') %}
- script.anti_jammer_counter_increment
- {% endif %}
- - service_template: >
- {% if is_state('binary_sensor.stufetta_stato_esp', 'on') %}
- script.anti_jammer_counter_increment
- {% endif %}
- - alias: Anti Jammer antifurto_stato
- id: 38aa711de0c498124ba4ffb3559682d8
- trigger:
- - platform: state
- entity_id: binary_sensor.antifurto_stato
- action:
- - service_template: >
- {% if trigger.to_state.state == 'on' %}
- script.anti_jammer_counter_increment
- {% elif trigger.to_state.state == 'off' %}
- script.anti_jammer_counter_decrement
- {% endif %}
- - alias: Anti Jammer abat_jour_stato
- id: 261d3b642198aab1864b610dc41aa502
- trigger:
- - platform: state
- entity_id: binary_sensor.abat_jour_stato
- action:
- - service_template: >
- {% if trigger.to_state.state == 'on' %}
- script.anti_jammer_counter_increment
- {% elif trigger.to_state.state == 'off' %}
- script.anti_jammer_counter_decrement
- {% endif %}
- - alias: aAnti Jammer stufetta_stato_esp
- id: 261d3b642198aab1864b610dc41aa502
- trigger:
- - platform: state
- entity_id: binary_sensor.stufetta_stato_esp
- action:
- - service_template: >
- {% if trigger.to_state.state == 'on' %}
- script.anti_jammer_counter_increment
- {% elif trigger.to_state.state == 'off' %}
- script.anti_jammer_counter_decrement
- {% endif %}
- - alias: Anti Jammer norifica
- id: de16b9b9c9d26f2523c8e12e1f2611c2
- trigger:
- - platform: tempalte
- value_template: "{{ states('counter.anti_jammer_high_availability_vote') | int < states('input_number.anti_jammer_high_availability_vote') | int }}"
- for:
- seconds: 60
- condition:
- condition: state
- entity_id: input_boolean.anti_jammer_controllo
- state: 'on'
- action:
- - service: !secret notifiche_francesco
- data:
- title: '*ATTENZIONE*'
- message: 'Possibile impiego di jammer - {{now().strftime("%d.%m.%Y - %H:%M:%S")}}'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement