Closed accelle17 closed 3 years ago
You can set the default DPS by specifying id
in the config. You can also do that from a config flow if you add via the Integrations page (assuming you use master
and not the latest release).
Thanks. I was able to add and define the dps but couldn't see any devices/entities. The logs says:
2020-09-22 11:20:33 ERROR (MainThread) [homeassistant.components.light] Error while setting up localtuya platform for light Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/localtuya/light.py", line 74, in async_setup_entry TuyaCache(tuyainterface, config_entry.data[CONF_FRIENDLY_NAME]), NameError: name 'TuyaCache' is not defined
I was able to add it by modifying TuyaCache to TuyaDevice on light.py. Anyway, I can only turn the light on and off. However, I was trying to add it again by specifying different DPS (to control laser at DPS 102 and nebula light at 103) but the integration wouldn't let me since it's already added. Workaround maybe to send command using this integration to specific dps, is this possible?
@rospogrigio I think the error above is a side-affect from #38. We really need to setup GitHub actions and with to run static code-analysis, it shouldn't be possible to merge broken code. I can try to fix that.
If you remove the device fist, you can add multiple lights (one for each of the DP of interest). But you cannot do that after already adding one device. Maybe we should change that.
If you remove the device fist, you can add multiple lights (one for each of the DP of interest). But you cannot do that after already adding one device. Maybe we should change that.
great, was able to do this. Is it possible to map the DP for each light entity attribute (brightness/color/contrast)?
If you remove the device fist, you can add multiple lights (one for each of the DP of interest). But you cannot do that after already adding one device. Maybe we should change that.
great, was able to do this. Is it possible to map the DP for each light entity attribute (brightness/color/contrast)?
Sorry about late reply! We support that for brightness and color temperature. Brightness is a bit buggy now as we only support 255 brightness levels (due to Home Assistant API) and tuya uses roughly 1000. So I guess you will only get the first quarter of brightness levels for now. See #73.
Brightness levels will be fixed in #80, so we are getting closer. Would be great if you tried out that PR and verified if your bulb works.
Thanks. The way I mapped this right now:
nebula (this controls if the device is off/on ) type: switch state DP: 20 (working)
nebula laser: type: light state DP: 102 (working) brightness DP: 22 (NOT working)
nebula light: type: light state DP: 103 brightness DP: 101 (use for rotation speed as they have the same min/max value of 29 to 1000, NOT working)
note: brightness of this light is on a DP that has 12 digit hexadecimal so it might be a special type.
I'm contented that I can control this locally so many thanks!
Here's the log when trying to control brightness (no errors):
2020-10-15 15:09:41 DEBUG (MainThread) [custom_components.localtuya.pytuya] [ebb2e815c7c80a5fc4cq0v] Sending command heartbeat (device type: type_0a) 2020-10-15 15:09:41 DEBUG (MainThread) [custom_components.localtuya.pytuya] [ebb2e815c7c80a5fc4cq0v] Paylod: b'{}' 2020-10-15 15:09:41 DEBUG (MainThread) [custom_components.localtuya.pytuya] [ebb2e815c7c80a5fc4cq0v] Waiting for sequence number -100 2020-10-15 15:09:41 DEBUG (MainThread) [custom_components.localtuya.pytuya] [ebb2e815c7c80a5fc4cq0v] Got heartbeat response 2020-10-15 15:09:41 DEBUG (MainThread) [custom_components.localtuya.pytuya] [ebb2e815c7c80a5fc4cq0v] Decode payload: b'' 2020-10-15 15:09:41 DEBUG (MainThread) [custom_components.localtuya.pytuya] [ebb2e815c7c80a5fc4cq0v] Decrypted payload: {}
note: this device uses wb3s board as I updated on blakkader, so flashing is out of the option for anyone who might get to bump on this github.
Can you provide some values for DP 22 for various settings, so we can try to reverse engineer it? 12 hex bytes almost suggests it's some kind of RGB encoding.
I'm not sure I understand what you mean regarding brightness for nebula light? Rotation speed?
For the nebula light component DP24, it's the same as #33 which is HSV.
For DP 22 (brightness of laser) and DP 24 (rotation speed), setting the value using tuya-cli, it ranges from 29 to 1000. It will not take any values below or above that range.
I'm not sure I understand what you mean regarding brightness for nebula light? Rotation speed?
The device has three components - the master control, laser and nebula light. I was thinking to map the rotation speed as brightness since they have the same lower and upper value. Here's a link of the demo so you got the idea of the rotation of the laser stars and nebula light - https://youtu.be/rhdYzAY2pVE
I am thinking of just configuring this device with 3 existing components
Ok, I think I got it. With #80 you should hopefully be able to configure the brightness range according to your needs. Maybe you can try it out? Otherwise it's just color support that is missing for the last part? Should not be any problems as long as we don't have any special encodings to deal with.
Tested with the master branch after your merge and it is working. I guess we can close this now and I will just follow #33 for the RGB support. DP 26 for the timer is not that important. Thanks again!
Hello, I just got this and it uses a different dps for status, I tried 1.2 and master. It's working on 1.2 by modifying the DEFAULT_ID from 1 to 20. Below is the DPS:
102 - laser light control/status 103 - nebula control/status 22 - laser brightness default 800 (80%) max 1000 (100%) 101 - laser/rotation speed default 500 (50%) max 1000 (100%) 24 - color (first four digit - color, 2nd four digit - contrast, last four digit - brightness of nebula) 26 - timer in seconds 25 -? 20 - state 21 - mode (colour/white)