mirror of
https://github.com/skalavala/mysmarthome.git
synced 2025-08-19 03:29:10 +00:00
Back Alive!
This commit is contained in:
17
python_scripts/hide_unwanted.py
Executable file
17
python_scripts/hide_unwanted.py
Executable file
@@ -0,0 +1,17 @@
|
||||
'''
|
||||
@Author : Mahasri Kalavala
|
||||
@Date : 08/27/2017
|
||||
@Description : This python script hides all the sensors that are Online, so that
|
||||
ONLY the Offline sensors are visible in the UI
|
||||
'''
|
||||
for entity_id in hass.states.entity_ids('sensor'):
|
||||
entity_state_object = hass.states.get(entity_id)
|
||||
attributes = entity_state_object.attributes.copy()
|
||||
|
||||
""" Hide all the entities that have 'Online' Status """
|
||||
if entity_state_object.state == 'Online':
|
||||
attributes['hidden'] = True
|
||||
else:
|
||||
attributes['hidden'] = False
|
||||
|
||||
hass.states.set(entity_id, entity_state_object.state, attributes=attributes)
|
Reference in New Issue
Block a user