Summary card and badges for people, devices and status (with python script and custom card)

you might want to have a look at the adapted anything_on.py, needed for the light-section in my Summary.py. use your own entities for lights and switches. Calling a group doesnt work in my setup, i have to list all entities.

#
# Are all lights off?
# If lights are on, how many?
# Should work regardless of light/switch domain
# 
# Return input_boolean.anything_on
# Attributes: number of lights & switches on and the total
#

lightStatus = 'off'
switchEntities = ["switch.sw_tester_template","switch.etc.etc"]
lightEntities = ["light.dining_corner","light.etc.etc"]
lightsOn = 0
switchesOn = 0
totalOn = 0
whichIcon = "mdi:lightbulb-outline"

# Don't count nightlights if they're currently on
# This allows other motion activated night lights to trigger with are_any_lights_on as condition
#kitchenNightlight = ["light.stove","light.fridge"]
#kitchenNightlightOn = hass.states.get('input_boolean.nightlight_kitchen')
#bedroomNightlight = ["light.entry"]
#bedroomNightlightOn = hass.states.get('input_boolean.nightlight_bedroom')
#livingroomNightlight = ["light.floor_lamp"]
#livingroomNightlightOn = hass.states.get('input_boolea.nightlight_livingroom')

# Get the light entities
#lights = hass.states.entity_ids('light')

# Kitchen filtering if night light is on
#if kitchenNightlightOn == 'on': lights = [x for x in lights.name if x not in kitchenNightlight]
#if bedroomNightlightOn == 'on': lights = [y for y in lights.name if y not in bedroomNightlight]
#if livingroomNightlightOn == 'on': lights = [z for z in lights.name if z not in livingroomNightlight]

for entity_id in lightEntities:
  state = hass.states.get(entity_id)
  # filter out bulbs not on
  if (state.state == 'on'):
    if ('tradfri' not in state.name):
      lightStatus = 'on'
      lightsOn = lightsOn + 1

for entity_id in switchEntities:
  state = hass.states.get(entity_id)
  if state.state == 'on':
    lightStatus = 'on'
    switchesOn = switchesOn + 1

if lightStatus == 'on':
  whichIcon = "mdi:lightbulb-on-outline"

totalOn = switchesOn + lightsOn

# Return sensor state
hass.states.set('input_boolean.anything_on', lightStatus, { 
    'friendly_name': 'Anything On?',
    'icon': whichIcon,
    'lights_on': lightsOn,
    'switches_on': switchesOn,
    'total_on': totalOn,
    'extra_data_template':'{total_on} lights on'
})

Thank you very much ‘Marius’, i’m sorry but the summary is not showing up anymore.

I have replaced the activity input_select, changed the png folder, changed the name of the automation to match with mine, deleted the light section for now, and replaced the group line.

Here is my updated code:

##########################################################################################
## https://github.com/maattdiy/home-assistant-config
## Screenshot: https://github.com/maattdiy/home-assistant-config/blob/master/screenshots/summary.png
## Script call: https://github.com/maattdiy/home-assistant-config/blob/master/config/packages/ha_triggers.yaml#L39

## Resources:
## https://home-assistant.io/components/python_script/
## https://home-assistant.io/docs/configuration/state_object/
##########################################################################################
debug = False
show_badges = True
show_card = True

group_count = 0
group_desc = ''
summary = ''
idx = 0

if debug:
    event = data.get('event')
    logger.error("\n\nSUMMARY: " + str(event))

##########################################################################################
## Group count (people and devices)
## Groups config: https://github.com/maattdiy/home-assistant-config/blob/master/config/groups.yaml#L267
##########################################################################################

