2024.8: Beautiful badges!

Thanks for showing us how this is done :+1: Works perfectly :wink:

Just added this to test in the UI and copied the YAML:

tap_action:
  action: perform-action
  perform_action: automation.turn_off
  target:
    entity_id: automation.3d_print_finished
  data:
    stop_actions: true
tap_action:
  action: perform-action
  perform_action: script.alarm_triggered

Things like that depends on DB size and machine that it sits on (CPU, disk). Mine has over 15GB and it took over 15h to finish (can’t find exact log entry, probably because of the restart I did) and it’s installed on SSD with i5-4570TE.

Looks like my database upgrade failed. Not sure if there is anything I can do with it or just start over with a new blank DB. I’m running MariaDB separately on my Synology with Home Assistant on Home Assistant Blue.

Logger: homeassistant.components.recorder.core
Source: components/recorder/core.py:988
integration: Recorder (documentation, issues)
First occurred: August 8, 2024 at 11:10:47 PM (1 occurrences)
Last logged: August 8, 2024 at 11:10:47 PM

Error during schema migration
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 988, in _migrate_schema
    new_schema_status = migrator(
                        ^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/migration.py", line 335, in migrate_schema_live
    schema_status = _migrate_schema(
                    ^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/migration.py", line 301, in _migrate_schema
    _apply_update(instance, hass, engine, session_maker, new_version, start_version)
  File "/usr/src/homeassistant/homeassistant/components/recorder/util.py", line 703, in wrapper
    job(instance, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/recorder/migration.py", line 710, in _apply_update
    migrator_cls(instance, hass, engine, session_maker, old_version).apply_update()
  File "/usr/src/homeassistant/homeassistant/components/recorder/migration.py", line 756, in apply_update
    self._apply_update()
  File "/usr/src/homeassistant/homeassistant/components/recorder/migration.py", line 1490, in _apply_update
    _modify_columns(
  File "/usr/src/homeassistant/homeassistant/components/recorder/migration.py", line 575, in _modify_columns
    with session_scope(session=session_maker()) as session:
  File "/usr/local/lib/python3.12/contextlib.py", line 144, in __exit__
    next(self.gen)
  File "/usr/src/homeassistant/homeassistant/helpers/recorder.py", line 104, in session_scope
    session.commit()
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 2017, in commit
    trans.commit(_to_root=True)
  File "<string>", line 2, in commit
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
    ret_value = fn(self, *arg, **kw)
                ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/orm/session.py", line 1309, in commit
    trans.commit()
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2629, in commit
    self._do_commit()
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2734, in _do_commit
    self._connection_commit_impl()
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2705, in _connection_commit_impl
    self.connection._commit_impl()
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1146, in _commit_impl
    self._handle_dbapi_exception(e, None, None, None, None)
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2356, in _handle_dbapi_exception
    raise exc_info[1].with_traceback(exc_info[2])
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 1144, in _commit_impl
    self.engine.dialect.do_commit(self.connection)
                                  ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 585, in connection
    return self._revalidate_connection()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 677, in _revalidate_connection
    self._invalid_transaction()
  File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 667, in _invalid_transaction
    raise exc.PendingRollbackError(
sqlalchemy.exc.PendingRollbackError: Can't reconnect until invalid transaction is rolled back.  Please rollback() fully before proceeding (Background on this error at: https://sqlalche.me/e/20/8s2b)

how can i have that type of badges with new version.

to avoid discussion on which is better or not I just need to know ho to do this.

1st row is one of the TABS in my dashboard and the 2nd row is in other TAB.
1st one change icon color based on state
2nd is bigger than normal badges


image

apparently I am not alone Badge pictures not showing - #3 by Caswell1000

Not linking this here because of the legacy versus new badges adjustment cycle.

But I do believe the tendency to use smaller elements is not optimal for accessibilty. The badges look truly shiny, but only for under 40… :eyeglasses:

Ofc, adding the option to not use the icon at all is hopefully in the works, and would solve this particular worry.

My remark here is more generic, hope the Frontend team will have eyes for that

2 Likes

has been explained quite a few times above now how to add the legacy badges to the 2024.8 Dashboard, just scroll back a bit

not just the badge, i’ve been reading since yesterday :slight_smile: ad the badge is easy but the styling is not working.
Like:

badges:
  - entity: person.XXXXXX
    card_mod:
      style: |
        :host {
          --ha-label-badge-size: 65px;
        }

Or:

badges:
  - entity: binary_sensor.XXXX
    card_mod:
      style: |
        :host {
          --card-mod-icon-color: 
              {% if is_state('binary_sensor.XXXXX', 'on') %}
                green
              {% else %}
                red
              {% endif %};
        }

Have you read the thread? You should do.

This is NOT a bug, this is about “user has not written a new appropriate card-mod code for a changed component”.
There are threads about card-mod, better to discuss there.

See no benefits of stacking plenty of unrelated entities in one table.
For me, the whole idea about a word “helper” should be reconsidered - there are entities in this table which are just a “sensor” for me (made by specific platform).
Like we used “services” and did not bother that they are latent “actions” in fact. Voila - they are “actions” now. Change in semantics - which does not seem to bring a trouble.

Yes, Home Assistant is full of these terms where “developers’ speak” was made the default. Template Sensors are named after the Python function that makes them possible instead of calling them “User Defined Sensors”.

4 Likes

as it seems to turn out, the assumption I made wasnt completely accurate above.

we’ve run several scripts in /entities and /helpers, and much to my surprise, the /helpers page shows even more updates in the states then the /entities page. Moreover, those are not only helpers, but all entities (ofc many sensors float by)

not yet found the solution, or even the true cause here,

about stacking the entities: I am not sure why the yaml (template) entities are now also listed in the Helpers. the subset of Helper entities is only getting bigger now, decreasing the difference between entities and helpers listing.

I kind of liked the UI only listing there, which, made it clear which listing to use.
But hey, I have no idea why this was changed, so maybe missing the advantage entirely.

1 Like

Anybody else seeing a broken homekit setup on Hass core? I’ve had a homekit config in my configuration.yaml since 2018, and now it fails with:

$ hass --script check_config
Testing configuration at /home/pi/.homeassistant
Incorrect config
  General Warnings:
    - Component error: homekit - Exception importing homeassistant.components.homekit

Successful config (partial)
  General Warnings:
$

The config is quite elaborate, but it even fails with the minimal config:

homekit:

Hass core 2024.8.0, Python 3.12.2 on a Raspberry Pi 3B with Raspbian Bookworm.

EDIT: The issue appears to be that the chacha20poly1305_reuseable module needs to be upgraded and that doesn’t happen when running the check_config script. Workaround:

  • comment out the homekit integration from the config file
  • rerun the check_config script, fix remaining warnings/errors
  • run hass in the noremal way
  • wait until startup completely (can take some time due to DB upgrades)
  • stop hass
  • restore homekit config
  • start hass

Honestly, one more reason for me NOT to get to the Helpers page.
99% of entities in my setup are made in yaml.
Why to use a UI-based solution if:

  • Helpers table is laggy (which you experienced - and I luckily did not);
  • UI-driven entities do NOT allow to use some supported functionality - like they do in yaml;
  • there are no packages, no reusable code.

(Not to mention a frequent glitch which seems to be fixed recently: adding a new “helper” causes showing a rotating ring while attempting to open a “Create helper” window - i.e. this window is opening for about a minute.)
I am simply not using this “Helpers” page - only in rare cases for testing mainly.

Created issue: Homekit fails to import with hass core 2024.8.0 · Issue #123460 · home-assistant/core · GitHub

yes! I noticed that yesterday, so not fixed yet apparently. Good this is been written up. Or is it? must find a link to then issue, so I can +1

The whole Dashboard feels less brisk than before since. I didnt really notice because all my efforts went to the config and helper page, but since running final betas on 8 and now release, this is really noticeable.

Other than that, I do have a lot of UI based helpers, and I always felt it was super nice to be able to change names/icon/show_as from within the UI.

and, it was super super fast. Was…
but I have undying faith in Karwosts :wink: he’ll fix it

edit

@Ildar_Gabdullin where was it mentioned we cant create a new helper in the UI? Cant find a reported issue on the matter?

nvm, found it Cannot add a new helper in UI sometimes - seeing a loading indicator · Issue #20809 · home-assistant/frontend · GitHub

I worked it out. It was a custom integration blocking it.

This is the issue
And you found it too.
The issue is old, I closed it before 2024.8.
Let me know if there is a need to reopen it (write smth in the issue).

Great that we have various ways to achieve our goals. But ofc it should be working smooth & predictable.

I rebooted and it is trying again. It’s four hours in though. If that fails I will just make a new DB and move on. Not sure what else to do.