Hey everybody,
I recently created a counter, that tells me how often a device has been turned on (everything above 5.5W is considered as turned on). What I am trying to do now is to create a code, that increments another counter. In order for that to happen, the device has to be turned on ( bigger than 5.5 Watts) for more than 8 seconds and if that is the case, than the other counter gets incremented by one (initial = 0).
- id: '1673870444936'
alias: New Automation
description: ''
trigger:
- type: power
platform: device
device_id: cada4c50e7044fea3238a48e8f8bf81e
entity_id: sensor.shellyplug_s_c8c9a3b8d590_power
domain: sensor
above: 5.5
below: 100
for:
hours: 0
minutes: 0
seconds: 8
condition: []
action:
- service: counter.increment
data: {}
target:
entity_id: counter.zahler_wasserspender
mode: single
This is the code I used for the first counter, however I am not sure what I should do now. Should I create a timer or implement the device entity again, but this time just inserting the duration?
Thank you for your time in advance!
Cheers