# Entities summary by group name
groups = ['group.users_tracker'] # Groups need to have same member_count
groups_format = ['+{} at home: {}', '{} in use: {}', '!{} offline: {}'] # Message prefix
groups_filter = ['home', 'on|playing|home', 'off|idle|not_home'] # Filter to list
groups_badge = ['Home', 'In use', 'Status'] # Badge 'belt' (unit_of_measurement)
groups_badge_pic = ['', '', 'ok|bug|critical'] # Pictures: none, one, or a list of pictures (in this case the picture position will match the count)
groups_min_show = [0, 0, 0] # Mininum count to show
groups_desc = ['!Nobody home', '', '+System ok'] # Can set the default description, for use in case count = 0
groups_count = [0, 0, 0]

for group in groups:
    group_count = 0
    group_desc = ''

    for entity_id in hass.states.get(group).attributes['entity_id']:
        state = hass.states.get(entity_id)
        filter = groups_filter[idx]

        if (state.state in filter.split('|') or debug):
            dt = state.last_changed
            dt = dt + datetime.timedelta(hours=+1)
            time = '%02d:%02d' % (dt.hour, dt.minute)

          # If state changed in the past days show the date too
            if dt.date() < datetime.datetime.now().date():
                time = '{} {}'.format('%02d/%02d' % (dt.day, dt.month), time)

            group_count = group_count + 1
            group_desc = '{} {} ({}), '.format(group_desc, state.name, time)

    # Final format for this group
    if (group_count >= groups_min_show[idx]):
        if (group_count == 0):
            group_desc = groups_desc[idx]
        else:
            group_desc = groups_format[idx].format(group_count, group_desc[:-2])

        groups_desc[idx] = group_desc
        groups_count[idx] = group_count

    idx = idx + 1

##########################################################################################
## Badges updates
##########################################################################################

idx = 0
order = 2

if show_badges:
    for badge in groups_badge:
        if (badge != ''):
            entity_id = 'sensor.{}_badge'.format(badge.replace(' ', '').lower());
            hidden = False if (groups_count[idx] >= groups_min_show[idx] or debug) else True
            fname = groups_desc[idx] if debug else ' '
            picture = groups_badge_pic[idx].replace(' ', '').lower()

            # Check for picture X index/count
            if (picture != ''):
                list = picture.split('|')
                if (len(list) in [1, groups_count[idx]]):
                    picture = list[len(list)-1]
                else:
                    picture = list[groups_count[idx]]

                if (picture != ''):
                    picture = '/local/badges/{}.png'.format(picture)


            hass.states.set(entity_id, groups_count[idx], {
              'friendly_name': fname,
              'unit_of_measurement': badge, 
              'entity_picture': picture,
              'hidden': hidden,
              'order': order
            })

        order = order + 1
        idx = idx + 1

##########################################################################################
## Alarm clock
## Package: https://github.com/maattdiy/home-assistant-config/blob/master/config/packages/alarmclock.yaml
##########################################################################################

alarms_prefix = ['alarmclock_wd', 'alarmclock_we']
alarms_wfilter = ['1|2|3|4|5', '6|7']
alarms_desc = ''
idx = 0

for entity_id in alarms_prefix:
    state = hass.states.get('input_boolean.{}_enabled'.format(entity_id))
    if (not state is None):
        if (state.state == 'on'):
            # Show the alarm for the next day
            if (str(datetime.datetime.now().isoweekday()) in alarms_wfilter[idx].split('|')):
                state = hass.states.get('sensor.{}_time_template'.format(entity_id))
                alarms_desc = '{}{}, '.format(alarms_desc, state.state)
    idx = idx + 1

if (alarms_desc == ''):
    alarms_desc = '!Alarm clock is disabled'
else:
    alarms_desc = 'Alarm clock set at ' + alarms_desc[:-2]

##########################################################################################
## Mode:
## General package: https://github.com/maattdiy/home-assistant-config/blob/master/config/packages/profiles.yaml
## Developer package: https://github.com/maattdiy/home-assistant-config/blob/master/config/packages/developer.yaml
## Badges images: https://github.com/maattdiy/home-assistant-config/tree/master/www/profiles
##########################################################################################

mode_desc = ''
state = hass.states.get('input_select.ha_mode')

# Get info
#dt = datetime.datetime.now()
#time = "%02d:%02d" % (dt.hour, dt.minute)

