Closed Anonym-tsk closed 2 years ago
I can't reproduce it locally.... are you using the latest version of this component and home assistant?
I use component from master and latest HA.
I see, sadly it doesn't happen to me so I can't fix what i can't see
I ran HA locally and reprodiced problem
Just create new lovelace card with content
type: entities
entities:
- type: custom:mini-humidifier
entity: fan.mi_humidifier_kids
model: xiaomi_miio_airpurifier:deerma.humidifier.mjjsq
name: Увлажнитель в детской
icon: mdi:air-purifier
group: true
sorry, as I said, for me it doesn't happen... If you know how to debug and fix, a PR will be more than welcome
Save lovelace and refresh the page
already did, still no issue appears...
I don't know why do you need @lit-labs/scoped-registry-mixin
and extends ScopedRegistryHost
, but without it all works well.
I think that problem in globalElementLoader
, because it register modules asynchronously and after card render.
class MiniHumidifier extends LitElement
This behavior is relatively new and it is required by the guidelines of HA as they urge developers to not pollute/rely on the global scope of registered elements. please refer to #80. There isn't supposed to be an issue with the module being registered asynchronously. If there was, all of your cards would not have worked, but according to you, they do. If you remove what you removed, it might work now, but can be broken at any moment without any prior notice from HA. Can you pinpoint to something more specific that causes the issue?
So...
If i skip first 1-2 render
calls, then all works.
I think it's because first render
called before globalElementLoader('ha-icon')
resolved.
My configuration:
There are no icons:
But (!!!) if i add card with one humidifier:
It fixes all humidifiers on all cards: