Fix spontan doorbell efter HA genstart: restart-safe event_cnt

- input_number initial sat til -1 (sentinel for 'aldrig synkroniseret')
- condition fjernet, event_cnt check flyttet ind i action blok
- counter opdateres ALTID (ogsaa ved wake-up)
- doorbell koerer kun naar old_cnt >= 0 OG new_cnt != old_cnt
- foerste wake-up efter restart synkroniserer stille uden at ringe
This commit is contained in:
2026-04-20 07:01:19 +02:00
parent ce888204db
commit 43034bb41e
3 changed files with 41 additions and 0 deletions
+13
View File
@@ -11,6 +11,19 @@
topic: '{{''shellies/shellybutton1-'' ~ button_id ~ ''/input_event/0''}}'
condition: []
action:
# Gem gammel og ny event_cnt
- variables:
new_cnt: "{{ trigger.payload_json.event_cnt | int(0) }}"
old_cnt: "{{ states('input_number.shelly_fordor_event_cnt') | int(-1) }}"
# Opdater counter ALTID (ogsaa ved wake-up)
- service: input_number.set_value
target:
entity_id: input_number.shelly_fordor_event_cnt
data:
value: "{{ new_cnt }}"
# Stop hvis: foerste sync efter restart (old=-1) eller samme cnt (periodisk wake-up)
- condition: template
value_template: "{{ old_cnt >= 0 and new_cnt != old_cnt }}"
- choose:
- conditions:
- condition: template