Lovelace Card - Light with Profiles

@asa79 inside your config folder, same place as your configuration.yaml and lovelace.yaml files.

(updated main post with this info as well)

Thanks Thomas, I am pretty good with reading the docs, and I think this did need clarifying :slight_smile:

1 Like

Is it possible to use white_value in the profile? I have RGBW lights, if i don’t set any white value it just turns the white leds off. :confused:

1 Like

Hey folks,
I just started setting up this card together with a IKEA LED1623G12 ZigBee bulb. Just brightness choice possible, no RGB, no temperature.
The setup works in general, but…
neither the color highlighting of the current profile works, nor is the switch shown - although it’s clickable and controls the bulb.

Anyone any ideas?

grafik
grafik

I’ve set up the following:
../config/light_profiles.csv

id,x,y,brightness
bright,0.457,0.408,254
background,0.457,0.408,150
dimmed,0.457,0.408,77

../config/ui-lovelace.yaml

resources:
  - type: module
    url: /local/custom-lovelace/light-with-profiles.js

light_profiles:
  bright: '0.457,0.408,254'
  background: '0.457,0.408,150'
  dimmed: '0.457,0.408,77'

  - title: Arbeitszimmer
    path: arbeitszimmer
    icon: mdi:desk-lamp
    cards:
      - type: 'custom:light-with-profiles'
        title: Licht
        entities:
          - entity: light.0x000b57fffe143462_light
            profiles:
              - name: bright
                icon: 'mdi:brightness-5'
              - name: background
                icon: 'mdi:brightness-4'
              - name: dimmed
                icon: 'mdi:brightness-3'

Hey @mcg

I actually had this little issue myself. The card cant see what profile the light is using only the x,y,brightness value. It uses this to compare to the profiles you defined.

So how to solve this.

  1. click a profile on the card
  2. go to developer tools and go to states
  3. find the light on which you switched the profile
  4. see the values it really got (for some reason some lights aint taking the exact values you send)
  5. use the values it actally is using at put that in your config for the card and profiles.csv

this should fix the issue. let me know how it goes

Hey @tcarlsen

thanks for this constructive reply! I checked it and found (obviously) the following: As I just have a withe light bulb there are no rgb-/xy-entries for the color in that particular entity. The brightness has the same value as noted in the profile, though.
Would this automatically mean that the profile highlighting just works with rgb- AND brightness-controllable lights (as all three values are being compared?)

1 Like

every good question. and im not sure :slight_smile:
As off I dont have ani lights without xy I really cant test this.

But what I will try to do is add a debug setting that then will show the value its checking up against

1 Like

@mcg 2.1.0 is out. please go download and enable debug

type: 'custom:light-with-profiles'
title: Lys
debug: true
entities:
  - entity: light.spisestuen
  - entity: light.entreen
  - entity: light.kokken

and tell me what values you get

:heart_eyes:
Well, guess that result’s somehow what we expected :wink:
grafik
But my button is working now!

Any plans to get it added to HACS?

It is in hacs

Forgive me, I simply assumed (first mistake), that since it didn’t have the HACS default badge that it wasn’t in the HACs library. I should have looked before posting (second mistake). Thanks for the reply

1 Like

@mcg please go and upgrade to 2.2.0 I hope I made it possible to make brightness only profiles by setting x,y to 0,0 like this:

light_profiles:
  brightness_only: '0,0,150'

Thanks @tcarlsen, works like a charm now!
grafik

Just another question for my understanding:
Do I define the light profiles once in the ui-lovelace.yaml to have them available in the card and once in the light_profiles.csv to be compared against and make the highlighting possible? Or is there a slimmer way without the need of double documentation?

And maybe just another idea for future development after we now discussed lights with and without RGB: how about RGBW lights with the abilityto control the white temperatures? Or is this currently out of HA’s light profiles scope as there’s just RGB + brightness?

Thanks again and cheers! :slight_smile:

you are defining the light_profiles.csv because its the native way to make and use light profiles in HA
you are defining the profiles you wanna use in the card so the card can compare the values to see which profile is active. Cards dont have access to config files like the light_profiles.csv, so there is no other way around this if you want the active profile to light up.

If you can live with not having the icons show the active profile you can just dont add them in ui-lovelace.yaml. the card will still work, just not show the active profile :slight_smile:

hope the answers your question

1 Like

Im not sure if the native light profiles in HA can use anything else then x,y,brightness

1 Like

Hi,
In home assistant 0.106 there is not light_profiles.csv and lovelace.yaml.
Do we have to add them manually? Also do we have to enable lovelace.yaml mode in order to be able to customize it?

Yes you have to create the files. You always had to. :slight_smile:

I do beleive you can do it without yaml mode

Done. But it is not working as expected.
When I choose a light profile, nothing changes. Neither dims, nor change colour. Also doesn’t show which profile is enabled. Just on-off option.

Light_profiles.csv (in config folder):

Relax,0.5119,0.4147,144
Concentrate,0.5119,0.4147,219
Reading,0.4448,0.4066,240
Energise,0.368,0.3686,203
group.all_lights.default,0.326,0.333,255

ui-lovelace.yaml (in config folder):

resources:
  - type: module
    url: /local/light-with-profiles.js

light_profiles:
  bright: '0.5119,0.4147,254'
  dimmed: '0.5119,0.4147,77'
  nightlight: '0.363,0.3686,1'
  brightness_only: '0,0,150'

title: Home
views:
  - badges:
      - entity: binary_sensor.updater
      - entity: person.agma
      - entity: sensor.illumination_44237c82f84a
      - entity: sun.sun
    cards:
      - entities:
          - entity: automation.toggle_bedroom_light
          - entity: automation.toggle_kid_s_room_light
          - entity: automation.turn_off_night_light
          - entity: automation.night_mode
        title: Automation
        type: entities
      - entity: weather.spiti
        type: weather-forecast
      - aspect_ratio: 50%
        type: iframe
        url: 'https://www.home-assistant.io'
      - entities:
          - entity: person.agma
          - entity: device_tracker.eml_l29
        type: map
      - entities:
          - entity: camera.bedroom
        type: entities
    icon: 'mdi:home'
    path: default_view
    title: Home
  - badges: []
    cards:
      - entities:
          - entity: light.bedroom
            profiles:
              - name: bright
                icon: 'mdi:brightness-5'
              - name: dimmed
                icon: 'mdi:brightness-4'
              - name: nightlight
                icon: 'mdi:brightness-3'
          - entity: light.kid's room
            profiles:
              - name: bright
                icon: 'mdi:brightness-5'
              - name: dimmed
                icon: 'mdi:brightness-4'
              - name: nightlight
                icon: 'mdi:brightness-3'
        title: Lights
        type: 'custom:light-with-profiles'
    icon: 'mdi:lightbulb-on'
    path: lights
    title: Lights

Looks like whatever xy color I change in light_profiles.csv, my bulbs are not recognized in HA. Accepts only stock values. Any thoughts?

I really like the look and functionality of this.
And with the brightness only update, I can get some info out from my IKEA lights also :slight_smile:
Thank you for sharing.

You need to use the same profiles in the card as you have the profile.csv.

So you could add the profiles you use to the Light_profiles.csv (in config folder):

Relax,0.5119,0.4147,144
Concentrate,0.5119,0.4147,219
Reading,0.4448,0.4066,240
Energise,0.368,0.3686,203
bright,0.5119,0.4147,254
dimmed,0.5119,0.4147,77
nightlight,0.363,0.3686,1
group.all_lights.default,0.326,0.333,255

Now when you trigger the bright profile from the card, there is a bright profile in the csv config that can send that info to the light bulb.

1 Like