ciotlosm
(Marius)
July 4, 2018, 6:02pm
1
Monster card
Update on 6th of July : now filtering supports attributes!
Update on 12th of July : changelog added https://github.com/ciotlosm/custom-lovelace/blob/master/monster-card/changelog.md
As some of you know, in 0.72 a magical type of card called entity-filter was available in Lovelace. This card allowed for very smart content grouping without the need to specify a static list of entity_ids.
This card however was recently changed to allow only filtering on state, leaving users that desired even more flexibility without a toy.
I decided to take some code out of the original card and with guidance from @eddi89 I was able to bring back the card with more options under the name monster-card .
You can find the code here
Instructions
The instructions are also found on the above repo.
Download monster-card.js
Place the file in your config/www
folder
Include the card code in your ui-lovelace.yaml
resources:
- url: /local/monster-card.js?v=1
type: js
Note: You can change v=1 to a higher number whenever updating code to avoid having to clear cache in all browsers
Write configuration for the card in your ui-lovelace.yaml
- type: "custom:monster-card"
card:
type: glance
title: Monster
filter:
include: [{}]
exclude:
- entity_id: "*yweather*"
- domain: group
- domain: zone
- type: custom:monster-card
card:
type: glance
title: Monster
filter:
include:
- domain: device_tracker
options:
secondary_info: last-changed
attributes:
battery: 53
source_type: gps
You can find more examples in the docs.
Reload your Lovelace tab (no need to restart Home Assistant or other things) and you should see the card.
PROFIT!
FAQ: GitHub - ciotlosm/lovelace-thermostat-dark-card: 🌡 Thermostat card with a round and black feel to it
if you like the cards so much that wish to express your gratitude.
13 Likes
wellsi
(Ian Wells)
July 4, 2018, 6:42pm
2
This looks great, Why did the entity filter card become a state filter? I hope the monster is integrated into the main release.
ciotlosm
(Marius)
July 4, 2018, 7:01pm
3
I don’t think monster will make it into lovelace. I don’t want to comment on the decision to move to state filter, as this was explained on chat and git and I don’t want to explain it wrong.
On the positive side, I am AMAZED on how easy it is to create custom cards and integrate them. This card is nice also because it reuses existing lovelace card, so any updates on those will get automatically in monster card.
Snippet:
if (!this.card) {
this.card = document.createElement(`hui-${this.config.card.type}-card`);
this.appendChild(this.card);
}
dinth
(Michal)
July 4, 2018, 7:11pm
4
Ohh gosh, im just playing with lovelace on 0.72 right now and thought that entity_filter card was one of the greatest new features in HA in long time.
2 Likes
balloob
(Paulus Schoutsen)
July 4, 2018, 9:39pm
5
It’s been removed because it was too flexible, causing it to break with other features that we were adding across lovelace:
One could not override names, because to override names you already have to define the entities to expect. Why not mention them right away?
Same for custom UI
Same with ordering of entities
Yes, these things could be accomplished but you get a very complicated configuration that was difficult to reason about what was going to happen.
Removing it makes the Lovelace UI more explicit, meaning we could easily add a feature to show which entities are unused in the UI.
And at the end of the day, if you really really think you need it, copy this 86 lines custom card from the forums and you can have it back
7 Likes
wellsi
(Ian Wells)
July 4, 2018, 10:36pm
6
Thanks for commenting and giving the background. I’m looking forward to seeing how Lovelace develops.
It is a shock with it going away, but in a few releases time I may not miss it, or as you point out I can easily have the monster.
I am not exactly sure what has been removed but would the following code still work on 0.73.0b6?
- name: 'Docker'
cards:
- type: entity-filter
filter:
- entity_id: '*homeassistant*'
card_config:
title: "Home Assistant"
ciotlosm
(Marius)
July 5, 2018, 5:07pm
8
Config changed to allow it to be more dynamic.
You could use monster card with the following config:
- type: custom:monster-card
card:
title: Home Assistant
filter:
include:
- entity_id: '*homeassistant*'
Or have to switch to a manual entity_id list and probably entities
card.
minchik
(Aliaksandr)
July 7, 2018, 6:50am
9
Thank you very much! I can use Lovelace ui again.
ciotlosm
(Marius)
July 7, 2018, 7:49am
10
You now get attributes filter as well in monster-card
minchik
(Aliaksandr)
July 7, 2018, 7:54am
11
A small improvement to hide empty cards:
if (entities.length === 0) {
this.style.display = ‘none’;
return;
}
ciotlosm
(Marius)
July 7, 2018, 7:56am
12
Thanks. You cand do a PR to help the rest
ciotlosm
(Marius)
July 9, 2018, 12:20pm
13
I will just leave this here for inspiration for a new feature added:
- type: custom:monster-card
card:
type: glance
filter:
include:
- domain: climate
when:
entity: device_tracker.demo_paulus
state: not_home
Update : This will probably be possible to replace soon for any card with below code when PR gets merged:
- type: entity-filter
show_empty: false
entities:
- device_tracker.demo_paulus
state_filter:
- not_home
card:
type: custom:monster-card
card:
type: glance
filter:
include:
- domain: climate
kylerw
(Kylerw)
July 9, 2018, 3:03pm
14
So entity-filter will support the monster-card features? Does that mean the show_header_toggle will work as well, as it currently doesn’t with monster-card.
ciotlosm
(Marius)
July 9, 2018, 3:10pm
15
@kylerw entity-filter will probably be able to be used as a wrapper to toggle any card on or off, not specifically monster-card.
show_header_toggle
won’t work, but you can raise an issue for it to be added to monster card here: https://github.com/ciotlosm/custom-lovelace/issues
kylerw
(Kylerw)
July 9, 2018, 3:14pm
16
Thanks, just submitted.
Also, is it possible to filter on a calculation? state: < 20
for a battery alert card, for example?
ciotlosm
(Marius)
July 9, 2018, 3:19pm
17
Not at the moment. That is a bit more tricky to implement.
kylerw
(Kylerw)
July 9, 2018, 3:20pm
18
I’ll add a feature request with that understanding. Would be a great use of the filter, in my opinion.
drjared88
(Drjared88)
July 10, 2018, 2:40pm
19
Thanks for this! Is it possible to filter on if a state is not equal to something?
I am trying to have a cleaner way to display my chromecasts so I only want them to display if the state is not equal to ‘off’.