Hey mate,
So, i know it is disconnected but no worries. I made a counter:
counter:
wwcounter:
name: Wolf Window Count
initial: 0
step: 1
and also an automation:
- id: '1630778240140'
alias: WWindow Count
description: ''
trigger:
- platform: state
entity_id: binary_sensor.ping_wolf_window_sensor
from: 'off'
to: 'on'
condition: []
action:
- service: counter.increment
target:
entity_id: counter.wwcounter
mode: single
these two combined will add a value of 1 to the counter each time the sensor is triggered.
I have also added a reset automation each time the count exceeds 1:
- id: '1630778393410'
alias: WW Reset
description: ''
trigger:
- platform: numeric_state
entity_id: counter.wwcounter
above: '1'
condition: []
action:
- service: counter.reset
target:
entity_id: counter.wwcounter
mode: single
And thus i am setting a default state. I have closed the window and set the counter to “0” ,that means that opening the window will set the new state of the counter to “1” .
If you close the window, the sensor will trigger again adding again to the counter, but because of the reset automation, the counter will revert to “0”.
With this i can have state “0” for closed and state “1” for open
Now, adding another sensor:
sensor:
- platform: template
sensors:
wolf_window:
friendly_name: 'Wolf Window'
value_template: '{% if is_state("counter.wwcounter", "1") %} open {% else %} closed {% endif %}'
And finally, this is the actual sensor i am using to determine if the window is open or closed.
I know it might seem like a weird and needlessly complex method, but for a sensor i couldn’t get to work to save my life or integrate it, this is the best solution that i came up with that works.
Please feel free to ask any questions, or if anyone comes up with a more straight forward solution, it will be very much appreciated.