Lovelace: Bringing back entity-filter (monster-card)


#41

Do not use when. Use state under include. When is for showing/hiding the whole card based on an arbitrary condition


#42

Thanks… I got it figured out.


#43

I’ve been trying to use this to display a map showing just those people who are away from home and for the map to not display if nobody is away from home. I also want a few zones to show on the map. Without the zones, it works:

- type: custom:monster-card
    show_empty: false
    card:
      type: map
      title: People away from home
    filter:
      include:
        - entity_id: device_tracker.person1
        - entity_id: device_tracker.person2
        - entity_id: device_tracker.person3
      exclude:
        - state: home

However, if I include the zones like this:

- type: custom:monster-card
    show_empty: false
    card:
      type: map
      title: People away from home
    filter:
      include:
        - entity_id: device_tracker.person1
        - entity_id: device_tracker.person2
        - entity_id: device_tracker.person3
        - entity_id: zone.home
        - entity_id: zone.work
        - entity_id: zone.another_place
      exclude:
        - state: home

the card displays even when everyone is at home. Is there any way to have the zones display on the map, but be hidden if everyone is at home?


#44

@Steven_Rollason I don’t think you need monster-card. You probably are good with a combination of:
https://www.home-assistant.io/lovelace/entity-filter/ and https://www.home-assistant.io/lovelace/conditional/

Even for monster-card, you should not put zone in the filter it should be under when (based on docs). Please have a look at the two cards I linked from the official lovelace docs.


#45

I’ve tried that, but ran into a couple of issues.
The first is that entity-filter doesn’t support negative state checks, and checking for the state being “not_home” isn’t the same as checking for it not being “home” (it only picks up people who are not in any zone, from what I have found).
The second is that the conditions in the conditional card appear to be ANDed and not ORed, as if I use the following:

conditions:
      - entity: device_tracker.person1
        state_not: "home"
      - entity: device_tracker.person2
        state_not: "home"

It only shows the card if both people are away from home and not, as I want, if either of them are away. Am I doing something wrong or is this not possible?


#46

I am getting this error when trying to add monster-card:

Custom element doesn't exist: monster-card.

{
  "type": "custom:monster-card",
  "card": {
    "type": "glance",
    "title": "Monster"
  },
  "filter": {
    "include": [
      {
        "domain": "sensor",
        "attributes": {
          "battery_level": "< 25"
        }
      }
    ]
  }
}

I have the monster-card.js in the www/ folder, copied the code as raw. Java version is latest. Restarted several times, and trying several browsers and even computers. same message.
Anyone knows what could be wrong?


#47

Do you have a reference to the card?

resources:
  - url: /local/monster-card.js?v=1
    type: js

#48

yup. it is in the ui-lovelace.yaml, right?


#49

yes.

And you have the correct path to the file? I can’t think of anything else… (and for the future, you don’t have to restart HA when editing ui-lovelace.yaml, this will save you a lot of precious time :slight_smile: )


#50

Naaah, but I thought that the addition of the .js file might require a restart. Yes the path should be correct. Strange :S


#51

I’m having trouble using another custom card as the card to display in monster-card. The custom card works fine on its own, but when used in monster-card I get the following error:

Uncaught TypeError: this.lastChild.setConfig is not a function

I’m thinking that this is probably this custom card script not being fully loaded at the time monster-card runs. Is this likely to be the reason and is there a way I can fix this?


#52

Hello everyone, this might be an easy question to answer but I was not able get the solution. Is there a way to filter items depending on their value(State). For instance only show the temperature sensors if the temperature it shows is below 25 degrees. I have custom battery sensors with dynamic icons and want to show them on a monster card. But was not able to filter out the ones with state values below 25. Thanks in return.

Found the answer:

- type: custom:monster-card
  card:
    type: entities
    title: Low Battery
  filter:
    include: 
    - entity_id: "sensor.*_battery"
    exclude:
    - state: '>= 30.0'

#53

I have the same problem as WonderMoose
Every time I refresh wtih f5 i get the error message

Custom element doesn’t exist: monster-card.

For every monster-card i have. It only blinks for a short while, then it works lika a charm.

Have tried a fresh ui-lovelace.yaml, restarts, redownload the monster-car.js, set java version to latest.

Any idea what the problem might be?


#54

Same issue here, running Homeassistant v0.78.


#55

The blinking of errors is a known issue -or a feature one might say- of the lovelace gui. I don’t know if a solution is in works.


#56

Is there a solution to this problem yet? I get it on all cards I have tried with the exception of

resources:
  - url: /local/alarm_control_panel-card.js?v=1
    type: js
  - url: /local/button-card.js
    type: module

The following give me the “doesn’t exist” error:

  - url: /local/monster-card.js?v=1
    type: js
  - url: /local/custom_ui/weather-card.js
    type: js

#57

Is it possible to filter same as “attributes” but with “last_updated” info?
I’m looking for a way to include only sensors that were changed/updated in the last 60 minutes.
For motion sensors I found ‘no motion since’ attribute that works for me, but there’s no such thing for door/window sensors.

Any thoughts?


#58

As long as that information is as a custom “attribute” on the entity it can be used. Check your dev-info panel for the entity that you want this information filtered for and see what you have.


#59

There’s no such attribute.
At the end finished by making just a template sensor and getting the value from: states.binary_sensor.door_window_sensor_xxxxx.last_updated


#60

Is it possible somehow to display the batterylevel under the entities instead of the state of the entity? (I am using monster card to show me sensors with low battery level)