if (not state is None):
    hidden = False #if (state.state != 'Normal') else True
    if (state.state != 'Unknown'):
        dt = hass.states.get('automation.mode_selection').attributes.get('last_triggered')
        if (not dt is None):
            time = "%02d:%02d" % (dt.hour+1, dt.minute)

        hass.states.set('sensor.mode_badge',state.state, {
         'entity_picture': '/local/profiles/{''}.png'.format(state.state.replace(' ','').lower()),
         'friendly_name': time, #was: ''
         'unit_of_measurement': 'Mode',
         'hidden': hidden,
         'order': order
          })
    if not hidden:
        mode_desc = '{}*{} mode selected at: {}\n'.format(summary, state.state, time)

##########################################################################################
## Activity:
##
##########################################################################################

activity_desc = ''
## Get activity description
state = hass.states.get('input_select.harmony_hub')
state_value = hass.states.get('input_select.harmony_hub').state
#time = '?'
# Get info
#dt = 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
    if state.state != 'Unknown':
        dt = hass.states.get('automation.activity_change').attributes.get('last_triggered')
        if not dt is None:
            time = "%02d:%02d" % (dt.hour+1, dt.minute)
    if not hidden:
        activity_desc = '{}*{} activity selected at: {}\n'.format(summary, state.state, time)
        
        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'
            })



##########################################################################################
## Summary update
## Custom card: https://github.com/maattdiy/home-assistant-config/blob/master/www/custom_ui/state-card-value_only.html
##########################################################################################

for group_desc in groups_desc:
    if group_desc != '' and not group_desc.endswith(': '):
        summary = '{}{}\n'.format(summary, group_desc)

# original
# summary = '{}\n{}\n{}'.format(summary, alarms_desc, mode_desc)
## Add to final summary
summary = '{}\n{}\n{}\n{}\n{}'.format(summary, alarms_desc, activity_desc, mode_desc, lights_desc)

if show_card:
    hass.states.set('sensor.summary', '', {
        'custom_ui_state_card': 'state-card-value_only',
        'text': summary
    })

Thanks for your time.

if you’ve deleted the lights section, you’ve got to edit the summary card at the bottom…

ive changed that to include the lights_desc, but you’ve not added that :slight_smile:

summary = '{}\n{}\n{}\n{}\n{}'.format(summary, alarms_desc, activity_desc, mode_desc, lights_desc)

take out an {} and the lights_desc, and it will be back (i hope)

that is, I see only one group, but you need three…with the same count of entities.

groups = ['group.users_tracker'] # Groups need to have same member_count

What do you mean by that? Ok i understand i need 3 group on the line in the summary.py. Each group should have for example 3 entities inside each of them?

Sorry i’m french and sometimes i get lost with translation.

juste!
pas de problème :wink:

Merci Marius :sweat_smile:

I having trouble getting it working. Will revert back to a previous saved file and add your config line by line and see if it works.

1 Like

Thanks Marius it works! But the activity hour displayed is kind not so prettty, do you know how can i fix this?

I also have trouble to display my activity badge, how do you name the ‘.png’ with a space in the name?
(for exemple for “SMART TV” activity: ‘smart tv.png’, ‘smarttv.png’, ‘smart.tv.png’)


im not really sure right now, but i believe the script takes care of spaces for you. That’s what this line is for:
picture = groups_badge_pic[idx].replace(' ', '').lower()
To be sure, ive renamed my image files to have no spaces… might be easiest. Also, don’t make hem to large, and use .png files, which i believe you do? Starting to look familiar :wink:

Cheers,
Marius

@mviezzer
HI Markus,

After trying just about anything in the customize department, trying to get the badges to show a condition based color (all is right show green_badge, attention show blue_badge, alert show red_badge (default)) I must conclude the badges or sensors can’t be customized?

They are top of the page sensors in my setup, showing on the front page, and the View/tab. I know top of the page badges are mentioned in custom-ui 26-1 update, but no further info is available…

