Giter VIP home page Giter VIP logo

Comments (9)

tsightler avatar tsightler commented on May 28, 2024

Based on the returned DPS values this does not appear to be an RGBTW light, only a white light with color temperature support (TW light). Can you confirm that this is true or not?

from tuya-mqtt.

efflicto avatar efflicto commented on May 28, 2024

It is a RGBTW light and a week ago I even could set the color via Openhab. It's this lamp: https://www.amazon.de/gp/product/B08BFPGWZ1/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

led
This is the testing sitemap I build. It worked so far but now I ran into this bug.

from tuya-mqtt.

tsightler avatar tsightler commented on May 28, 2024

OK, maybe it's simply not sending color value because it's in white mode (there's no DPS 24 value being returned by the device), could you try putting it in color mode with the app and then restarting tuya-mqtt to see if that tickles it back to working? If it does, then I think I understand what is happening here, but I've not seen another device behave this way so I'll have to think how to fix it.

from tuya-mqtt.

efflicto avatar efflicto commented on May 28, 2024

First of all, thank you for your time and help!

Your guess was right. When the lamp is set to a color, the tuya-mqtt is not crashing. I could use the testing sitemap. Here is the log:

tuya-mqtt:info Connection established to MQTT server +0ms
  tuya-mqtt:tuyapi Search for device id xxx +0ms
  tuya-mqtt:tuyapi Found device id xxx +1ms
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":true,"21":"colour","22":970,"23":220,"24":"xxx","26":0} +34ms
  tuya-mqtt:tuyapi Connected to device Stehlampe (xxx, xxx, 9d8fa31a826050a9) +984ms
  tuya-mqtt:device-detect Attempting to detect light capabilites and DPS values... +0ms
  tuya-mqtt:device-detect Querying DPS 2 for white/color mode setting... +0ms
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":true,"21":"colour","22":970,"23":220,"24":"xxx","26":0} +31ms
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":true,"21":"colour","22":970,"23":220,"24":"xxx","26":0} +14ms
  tuya-mqtt:device-detect Detected likely Tuya color bulb at DPS 20-24, checking more details... +44ms
  tuya-mqtt:device-detect Attempting to detect if bulb supports color temperature... +0ms
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":true,"21":"colour","22":970,"23":220,"24":"xxx","26":0} +11ms
  tuya-mqtt:device-detect Detected likely color temerature support +11ms
  tuya-mqtt:device-detect Attempting to detect Tuya color format used by device... +1ms
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":true,"21":"colour","22":970,"23":220,"24":"xxx","26":0} +13ms
  tuya-mqtt:device-detect Detected Tuya color format HSB +12ms
  tuya-mqtt:discovery Home Assistant config topic: homeassistant/light/xxx/config +0ms
  tuya-mqtt:discovery {
  tuya-mqtt:discovery   name: 'Stehlampe',
  tuya-mqtt:discovery   state_topic: 'tuya/stehlampe/state',
  tuya-mqtt:discovery   command_topic: 'tuya/stehlampe/command',
  tuya-mqtt:discovery   brightness_state_topic: 'tuya/stehlampe/color_brightness_state',
  tuya-mqtt:discovery   brightness_command_topic: 'tuya/stehlampe/color_brightness_command',
  tuya-mqtt:discovery   brightness_scale: 100,
  tuya-mqtt:discovery   hs_state_topic: 'tuya/stehlampe/hs_state',
  tuya-mqtt:discovery   hs_command_topic: 'tuya/stehlampe/hs_command',
  tuya-mqtt:discovery   white_value_state_topic: 'tuya/stehlampe/white_brightness_state',
  tuya-mqtt:discovery   white_value_command_topic: 'tuya/stehlampe/white_brightness_command',
  tuya-mqtt:discovery   white_value_scale: 100,
  tuya-mqtt:discovery   availability_topic: 'tuya/stehlampe/status',
  tuya-mqtt:discovery   payload_available: 'online',
  tuya-mqtt:discovery   payload_not_available: 'offline',
  tuya-mqtt:discovery   unique_id: 'xxx',
  tuya-mqtt:discovery   device: {
  tuya-mqtt:discovery     ids: [ 'xxx' ],
  tuya-mqtt:discovery     name: 'Stehlampe',
  tuya-mqtt:discovery     mf: 'Tuya',
  tuya-mqtt:discovery     mdl: 'RGBTW Light'
  tuya-mqtt:discovery   },
  tuya-mqtt:discovery   color_temp_state_topic: 'tuya/stehlampe/color_temp_state',
  tuya-mqtt:discovery   color_temp_command_topic: 'tuya/stehlampe/color_temp_command',
  tuya-mqtt:discovery   min_mireds: 154,
  tuya-mqtt:discovery   max_mireds: 400
  tuya-mqtt:discovery } +1ms
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":true,"21":"colour","22":970,"23":220,"24":"xxx","26":0} +1s
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":true,"21":"colour","22":970,"23":220,"24":"xxx","26":0} +12ms
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":true,"21":"colour","22":970,"23":220,"24":"xxx","26":0} +15ms
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":true,"21":"colour","22":970,"23":220,"24":"xxx","26":0} +11ms
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":true,"21":"colour","22":970,"23":220,"24":"xxx","26":0} +20ms
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":true,"21":"colour","22":970,"23":220,"24":"xxx","26":0} +12ms
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":true,"21":"colour","22":970,"23":220,"24":"xxx","26":0} +12ms
  tuya-mqtt:state tuya/stehlampe/state ON +0ms
  tuya-mqtt:state tuya/stehlampe/white_brightness_state 97 +4ms
  tuya-mqtt:state tuya/stehlampe/hs_state 120,100 +1ms
  tuya-mqtt:state tuya/stehlampe/color_brightness_state 52 +1ms
  tuya-mqtt:state tuya/stehlampe/hsb_state 120,100,52 +0ms
  tuya-mqtt:state tuya/stehlampe/mode_state colour +0ms
  tuya-mqtt:state tuya/stehlampe/color_temp_state 346 +1ms
  tuya-mqtt:state MQTT DPS JSON: tuya/stehlampe/dps/state ->  {"20":true,"21":"colour","22":970,"23":220,"24":"xxx","26":0} +0ms
  tuya-mqtt:state MQTT DPS20: tuya/stehlampe/dps/20/state ->  true +1ms
  tuya-mqtt:state MQTT DPS21: tuya/stehlampe/dps/21/state ->  colour +0ms
  tuya-mqtt:state MQTT DPS22: tuya/stehlampe/dps/22/state ->  970 +0ms
  tuya-mqtt:state MQTT DPS23: tuya/stehlampe/dps/23/state ->  220 +0ms
  tuya-mqtt:state MQTT DPS24: tuya/stehlampe/dps/24/state ->  xxx +0ms
  tuya-mqtt:state MQTT DPS26: tuya/stehlampe/dps/26/state ->  0 +0ms
  tuya-mqtt:command Received MQTT message ->  {"topic":"tuya/stehlampe/command","message":"OFF"} +0ms
  tuya-mqtt:command Received MQTT command message is a text string +0ms
  tuya-mqtt:command Device xxx received command topic: command, message: off +0ms
  tuya-mqtt:tuyapi Set device xxx -> {"dps":20,"set":false} +38s
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":false} +113ms
  tuya-mqtt:state tuya/stehlampe/state OFF +38s
  tuya-mqtt:state MQTT DPS JSON: tuya/stehlampe/dps/state ->  {"20":false} +1ms
  tuya-mqtt:state MQTT DPS20: tuya/stehlampe/dps/20/state ->  false +0ms
  tuya-mqtt:command Received MQTT message ->  {"topic":"tuya/stehlampe/command","message":"ON"} +2s
  tuya-mqtt:command Received MQTT command message is a text string +2s
  tuya-mqtt:command Device xxx received command topic: command, message: on +0ms
  tuya-mqtt:tuyapi Set device xxx -> {"dps":20,"set":true} +2s
  tuya-mqtt:tuyapi Received JSON data from device xxx -> {"20":true} +120ms
  tuya-mqtt:state tuya/stehlampe/state ON +2s
  tuya-mqtt:state MQTT DPS JSON: tuya/stehlampe/dps/state ->  {"20":true} +0ms
  tuya-mqtt:state MQTT DPS20: tuya/stehlampe/dps/20/state ->  true +1ms

from tuya-mqtt.

tsightler avatar tsightler commented on May 28, 2024

OK, at least that gives me something to go on. I'll have to think of a way to fix this, but the fact that the device just doesn't return any DPS 24 value just because it's in white mode is certainly unexpected. That means that the autodetection of the color type will always fail if the bulb is in white mode when tuya-mqtt starts, so I'll have to implement something in the detection logic so that, if it gets not value here, it just assumes a format based on the mode switch DPS # and then initializes a base DPS 24 value even if no value is returned when queried.

Shouldn't be too hard but, unfortunately, time has not been on my side with this project lately, and I have a number of outstanding issues to address. I'll try to see if I can code up something for this in the next few days.

from tuya-mqtt.

efflicto avatar efflicto commented on May 28, 2024

Thank you for this. Take your time and let me know if I can help in any way!

from tuya-mqtt.

tsightler avatar tsightler commented on May 28, 2024

I pushed 3.0.2 with some enhanced logic to attempt to deal with this issue when the light is in white mode and avoid the undefined property. I'd appreciate it if you could give it a spin when you get a chance and let me know if it works for you since I can't easily test this as none of my devices behave this way.

from tuya-mqtt.

efflicto avatar efflicto commented on May 28, 2024

Hey tsightler, thank you so much for your work. I switched to OH 3 in the meantime, so I had to setup the whole ting again but after some troubles I can control the lamp via OH. Is there a way that I can thank you with a coffee or something?

from tuya-mqtt.

tsightler avatar tsightler commented on May 28, 2024

Thanks for letting me know, I'll close this now. No need for further thank me but, if you feel like it, I always encourage people to contribute to a charity or some cause which you believe in or offer any simple, kind gesture to others who might need it after what has been a difficult year for many people across the world.

from tuya-mqtt.

Related Issues (20)

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.