cool. fyi, ive already changed it into the code below, so i can show, and do so, the time below the Mode-Badge. The variable is there, now how to show it on the summary sensor.
Please note that i changed profile in mode, did that system-wide, so no confusion can be created elsewhere. In my setup there’s only activity and mode, no more profile or other variants
mode_desc = ''
state = hass.states.get('input_select.ha_mode')
# Get info
dt = datetime.datetime.now() #state.attributes.get('last_triggered')
time = "%02d:%02d" % (dt.hour, dt.minute)
if (not state is None):
hidden = False if (state.state != 'Normal') else True
hass.states.set('sensor.mode_badge', '', {
'entity_picture': '/local/modes/{''}.png'.format(state.state.replace(' ','').lower()),
'friendly_name': time, #was: ''
'unit_of_measurement': 'Mode',
'hidden': hidden,
'order': order
})
if not hidden:
mode_desc = '{}*{} mode was activated\n at: '.format(summary, state.state)
-
btw if would like the normal mode to be displayed also (have a nice HA icon for that) how would i ‘unhide’ this? Im confused by this syntax:
hidden = False if (state.state != 'Normal') else True
which seems to say that if state is Normal, hidden is False. So why wont it show then? -
About Order: im not sure what is does, or put differently if to does what it is supposed to. I believed it to be responsible for ordering the badges, but that doesn’t seem to be very consistent? The badges keep being displayed in different ways. If its not very reliable, couldn’t we better take them out completely? making the code as efficient as possible.
Ill try a bit more and report back, but please respond if im making big mistakes here.
Cheers,
Marius