If i try below code in the templating tool, it shows just fine, and the themes I call show fine too, when i set Hassio to that theme. Somehow i can not get to the sensors, created in this summary.py…

Please have a look, cause it could at the moment be the final touch to a very fine project thus far :+1:

Ive tried all version behind the ## comments also, unfortunately they wont result in the desired effect:

sensor.status_badge:
  templates:
    theme: >
       {%  if is_state('sensor.status_badge', '0') %} green_badge
       {% else %} default
       {% endif %}
#      if (state === 0) return 'green_badge'; else return 'default';

sensor.inuse_badge:
  templates:
    theme: >
       {%  if is_state('sensor.inuse_badge', '7') %} green_badge
       {% else %} default
       {% endif %}
#      if (state === 7) return 'green_badge'; else return 'default';
#        theme_template: "if (states.sensor.inuse_badge.state === 7) return 'green_badge'; else return null"

sensor.home_badge:
  templates:
    theme: >
      {%  if is_state('sensor.home_badge', '0') %} default
      {% else %} green_badge
      {% endif %}
#      if (state ==> 0) return 'green_badge'; else return 'default';
#     theme_template: "if (states.sensor.home_badge.state !== 0) return 'green_badge'; else return null"

Exactly. Dealing with web/linux is always safer use lower case and no spaces (or use underscore)

Cool, thanks. I’ll incorporate that.

This it will be a nice touch.
Already have my TO DO list growing, Try to do some updates this weekend.

Hi, badges theme working :slight_smile:

