Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIDL 14149506L light colors not functioning properly #13421

Closed
crooy opened this issue Aug 5, 2022 · 70 comments
Closed

LIDL 14149506L light colors not functioning properly #13421

crooy opened this issue Aug 5, 2022 · 70 comments
Labels
problem Something isn't working stale Stale issues

Comments

@crooy
Copy link

crooy commented Aug 5, 2022

What happened?

I connected the LIDL 14149506L(https://www.zigbee2mqtt.io/devices/14149505L_14149506L.html#lidl-14149505l%252F14149506l), which went smoothly.

However as described in the discussion (#5944), the color only appear to work when cycling colors.

What did you expect to happen?

I expected realtime colors.

How to reproduce it (minimal and precise)

I have 2 of these lights and they both show the same problem.

Zigbee2MQTT version

1.27.0 commit: a9b8808

Adapter firmware version

20210120

Adapter

Slaesh CC2652RB stick

Debug log

No response

@crooy crooy added the problem Something isn't working label Aug 5, 2022
@Lynetk
Copy link

Lynetk commented Aug 6, 2022

Description of the problem from linked issue pasted for convenience.

It works "kinda". RGB only functions after power cycling the device. As soon as I try to change brightness or colour temperature the white LEDs come on and never get switched off, no matter what setting I try.

@Koenkk
Copy link
Owner

Koenkk commented Aug 6, 2022

Seems this device doesn't properly support the standard Zigbee commands so some reverse engineering is necessary. Can someone make a sniff of:

  • Pairing the device to the TuYa hub
  • Changing the color
  • Changing the color temp
  • Changing the color

https://www.zigbee2mqtt.io/advanced/zigbee/04_sniff_zigbee_traffic.html#with-cc2531

@mtrr
Copy link

mtrr commented Aug 12, 2022

Unfortunately I don't have the needed equipment, if somebody in Germany is capable of doing the legwork, I'd be willing to donate my lamp (or donate 20,- EUR so that one could be bought from lidl)

@crooy
Copy link
Author

crooy commented Aug 26, 2022

Unfortunately I don't have the needed equipment, if somebody in Germany is capable of doing the legwork, I'd be willing to donate my lamp (or donate 20,- EUR so that one could be bought from lidl)

Same here, happy to share that donation!

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale Stale issues label Sep 26, 2022
@mtrr
Copy link

mtrr commented Sep 28, 2022

next week lidl Germany has them for € 17,99, so maybe ...

@github-actions github-actions bot removed the stale Stale issues label Sep 29, 2022
@oli-f
Copy link

oli-f commented Oct 2, 2022

Seems like deconz has the same problem with the device: dresden-elektronik/deconz-rest-plugin#5900

As can be seen in dresden-elektronik/deconz-rest-plugin#5900 (comment), the device has cold-white+warm-white LEDs (temperature mode) as well as independant RGB LEDs (color mode). Currently when changing the color, the cold-white+warm-white LEDs stay on.

Changing betwen the modes can be done via the tuyaRgbMode:

await entity.command('lightingColorCtrl', 'tuyaRgbMode', {enable: 1}, {}, {disableDefaultResponse: true});
...
await entity.command('lightingColorCtrl', 'tuyaRgbMode', {enable: 1}, {}, {disableDefaultResponse: true});

I achived minor improvement by using the tuya_led_control, however the color temperature is incorrect and in color mode the brighness can't be changed:

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    fingerprint: [
        {modelID: 'TS0505A', manufacturerName: '_TZ3000_gek6snaj'},
        {modelID: 'TS0505B', manufacturerName: '_TZ3210_iystcadi'}
    ],
    model: '14149505L/14149506L',
    vendor: 'Lidl',
    description: 'Livarno Lux light bar RGB+CCT (black/white) CUSTOM',

    toZigbee: [tz.on_off, tz.tuya_led_control],
    fromZigbee: [fz.on_off, fz.tuya_led_controller, fz.brightness, fz.ignore_basic_report],
    exposes: [e.light_brightness_colortemp_colorhs([153, 500]).removeFeature('color_temp_startup')],
};

module.exports = definition;

It seems like the device does not interpret the brightness from tuyaMoveToHueAndSaturationBrightness. The genLevelCtrl/moveToLevel switches the device to temperature mode and tuyaBrightness is not supported - so not sure how to set the brightness in color mode.

@lSh4dowl
Copy link

lSh4dowl commented Oct 7, 2022

I also have this device and this problem and another problem might be the fact, that the RGB Leds are super weak on their own.
I don't know how this device normally works since I only have home assistant to connect it to, but if I get the color set correctly (which feels very random) the light is super dimm.
On the other Hand, when the light is bright, only reddish colors work and blue for example results in pink, green results in orange.

Any progress ?

Edit: additionally, there seems to be the problem that the color leds are always on, even if I turn the device off over Zigbee.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2022

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale Stale issues label Nov 8, 2022
@steffen890
Copy link

not stale

@github-actions github-actions bot removed the stale Stale issues label Nov 9, 2022
@alterschlabberanesi
Copy link

Please See #12947

Looking for someone to sniff the traffic when controlling this device via the TuYa gateway

@ALotOfMooh
Copy link

Playing around with scenes in Home assistant sometimes the white LEDs turn off and color mode kind of works. I can change colors afterwards. Changing brightness, turn on white LEDs again.
Maybe that helps?

@KentuckyMC
Copy link

Got the same led here, and indeed the colors are very weird. Sometimes blue = blue, but changing brightness shows purple suddenly. Not sure what is going on with this one. With the chargeable LED light of Lidl those colors seems to work fine.

@stefan131
Copy link

I just got my Sonoff ZigBee stick and set it up with Zigbee2MQTT in Home Assistant.
You can actually get it to display just an RGB color, without W/WW

  • Set the light to any RGB color
  • Physically turn of the light
  • Wait a few seconds
  • Turn it back on, whoop only RGB

Now if you toggle it off and on in HASS, it will include white again.
A workaround for this is to turn off color_sync:
image

If you toggle the light with color_sync disabled, it will be green every time.
It does remember the last state, so you'll have to switch to a different color before being able to set the same color again.
Using a color temperature with this light means you'll have to physically turn if off and on again in order to get just RGB

deCONZ and ZHA seem to be having the same issue

@cbcotton
Copy link

It wont set color_xy after adjusting brightness in the interface. It will let you change color after adjusting color_temp first. Setting the color_temp also seems to override the brightness settings sometimes. Ive tried reproduce this accurately, sometimes it wont behave and wont dim the whiteleds when setting color_xy and sometimes it dims all leds to the lowest brightness.

  • Set brightness to 254
  • Set color_temp to warmest
  • Set color_temp to warm
  • Set color_temp to warmest
  • Set color_xy to choice

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale Stale issues label Jan 20, 2023
@ALotOfMooh
Copy link

not stale. As i stated scenes work 50% with setting a specific color. This might help someone

@github-actions github-actions bot removed the stale Stale issues label Jan 22, 2023
@RunnicFusion
Copy link

RunnicFusion commented Jan 23, 2023

Any update on this issue?
Is disabeling color_sync the way to go right now @Koenkk ?

@AndreKR
Copy link

AndreKR commented Jan 25, 2023

I still have the issue even with color_sync disabled.

@AndreKR
Copy link

AndreKR commented Jan 25, 2023

I have ordered a hub, will provide a packet capture when it arrives.

@RunnicFusion
Copy link

I still have the issue even with color_sync disabled.

Same over here

@AndreKR
Copy link

AndreKR commented Feb 23, 2023

Do you want to make a PR?

Koenkk/zigbee-herdsman-converters#5514

The final lidl.js file with my changes is not tested because I don't know if that's possible with a Docker installation of Z2M.

I only really know about the convertSet() function, I copied the options, fromZigbee and exposes settings from your file, so please check them (especially the color_sync() thing is now wrong?).

I "fixed" the transition at least for brightness and color temperature in white mode like this. Am I missing something or is the device just weird?

Also I have only tested the settings on the "Exposes" tab and in Home Assistant. In particular I did not test any reading/writing using the "Dev console" tab and I also don't know what fromZigbee and convertGet() do.

Do you see the device responding with a default response message?

I think so:

image

@KentuckyMC
Copy link

Just want to say, thanks for your effort to fix this issue! Can't wait till it's in z2m :) Have a nice day!

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Feb 23, 2023
* Fix color handling for LIDL light bar (Koenkk/zigbee2mqtt#13421)

* Update lidl.js

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
@Koenkk
Copy link
Owner

Koenkk commented Feb 23, 2023

I've merged the changes from @AndreKR.

Changes will be available in the dev branch in a few hours from now (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html) and in the 1 February release.

@AndreKR

  • Could you do a final check with the latest dev to confirm everything works? Don't forget to remove your external converter otherwise that will be used instead.
  • Could you check if the color sync works by changing return {state: newState}; in your converter to return {state: libColor.syncColorState(newState, meta.state, entity, meta.options, meta.logger)};. To test if it works, change e.g. the color temp and observe that the HS color also changes (and the other way around).

I "fixed" the transition at least for brightness and color temperature in white mode l

  • The link links to an unrelated location, can you give me the correct link?

Also I have only tested the settings on the "Exposes" tab and in Home Assistant. In particular I did not test any reading/writing using the "Dev console" tab and I also don't know what fromZigbee and convertGet() do.

  • These are needed when another device can also change the led state or when the device has button on it to turn it on/off. I've looked at the code and this should work.

Do you see the device responding with a default response message?

As controlling works now, we can keep it like this. The default response gives Zigbee2MQTT guarantees that the message arrived at the controller.

@tkuehling
Copy link

Hoi all,

i did an explorative Test and found one issue. If i use a color, i'm unable to set the brightness. If i try, it switches from RGB to CCT Mode. Also if i refresh brightness in RGB Mode, i'll get this Error:

2023-02-23 20:21:55Publish 'get' 'color_temp' to 'LIDL_RGBbar1' failed: 'Error: Cluster 'lightingColorCtrl' has no attribute 'currentLevel''

Anyhow, it's now able to set the correct brightness in CCT Mode and i'm able to Switch between both modes.

Thanks a lot for your Work!

@AndreKR
Copy link

AndreKR commented Feb 25, 2023

@Koenkk

Could you do a final check with the latest dev to confirm everything works? Don't forget to remove your external converter otherwise that will be used instead.

There is an issue. Now that color_mode is a number (by the way, the string was nicer for the UI) my haphazard use of || as null coalescing operator no longer works because 0 is falsy. Here's a PR with a fix. Unfortunately eslint will not accept ?? because ecmaVersion in .eslintrc.json is set to 2018 and 2020 would be needed for ??. I have to think about a better solution.

There is another issue, and I don't know why this didn't happen in my previous tests - I'm assuming it's a quirk of the light: When setting the color temperature while in color mode, the first time it switches to white mode but at the previous color temperature. I have to set the color temperature a second time for the light to actually accept the new color temperature. To fix this we could send the moveToColorTemp command twice, but we can also send the tuyaRgbMode command with enable: 0 just like the hub does. The PR contains a fix for that as well.

Another issue is that the brightness isn't synced between color mode and white mode. (The light keeps track of two separate brightness values while Z2M only has one.) I won't fix that today, so I'll send another PR later.

Could you check if the color sync works [...]
change e.g. the color temp and observe that the HS color also changes (and the other way around).

Oooh, that's what color sync does.
But no, it doesn't work:

console.log(newState);
console.log(libColor.syncColorState(newState, meta.state, entity, meta.options, meta.logger));
{ color_temp: 500 }
{ color_mode: 2 }

As controlling works now, we can keep it like this. The default response gives Zigbee2MQTT guarantees that the message arrived at the controller.

Ok, I was just worried because it indicates that entity.command('...', '...', {...}, {}, {disableDefaultResponse: true}) doesn't work as expected.

@Koenkk
Copy link
Owner

Koenkk commented Feb 25, 2023

@AndreKR the ?? operator is fine to use, min required Z2M Node version is Node 14 which supports it.

@rouvenst
Copy link

Hi all,

i just integrated two Light bars (14149506L) via Home Assistant and z2m edge. As I've read the last comment from @AndreKR there's an open issue

Another issue is that the brightness isn't synced between color mode and white mode. (The light keeps track of two separate brightness values while Z2M only has one.) I won't fix that today, so I'll send another PR later.

Maybe I've come along with another issue:

  1. Select color in HA
  2. In HA, Brightness is shown "as 0" + color of light icon is not updated

That's strange because z2m logs always has a brightness and color set:

Zigbee2MQTT:info  2023-02-26 11:21:21: MQTT publish: topic 'zigbee2mqtt/0xb4e3f9fffeeaccef', payload '{"brightness":221,"color":{"h":60,"s":71.42857142857142},"color_mode":0,"color_temp":305,"linkquality":255,"state":"ON"}'
Zigbee2MQTT:info  2023-02-26 11:23:00: MQTT publish: topic 'zigbee2mqtt/0xb4e3f9fffeeaccef', payload '{"brightness":221,"color":{"h":315,"s":100},"color_mode":0,"color_temp":305,"linkquality":255,"state":"ON"}'
Zigbee2MQTT:info  2023-02-26 11:23:02: MQTT publish: topic 'zigbee2mqtt/0xb4e3f9fffeeaccef', payload '{"brightness":97,"color":{"h":315,"s":100},"color_mode":0,"color_temp":305,"linkquality":255,"state":"ON"}'
Zigbee2MQTT:info  2023-02-26 11:23:03: MQTT publish: topic 'zigbee2mqtt/0xb4e3f9fffeeaccef', payload '{"brightness":97,"color":{"h":0,"s":85.71428571428571},"color_mode":0,"color_temp":305,"linkquality":255,"state":"ON"}'

That's how it looks after a page refresh
image

Is this related?

@AndreKR
Copy link

AndreKR commented Feb 27, 2023

@Koenkk The "color of light icon is not updated" issue that @rouvenst reports is because with the new color mode constants Z2M publishes "color_mode":0 but Home Assistant needs "color_mode":"hs".

@rouvenst I can't reproduce the issue with the brightness being shown as 0. When exactly does that happen? When you try to set a brightness is stays at 0? Or when you select a color is jumps back to 0?

@rouvenst
Copy link

rouvenst commented Feb 28, 2023

@AndreKR It happens when I select a color, but not when I select a color temperature.

What wonders me that the brightness attribute is missing on my light entity in HA, as seen on the screenshot.
Could it be some misconfiguration?
image

Additionally, if I click the refresh button in z2m, the following error message pops:
image

Just for completeness what I'm running:

Home Assistant 2023.2.5
Supervisor 2023.01.1
Operating System 9.5
Frontend 20230202.0 - latest

Zigbee2MQTT Edge - Current version: edge (just updated)

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Feb 28, 2023
@Koenkk
Copy link
Owner

Koenkk commented Feb 28, 2023

@AndreKR fixed the color_mode!

Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

@AndreKR
Copy link

AndreKR commented Feb 28, 2023

@Koenkk Ok, that helped, but now I'm having another issue. The color attribute is somehow frozen:

The state currently is;

{
    "color": {
        "h": 122,
        "hue": 122,
        "s": 100,
        "saturation": 100
    },
    "color_mode": "hs",
    "color_temp": 153,
    "linkquality": 36,
    "state": "ON"
}

In my converter I have for testing:

            newState.color.foo = 'bar';
            console.log(newState);
            return {state: newState};

The log output:

{ color: { h: 122.53888502559742, s: 99.99994617226982, foo: 'bar' } }
{ color: { h: 240, s: 100, foo: 'bar' } }

The new state (which also gets published via MQTT):

{
    "color": {
        "foo": "bar",
        "h": 122,
        "hue": 122,
        "s": 100,
        "saturation": 100
    },
    "color_mode": "hs",
    "color_temp": 153,
    "linkquality": 36,
    "state": "ON"
}

So whatever I return for color.h and color.s, those values don't change on the "State" tab. As you can see, I can add and update other fields like color.foo.

I was able to (temporarily?) fix it by stopping Z2M, removing the device from state.json and restarting Z2M. @rouvenst That workaround will probably work for you as well.

@rouvenst
Copy link

rouvenst commented Mar 1, 2023

Just updated to the newest Z2M Edge version and my problems are fixed. It was not needed to edit state.json.
Thank you very much @AndreKR and @Koenkk!

@Koenkk
Copy link
Owner

Koenkk commented Mar 1, 2023

@AndreKR

  • Does this also happen without the external converter?
  • Will e.g. newState.color.h= 900; get published?

@rotilho
Copy link

rotilho commented Mar 1, 2023

Thanks for all the work guys! You're are awesome :D

@AndreKR
Copy link

AndreKR commented Mar 1, 2023

@Koenkk

Yes, in fact I (and possibly you as well) can reproduce the issue without the external converter, just by adding this to state.json (while Z2M is stopped):

    "[...]": {
        "color": {
            "h": 122,
            "hue": 122,
            "s": 100,
            "saturation": 100
        },
        "color_mode": "hs",
        "color_temp": 153,
        "linkquality": 36,
        "state": "OFF"
    }

@Koenkk
Copy link
Owner

Koenkk commented Mar 2, 2023

@AndreKR what about:

  • Will e.g. newState.color.h= 900; get published?

@AndreKR
Copy link

AndreKR commented Mar 2, 2023

@Koenkk I'm not sure I understand what part exactly you're asking about.

If I add newState.color.h=900; to convertSet() and then I click a color in the UI the function will return

{ state: { color: { h: 900, s: 99.99994617226982 } } }

but the state is not updated (as shown on the "State" tab) and the 900 will also not be published via MQTT but instead the current state is published:

Zigbee2MQTT:info  2023-03-02 19:49:02: MQTT publish: topic 'zigbee2mqtt/Light Bar', payload '{"color":{"h":122,"hue":122,"s":100,"saturation":100},"color_mode":"hs","color_temp":153,"linkquality":32,"state":"ON"}'

@Koenkk
Copy link
Owner

Koenkk commented Mar 4, 2023

In the external converter, can you replace return {state: newState}; with:

meta.logger.debug(`GOING TO PUBLISH: ${JSON.stringify(newState)}`);
return {state: newState};

Is the expected new state logged?

@AndreKR
Copy link

AndreKR commented Mar 4, 2023

Yes, the expected new state is logged, but then the old state is published.

Zigbee2MQTT:debug 2023-03-04 17:15:38: GOING TO PUBLISH: {"color":{"h":359.4519599116082,"s":100}}
Zigbee2MQTT:info  2023-03-04 17:15:38: MQTT publish: topic 'zigbee2mqtt/Light Bar', payload '{"color":{"h":122,"hue":122,"s":100,"saturation":100},"color_mode":"hs","color_temp":153,"linkquality":21,"state":"ON"}'

@Koenkk
Copy link
Owner

Koenkk commented Mar 5, 2023

Then it goes somewhere wrong in the zigbee2mqtt code, can you provide me your configuration.yaml (without the passwords)

@AndreKR
Copy link

AndreKR commented Mar 6, 2023

homeassistant:
  legacy_entity_attributes: false
  legacy_triggers: false
permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://192.168.42.5
  user: ha
  password: [REDACTED]
serial:
  port: /dev/ttyUSB0
frontend:
  port: 8080
advanced:
  homeassistant_legacy_entity_attributes: false
  legacy_api: false
  legacy_availability_payload: false
  log_syslog:
    app_name: Zigbee2MQTT
    eol: /n
    host: localhost
    localhost: localhost
    path: /dev/log
    pid: process.pid
    port: 123
    protocol: tcp4
    type: '5424'
  channel: 15
  network_key:
    [REDACTED]
  log_level: debug
device_options:
  legacy: false
devices:
  [REDACTED]
external_converters:
  - ext_converter.js

@Koenkk
Copy link
Owner

Koenkk commented Mar 6, 2023

It is caused by

if (message.hasOwnProperty('color')) {
, in the converter hue should be set instead of h (and saturation instead of s)

@AndreKR
Copy link

AndreKR commented Mar 17, 2023

@Koenkk Here's a PR with a fix for that:
Koenkk/zigbee-herdsman-converters#5588

I also included a commit that enables the color sync functionality we discussed above.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale Stale issues label Apr 17, 2023
@AndreKR
Copy link

AndreKR commented Apr 17, 2023

I think we're done here, everything that we can make work works.

@crooy @Koenkk I think we can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Something isn't working stale Stale issues
Projects
None yet
Development

No branches or pull requests