Lovelace: custom state-switch as entity

Hi,

I am using the custom state-switch from @thomasloven.

Would it be possible to show it as an entity rather than a card? See the following below:

image

I would like to show the “Floor Lamp” as the others.

lovelace:

entities:
  - entity: light.milight_5712_01
    states:
      'on':
        entities:
          - entity: light.milight_5712_01
            type: 'custom:slider-entity-row'
        type: entities
    type: 'custom:state-switch'
  - entity: light.neopixel_leds
    type: 'custom:slider-entity-row'
  - entity: light.milight_5712_03
    type: 'custom:slider-entity-row'
  - entity: light.kitchen_pendants
    type: 'custom:slider-entity-row'
show_header_toggle: false
type: entities

Weeeelllll… you could remove the border using card-modder…

type: entities
show_header_toggle: false
entities:
  - entity: light.milight_5712_01
    type: custom:card-modder
    style:
      box-shadow: none
    card:
        type: 'custom:state-switch'
        states:
          'on':
            type: entities
            entities:
              - entity: light.milight_5712_01
                type: 'custom:slider-entity-row'
  - entity: light.neopixel_leds
    type: 'custom:slider-entity-row'
  - entity: light.milight_5712_03
    type: 'custom:slider-entity-row'
  - entity: light.kitchen_pendants
    type: 'custom:slider-entity-row'

A much much better way, though, would be to use auto-entities:

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - entity_id: light.milight_5712_01
      state: on
      options:
        type: custom:slider-entity-row
    - entity_id: light.neopixel_leds
      options:
        type: custom:slider-entity-row
    - entity_id: light.milight_5712_03
      options:
        type: custom:slider-entity-row
    - entity_id: light.kitchen_pendants
      options:
        type: custom:slider-entity-row
3 Likes

Thanks @thomasloven.

I went for the auto-entities part :+1:

For anyone who wants to know… this is how i have it:

Can you share config to this screens ?

Sure

cards:
  - cards:
      - color_thresholds:
          - color: '#f39c12'
            value: 20
          - color: '#d35400'
            value: 21
          - color: '#c0392b'
            value: 21.5
        entities:
          - sensor.living_temperature
        graph: line
        name: Temperature
        type: 'custom:mini-graph-card'
      - entities:
          - sensor.living_humidity
        graph: line
        line_color: lightblue
        name: Humidity
        type: 'custom:mini-graph-card'
      - entities:
          - sensor.living_pressure
        graph: line
        line_color: indianred
        name: Pressure
        type: 'custom:mini-graph-card'
      - entities:
          - sensor.living_illuminance
        graph: line
        line_color: yellow
        name: Illuminance
        type: 'custom:mini-graph-card'
    parameters:
      scrollbar:
        hide: true
        snapOnRelease: true
    type: 'custom:swipe-card'
  - columns: 4
    entities:
      - entity: sensor.living_climate_battery
        name: Climate_battery
      - entity: binary_sensor.living_occupancy
      - entity: switch.living_room_tv
      - entity: light.living_lights
        tap_action:
          action: toggle
    show_name: true
    show_state: true
    type: glance
  - columns: 4
    entities:
      - entity: light.milight_5712_01
        tap_action:
          action: toggle
      - entity: light.neopixel_leds
        tap_action:
          action: toggle
      - entity: light.bookshelves
        tap_action:
          action: toggle
      - entity: light.dining
        tap_action:
          action: toggle
    show_name: true
    show_state: true
    type: glance
  - card:
      type: entities
    filter:
      include:
        - entity_id: light.milight_5712_01
          options:
            type: 'custom:slider-entity-row'
          state: 'on'
        - entity_id: light.neopixel_leds
          options:
            type: 'custom:slider-entity-row'
          state: 'on'
        - entity_id: light.bookshelves
          options:
            type: 'custom:slider-entity-row'
          state: 'on'
        - entity_id: light.dining
          options:
            type: 'custom:slider-entity-row'
          state: 'on'
    type: 'custom:auto-entities'
title: Living
type: 'custom:vertical-stack-in-card'