To work properly:

  1. The syntax should be in JavaScript (like in your #), not in Jinja2 (since runs on browser, not the server). I found in this page https://github.com/andrey-git/home-assistant-custom-ui/blob/master/docs/templates.md
  2. The sensor must pre exists to use customize (for example declared in sensor template instead of created by python). So I did the theme logic directly in summary.py, trying to simplify… so you don’t need create the customize and sensor template.

To implement:

  1. Create the themes green, purple, oragen, red… in frontend themes
  2. Update the summary py
    • See the new theme configuration (can use the theme name or an expression)
    • Apply the theme in here and here

WARNING: I rename the state-card-value_only to state-card-text, so be aware if you copy and paste… I think the new name fits better, since and i using in other sensors like the Quote of the day.

cool!

Thank you, this has been big search… finally solved! Ive seen that instruction in @andrey s page too of course, but couldn’t connect it here.

Now let’s play around with these themes, and create some nice logic!

I wanted to have the color follow the logic of the images. (0 offline: green_badge,1 offline: yellow_badge, 2 offline: orange_badge, more offline: red_badge) etc etc.

Since that would be too long for the configuration line, I declared it in a separate section/line and then imported it into the configuration line.
Especially considering the option to do that for the 3 badges, it would have built up some big chunk of if-,then-else code… :wink:

check:

groups_theme = [home_theme, in_use_theme, status_theme]

and:

home_theme = 'if (value == 0) return "black_badge";else if (value == 1) \
              return "yellow_badge";else if (value == 2) return "blue_badge"; \
                 else return "green_badge"'
in_use_theme = 'if (value == 0) return "red_badge";else if (value == 1) \
                 return "orange_badge";else if (value == 2) return "yellow_badge"; \
                 else return "green_badge"'
status_theme = 'if (value == 0) return "green_badge";else if (value == 1) \
                return "brown_badge";else if (value == 2) return "orange_badge"; \
                 else return "red_badge"'

btw: Is there a better way to wrap this over the lines than this? I’ve tried parenthesis etc, according to the python-style guide without the desired effect… https://www.python.org/dev/peps/pep-0008/#id19

please let me get back on 2 other searches:

  • I’d love to have the Nobody home line display the time too, but cant seem to get that done correctly. Im not sure where the best place of calculating that would be done in the summary.

  • im trying to have the summary card show some extra text-colors (eg my lights line in yellow) and also, try to display that in italics. If i add the color to the state-card-value_only like the other colors, it doesn’t work:

      <style is="custom-style" include="iron-flex iron-flex-alignment"></style>
      <style>
        .normal {
          @apply(--paper-font-body1);
          color: var(--primary-text-color);
          margin-left: 8px;
          text-align: left;
          line-height: 20px;
        }
        .bold {
          @apply(--paper-font-body1);
          color: var(--primary-text-color);
          font-style: italic;
          margin-left: 8px;
          text-align: left;
          line-height: 20px;
        }
        .red {
          @apply(--paper-font-body1);
          color: var(--google-red-500);
          margin-left: 8px;
          text-align: left;
          line-height: 20px;
        }
        .green {
          @apply(--paper-font-body1);
          color: var(--google-green-500);
          margin-left: 8px;
          text-align: left;
          line-height: 20px;
        }
        .yellow {
          @apply(--paper-font-body1);
          color: var(--google-yellow-500);
          margin-left: 8px;
          text-align: left;
          line-height: 20px;
        }
      </style>
      
      <template is="dom-repeat" items="[[computeStateDisplay(stateObj)]]">
        <div class$="[[computeClass(item)]]">[[computeItem(item)]]</div>
      </template>
      
    </template>
    

Cheers!
Marius

been having a go and a bit of fun…
ordered 8 badge_themes along severity, crowdedness or use-count. Take your pick.

home_theme = 'if (value == 0) return "red_badge"; else if (value == 1) \
              return "yellow_badge"; else if (value == 2) return "blue_badge"; \
              else if (value == 3) return "orange_badge"; else if (value == 4) \
              return "brown_badge";else if (value == 5) return "black_badge"; \
              else if (value == 6) return "grey_badge"; else return "green_badge"'
in_use_theme = 'if (value == 0) return "red_badge"; else if (value == 1) \
              return "yellow_badge"; else if (value == 2) return "blue_badge"; \
              else if (value == 3) return "orange_badge"; else if (value == 4) \
              return "brown_badge";else if (value == 5) return "black_badge"; \
              else if (value == 6) return "grey_badge"; else return "green_badge"'
status_theme = 'if (value == 7) return "red_badge"; else if (value == 6) \
              return "yellow_badge"; else if (value == 5) return "blue_badge"; \
              else if (value == 4) return "orange_badge"; else if (value == 3) \
              return "brown_badge";else if (value == 2) return "black_badge"; \
              else if (value == 1) return "grey_badge"; else return "green_badge"'

btw. Spent the better part of the morning debugging a horrid 404 error caused by the logger, according to the system log. one minor glitch in frontend_themes.yaml (light_grey, instead of lightgrey) and the whole Frontend wouldn’t load. This seems somewhat unrobust. Ridiculous infact such a minor error blocking the full system.

Anyways, backup again :wink:

new through-development:

just letting you know adding an extra sensor was easier than nothing, expanding on the blocks available in Summary.py.

Needed a at a glance overview of the media players in the house…added a few bits and pieces,et voila!

18

all i did was:

home_theme = 'if (value == 0) return "red_badge"; else if (value == 1) \
              return "yellow_badge"; else if (value == 2) return "blue_badge"; \
              else if (value == 3) return "orange_badge"; else if (value == 4) \
              return "brown_badge"; else if (value == 5) return "black_badge"; \
              else if (value == 6) return "grey_badge"; else return "green_badge"'
in_use_theme = 'if (value == 0) return "red_badge"; else if (value == 1) \
              return "yellow_badge"; else if (value == 2) return "blue_badge"; \
              else if (value == 3) return "orange_badge"; else if (value == 4) \
              return "brown_badge"; else if (value == 5) return "black_badge"; \
              else if (value == 6) return "grey_badge"; else return "green_badge"'
status_theme = 'if (value == 7) return "red_badge"; else if (value == 6) \
              return "yellow_badge"; else if (value == 5) return "blue_badge"; \
              else if (value == 4) return "orange_badge"; else if (value == 3) \
              return "brown_badge"; else if (value == 2) return "black_badge"; \
              else if (value == 1) return "grey_badge"; else return "green_badge"'
avg_theme = 'if (value == 0) return "red_badge"; else if (value == 1) \
              return "yellow_badge"; else if (value == 2) return "blue_badge"; \
              else if (value == 3) return "orange_badge"; else if (value == 4) \
              return "brown_badge"; else if (value == 5) return "black_badge"; \
              else if (value == 6) return "grey_badge"; else return "green_badge"'

# Entities summary by group name # Groups need to have same member_count
groups = ['group.family', 'group.hubs_binary_pinged', 'group.critical_devices_state', 'group.tracked_avg_summary'] 
groups_format = ['+{} at home: {}', '{} in use: {}', '!{} offline: {}', ' {} playing: {}'] # Message prefix
groups_filter = ['home', 'on|playing|home', 'off|idle|not_home', 'home|playing|on'] # Filter to list
groups_badge = ['Home', 'In use', 'Status', 'Playing'] # Badge 'belt' (unit_of_measurement)
groups_badge_pic = ['', '', 'ok|bug|critical', ''] # Pictures: none, one, or a list of pictures (in this case the picture position will match the count)
groups_min_show = [0, 0, 0,0] # Mininum count to show
groups_theme = [home_theme, in_use_theme, status_theme, avg_theme] # Theme template
groups_desc = ['!Nobody home', '', '+System ok', '+At ease'] # Can set the default description, for use in case count = 0
groups_count = [0, 0, 0,0]

might fiddle about with the options possible (badge_colors obviously ), but worked right out of the box. So cool.

Cheers,
Marius

somehow it does work now somewhat… One discrepancy is that where * should render bold text, it shows italic. grey, brown and blue are also not working yet. Why would that be?

.green {
        @apply(--paper-font-body1);
        color: var(--google-green-500);
        margin-left: 8px;
        text-align: left;
        line-height: 20px;
      }
      .yellow {
        @apply(--paper-font-body1);
        color: var(--google-yellow-500);
        margin-left: 8px;
        text-align: left;
        line-height: 20px;
      }
      .grey {
        @apply(--paper-font-body1);
        color: grey;
        margin-left: 8px;
        text-align: left;
        line-height: 20px;
      }
      .brown {
        @apply(--paper-font-body1);
        color: brown;
        margin-left: 8px;
        text-align: left;
        line-height: 20px;
      }
      .blue {
        @apply(--paper-font-body1);
        color: blue;
        margin-left: 8px;
        text-align: left;
        line-height: 20px;
      }

and

  computeClass: function (item) {
      switch(item.trim().substring(0,1)) {
      case "*": return "bold";
      case "!": return "red";
      case "+": return "green";
      case "=": return "yellow";
      case "%": return "grey";
      case "$": return "brown";
      case "#": return "blue";
      default:  return "normal";
      }
  },

ive expanded a bit, and changed the place in summary.py where to put the special characters. Depending on the syntax and logic of the building blocks the special characters need to go in the desc bit, or the groups at the top of the script.

real easy to test, because of the ‘hot’ effect of python scripts. So much easier than yaml needing to restart each time of a change…

Only wish left for now: show the time after "Nobody home since: ".

Cool.

things are progressing: fixed the state-card-text_only to show bold And italic (failed to show brown and grey still, working on that)

also, changed the theme selection a bit further, though it must be possible to do that smarter in a loop or so (separate thread on community: Smarter (shorter) template possible? loop in Python with help from @gpbenton …)

04

up_theme = 'if (value == 0) return "red_badge"; else if (value == 1) \
              return "yellow_badge"; else if (value == 2) return "blue_badge"; \
              else if (value == 3) return "orange_badge"; else if (value == 4) \
              return "brown_badge"; else if (value == 5) return "black_badge"; \
              else if (value == 6) return "grey_badge"; else if (value == 7) \
              return "green_badge"'

down_theme = 'if (value == 7) return "red_badge"; else if (value == 6) \
              return "yellow_badge"; else if (value == 5) return "blue_badge"; \
              else if (value == 4) return "orange_badge"; else if (value == 3) \
              return "brown_badge"; else if (value == 2) return "black_badge"; \
              else if (value == 1) return "grey_badge"; else if (value == 0) \
              return "green_badge"'

and

groups_theme = [up_theme, up_theme, down_theme, up_theme ]

Hi @Mariusthvdb, cool updates!

Addressing some issues, need more tests, but the main idea is there!
I change diferent places, so I will hint the key word for you to search in source or check the github diff.
Full summary py
Only diffs summary py

"Nobody home line since:"
I added dt_prevstate, to keep the last previous change, so will contains the time that the last person go out.

"Smarter (shorter) template possible? loop in Python"
I simplify adding the similar logic for conditional pictures (in status). So set themes in a list separed by | (the index in the “list” will the value considered to apply the theme). All in phyton, no need deal with JS.
Like: groups_theme = [‘entity_green’, ‘entity_purple’, ‘entity_green|entity_orange|entity_red’]
Search for theme

"failed to show brown and grey still, working on that"
Try the color in hex

sounds like the solution, but gives me this for now:

  File "summary.py", line 84, in <module>
TypeError: '>' not supported between instances of 'NoneType' and 'datetime.datetime'

line 84 being: if (state.last_changed > dt_prevstate):

maybe the last_changed wasn’t set yet somehow? or isn’t it recorded? I am really out of my options here, tried it all as far as i can imagine, no syntax errors at all. If i take out these 2 lines, the full script runs, and adds the ‘since : time’ to the 0 values. Its just this comparison that won’t pass the python logic…

27

btw: it shows this message now on all group items, while i needed it only on the Home group. Can this be adopted/change from a global setting to a setting for just one group?

i fail to understand why the used code isn’t correct while it is for the others used. I purposely used the codes of the imported ha_style…
your suggestion of Hex colors worked btw. As a second best option this will do. Still need an answer to understand why the first option won’t work, if only for educational purposes :wink:

Of course!. Magic!!
tried immediately, changed it a bit and taken the lists out again, and import them from this declaration i put above:

up_theme = '[red_badge|yellow_badge|blue_badge|orange_badge|brown_badge|black_badge|grey_badge|green_badge|default]'

down_theme = '[default|green_badge|grey_badge|black_badge|brown_badge|orange_badge|blue_badge|yellow_badge|red_badge]'

with:

groups_theme = [up_theme, up_theme, down_theme, up_theme, up_theme ]

it does work, though the reverse (down_theme) isn’t correct yet. Would you be able to have a look at that? I think it has to do with the fact my lists start with count =0?

hoped to establish something like this:

theme = ["red_badge","yellow_badge","blue_badge","orange_badge","brown_badge",\
             "black_badge","grey_badge","green_badge"]

groups_theme = ['return theme[value]', 'return theme[value]', 'return theme[len(theme)-value]', 'return theme[value]' ]  

(idea by @gpbenton)

duh…
no [ ]…

up_theme = ‘red_badge|yellow_badge|blue_badge|orange_badge|brown_badge|black_badge|grey_badge|green_badge’

down_theme = ‘green_badge|grey_badge|black_badge|brown_badge|orange_badge|blue_badge|yellow_badge|red_badge’

if there could be a simple way to reverse the theme, (instead of the second down_theme) that would make it even better.

about the colors in text-only_card: cant we just use these color codes? or these:https://github.com/PolymerElements/paper-styles/blob/master/color.html

must the codes used in the html file be defined anywhere else? i cant understand now why i can use the other colors, and only brown and grey are not shown. I don’t get an error at all, just a default font color.

HI @mviezzer,

just as with the customization if the badges themes, isn’t it possible to have these badges in a group, and show them as badges using state_card_mode: badges ?

Now that all creating badges is about to reach its final stages (…) embellishing and formatting is in order. really would love to have them put in a group showing the badges as shown above 36, and not like this…
37