Git Product home page Git Product logo

Comments (3)

gunrunner20 avatar gunrunner20 commented on May 28, 2024

Hi @mfabiani53,
I currently have the same issue. I'm on RPi4 and 0.116.0.
Also have double-checked my two configs + card debug mode.

Nevertheless, it seems like you're using non RGB lights (x,y: null), is that correct?
In that case both your light_profiles.csv and the profiles in your ui-lovelace.yaml must contains zeros:

light_profiles.csv

id,x,y,brightness
bright,0,0,254

and

ui-lovelace.yaml

light_profiles:
  bright: '0,0,254'

and then in debug mode you should see x,y: null brightness: 254

Almost a year ago I've struggled with the issue that just RGB lights were supported by the card.
It's documented in the Home Assistant forum (also see the following posts).

from lovelace-light-with-profiles.

fantnhu avatar fantnhu commented on May 28, 2024

Hi! The same problem:

with debug:
x,y:null brightness:148

I can control the lamp by clicking on the icons, but the icon will not get the ACTIVE attribute and the icon will not be active either.

light_profiles.csv:
id,x,y,brightness
bright,0,0,254
dimmed,0.457,0.408,150
nightlight,0.457,0.408,38

ui-lovelace.yaml:
light_profiles:
bright: '0,0,254'
background: '0.457,0.408,150'
dimmed: '0.457,0.408,38'

My custom card:
type: 'custom:light-with-profiles'
title: Nappali
debug: true
entities:

  • entity: light.yeelight_ceiling5_0x0000000007d04907
    name: Mennyezet
    icon: 'mdi:ceiling-light'
    profiles:
    • name: bright
      icon: 'mdi:brightness-5'
    • name: dimmed
      icon: 'mdi:brightness-4'
    • name: nightlight
      icon: 'mdi:brightness-3'
  • entity: light.nappali_e14
    name: Éjjeli lámpa
    icon: 'mdi:lightbulb-outline'
    profiles:
    • name: bright
      icon: 'mdi:brightness-5'
    • name: dimmed
      icon: 'mdi:brightness-4'
    • name: nightlight
      icon: 'mdi:brightness-3'

Do you know a solution? Any ideas?
Thanks: István

from lovelace-light-with-profiles.

mdewyer avatar mdewyer commented on May 28, 2024

I also had these issues, but have been able to get it working with some adjustments.

First, I had to modify the light-with-profiles.js file, and my profileClass function is now this:

  profileClass(stateObj, profile) {

    let brightness = stateObj.attributes.brightness || stateObj.brightness;

    if (brightness) {

      let xyColor = stateObj.attributes.xy_color || stateObj.xy_color;
      let xyColorString = '0,0';
      if (xyColor) xyColorString = xyColor.toString();

      const activeProfile = `${xyColorString},${brightness.toString()}`;

      if (activeProfile === this.lightProfiles[profile]) {
        return true;
      }

    }

    return false;
  }

Second, instead of putting light_profiles: in ui-lovelace.yaml, I put it into the view's yaml (Overview -> Edit Dashboard -> Raw configuration editor) at the top level. Not sure if this is necessary or if my ui-lovelace.yaml file is messed up.

Third, the light_profiles.csv file doesn't seem to be necessary (nor can I find a reference to it in the code) so I've deleted that file.

With these changes it seems to be working as intended!

from lovelace-light-with-profiles.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.