never mind the above, i believe it had to do with me calling the wrong automation.ha_mode_selection, that i had changed names just before that… (you might want to consider creating a way to show the card, but with a warning of some kind some elements could not be loaded. as it stands now, the card just doesn’t show, and one has to be very thoughtful where to start finding the cause…)
just letting you know:
for now ive found a way to show he correct times everywhere. Ive changed the activity.py to have the time triggered from the automation too, so that we’re sure both the python scripts use the same time sources.
# Get params
event = data.get('event')
# Get the state object from the name
state_value = hass.states.get('input_select.activity').state
# Get info
dt = hass.states.get('automation.activity_change').attributes.get('last_triggered') #datetime.datetime.now()
time = "%02d:%02d" % (dt.hour+1, dt.minute)
# Sensor update
hass.states.set('sensor.activity_badge', state_value, {
'friendly_name': time, #state_value,
'entity_picture': '/local/activities/{' '}.png'.format(state_value.replace(' ','').lower()),
'unit_of_measurement': 'Act'
})
Also, ive changed the time calculating by adding +1 for my timezone.
time = "%02d:%02d" % (dt.hour+1, dt.minute)
Ive done that both in summary.py and activity.py, so again, with are calculating the same time.
Final detail now: whenever i select a mode/profile, the time change isnt automatically updated. I can see the system registers, because the last_activity shows it immediately.
It is only after i also change an activity, the mode-time changes. It does so to the correct time, but only after an extra push.
Must recheck the mode-automation to see why that isnt happening.
Still, getting better with each iteration!
