#Does anyone know how I can use multiple

1 messages · Page 1 of 1 (latest)

prisma aspen
#

If you to stay with the mushroom chips, you'll want to use a mushroom template card. Here's a couple of examples to get you started:

#
type: custom:mushroom-chips-card
chips:
  - type: custom:mushroom-chips-card
    chips:
      - type: template
        entity: sensor.tv_plug_active_power
        content: |
          {{ ((states(entity) | int) > 5) | iif("TV is on", "TV is off") }}
        icon: |
          {{ ((states(entity) | int) > 5) | iif("mdi:television",
          "mdi:television-off") }}
        icon_color: |
          {{ ((states(entity) | int) > 5) | iif('green', 'red') }}
        tap_action:
          action: none
        hold_action:
          action: none
        double_tap_action:
          action: none```
#

And then a mushroom template card yaml type: custom:mushroom-template-card entity: sensor.fire_computer_desk_battery_level primary: '{{ states("sensor.fire_computer_desk_battery_level") }} %' icon: >- {{ is_state('binary_sensor.fire_computer_desk_plugged_in', 'on') | iif('mdi:battery', 'mdi:power-plug') }} icon_color: >- {{ is_state('binary_sensor.fire_computer_desk_plugged_in', 'on') | iif('red', 'green') }} tap_action: action: none

inland fern
#

As its a door sensor there are only 2 states {Opened and closed}

#

When I try to use the code as you say:

type: custom:mushroom-chips-card
chips:
  - type: custom:mushroom-chips-card
    chips:
      - type: template
        entity: binary_sensor.ts203_front_door_opening
        content: |
          {{ ((states(entity) | int) > 5) | iif("opened", "closed") }}
        icon: |
          {{ ((states(entity) | int) > 5) | iif("mdi:door",
          "mdi:mdi:door-closed") }}

it does not look to work

prisma aspen
#

use on and off

inland fern
#

SOO? opened/closed = ON/OFF

prisma aspen
#

basically

inland fern
#

when I try that it still does not display anything

prisma aspen
#

I forget which is which

#

Looks like you have the first two lines repeated on lines 3&4. Remove 3&4 and reduce indent for the rest.

#

wait... I just realized you used the example dealing with numbers. Remove | int > 5 from each one.

inland fern
#

Like this?

type: custom:mushroom-chips-card
chips:
  - type: custom:mushroom-chips-card
    chips:
      - type: custom:mushroom-chips-card
        chips:
          - type: template
            entity: binary_sensor.ts203_front_door_opening
            content: |
              {{ ((states(entity) | iif("on", "off") }}
            icon: |
              {{ ((states(entity) | iif("mdi:door",
              "mdi:mdi:door-closed") }}
#

Even then it does not display anything.

prisma aspen
#
  - type: custom:mushroom-chips-card
    chips:
      - type: template
        entity: binary_sensor.living_room_door_on_off
        content: |
          {{ ((states(entity)) == 'on') | iif("open", "closed") }}
        icon: |
          {{ ((states(entity)) == 'on') | iif("mdi:door-open",
          "mdi:door-closed") }}
        icon_color: |
          {{ ((states(entity)) == 'on') | iif('red', 'green') }}```
inland fern
#
Configuration errors detected:
No type provided.
prisma aspen
#

don't keep repeating (nesting) the first two lines. Ensure indentations are right.

#

If you're adding it to a spot where you already are displaying chips, just add the template section and line it up with the other chips. (if that makes sense....)

inland fern
#

AAH yes now it makes sense

prisma aspen
#

If you want, you can remove the content: section and just have the red/green open/closed icon. Then you're not using space for the open/closed.

inland fern
#

It looks to be working now.

prisma aspen
#

Looks good. But, now that we got that working, let's consider something else. What happens if the battery dies in your sensor. The state is going to be unavailable. With the code we just did, it is going to report the door as closed...

inland fern
#

In that case I will have to define it to show as YELLOW. [it currently shows as Closed, because it is improperly defined] [same was with the front door one, after redefining/setting the entity] it showed up correctly

the sensor that is unavailable is due it loosing connection for a bit. [sensor might be barely in range], have a few more cheap ones trough the 3=6$ sale on aliexpress [about 3.80$ per sensor] that are even worse when it comes to connection range. [it are the ones with a CR2032 battery]
[I did use a old asus router antenna from one of those gaming routers to give the sonoff zigbee adapter a better range, which did work]

prisma aspen
#

technically, the code we just did is only capable of red or green. it is one or the other. However, we can change it up a bit for some more flexibility. I'm trying to throw something together so it makes sense.

#

basically, it will be something along these lines. (This is code from another one of my examples.) yaml {% set state = (states(entity) | int) %} {% if state >= 75 %} mdi:battery-90 {% elif state >= 33 %} mdi:battery-40 {% else %} mdi:battery-10 {% endif %}

inland fern
#

I did notice one issue with the colored chips.

It does not open the device/entity state info when pressed.
[it gives a connection lost error]
pressing the normal chips does not pose any issues.

#

adding:

        tap_action:
          action: more-info

to the yaml info seems to fix it

prisma aspen
#

yeah. with the template cards, you have to define every little thing that you want it to do/show.

#
    icon: |
      {% set state = (states(entity))  %}
      {% if state == 'on' %} mdi:door-open
      {% elif state == 'off' %} mdi:door-closed
      {% else %} mdi:help
      {% endif %}```
#

you can also apply the same for the color and make it red/green/yellow.

inland fern
#

Adding that to the Icon part does not seem to work?

#

[Have to head off now as its getting late, will test other things later]

inland fern
#

My mistake, With Yaml spacing matters, after correctly spacing it It looks to work.

Now I only need to see how to change the color.

prisma aspen
#

Yup. Just jumped on here thinking spacing was the issue. You should be able to copy same code. Call it icon_color and set colors in place of the icon names.

inland fern
#

Then the Default Icon color should change to what is set?

like:


icon_color = Yellow
#

Tried adding it but it does not look to work?

prisma aspen
#
    icon_color: |
      {% set state = (states(entity))  %}
      {% if state == 'on' %} green
      {% elif state == 'off' %} red
      {% else %} yellow
      {% endif %}```
#

I forget which states = open or closed...

inland fern
#

ON/off where reversed

prisma aspen
#

also, I noticed a typo with the icons from yesterday. corrected to mdi:help.

inland fern
#

For now it looks to be working, will report back once one of the sensors looses connection.

prisma aspen
#

You can fake it in Developer Tools > States by setting the state.

inland fern
#

setting state to: unavailable changes the color to "Orange"

prisma aspen
#

and you should have a question mark for the icon. (or whatever if you changed it to somethihng else)