Create counter.py
This commit is contained in:
parent
de6e29d7f1
commit
49b20e7b14
python_scripts
|
@ -0,0 +1,8 @@
|
|||
counter = hass.states.get('sensor.my_counter')
|
||||
|
||||
if counter is None:
|
||||
value = 0
|
||||
else:
|
||||
value = int(counter.state)
|
||||
|
||||
hass.states.set('sensor.my_counter', value + 1)
|
Loading…
Reference in New Issue