input_number:
etat_precedent_porte:
name: "État précédent porte Hormann"
min: 0
max: 100
step: 1
mode: box
icon: mdi:history
input_boolean:
hormann_update_trigger:
name: "Trigger update HomeKit Hormann"
initial: off
sensor:
- platform: template
sensors:
etat_porte_hormann_numerique:
friendly_name: "État numérique porte Hormann"
unique_id: etat_porte_hormann_numerique
value_template: >
{% set ouvert = is_state('binary_sensor.etat_porte_hormann_etat_porte_hormann_any_1', 'on') %}
{% set ferme = is_state('binary_sensor.etat_porte_hormann_etat_porte_hormann_any_2', 'on') %}
{% if ouvert and not ferme %}
1
{% elif ferme and not ouvert %}
-1
{% elif ferme and ouvert %}
0
{% else %}
99
{% endif %}
etat_porte_hormann_texte:
friendly_name: "État texte porte Hormann"
value_template: >
{% set ouvert = is_state('binary_sensor.etat_porte_hormann_etat_porte_hormann_any_1', 'on') %}
{% set ferme = is_state('binary_sensor.etat_porte_hormann_etat_porte_hormann_any_2', 'on') %}
{% set precedent = states('input_number.etat_precedent_porte') | int %}
{% if ouvert and not ferme %}
'Ouverte'
{% elif ferme and not ouvert %}
'Fermée'
{% elif ferme and ouvert %}
{% if precedent < 50 %}
'Ouverture'
{% elif precedent > 50 %}
'Fermeture'
{% else %}
'Inconnu'
{% endif %}
{% else %}
'Incohérent'
{% endif %}
etat_porte_hormann_position:
friendly_name: "Position porte Hormann (%)"
value_template: "{{ states('input_number.etat_precedent_porte') | int }}"
cover:
- platform: template
covers:
portail_hormann_homekit:
friendly_name: "Portail Hormann"
device_class: garage
position_template: "{{ states('sensor.etat_porte_hormann_position') | int }}"
open_cover:
service: switch.turn_on
target:
entity_id: switch.hormann_com_hormann_com_switch
close_cover:
service: switch.turn_on
target:
entity_id: switch.hormann_com_hormann_com_switch
stop_cover:
service: switch.turn_on
target:
entity_id: switch.hormann_com_hormann_com_switch
automation:
- alias: "Mémoriser état précédent porte Hormann"
trigger:
- platform: state
entity_id: sensor.etat_porte_hormann_numerique
condition:
- condition: template
value_template: "{{ trigger.to_state.state | int in [-1, 1] }}"
action:
- service: input_number.set_value
target:
entity_id: input_number.etat_precedent_porte
Bonjour j ai deux capteurs pour connaitre l etat de ma porte de garage via homekit, l etat en ouverture et fermeture fonctionne mais l actualisation ouvert / ferme ne marche ,il faut fermé l app maison pour rafraichir . mes 2 capteurs sont actifs quand la porte est en mouvement. Pour cela j utilise un etat entre -1 fermé 0 ouverture ou fermeture 1 ouvert , Une idée pour améliorer