Create counter.py

This commit is contained in:
Paulus Schoutsen 2017-06-21 17:23:50 -07:00 committed by GitHub
parent de6e29d7f1
commit 49b20e7b14
1 changed files with 8 additions and 0 deletions
python_scripts

View File

@ -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)