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

Changing the brightness parameter. #73

Closed
Securond opened this issue Oct 11, 2020 · 6 comments
Closed

Changing the brightness parameter. #73

Securond opened this issue Oct 11, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@Securond
Copy link

Hi, I have a Tuya dimmer in which the brightness is 0-1000, but the integration allows you to change the brightness only from 0-255 and the lamp glows dimly. can I add the ability to change this parameter ?

dps: { '20': false, '21': 'white', '22': 1000, '26': 0 }

@postlund
Copy link
Collaborator

Yeah, this has been reported on the community forums as well and we should definitely fix this. I have not started yet, so if anyone wants to do that feel free to do so.

@postlund postlund added the bug Something isn't working label Oct 11, 2020
@postlund
Copy link
Collaborator

Please give #80 and try, it should solve this i hope. You can specify lower and upper limits and the value from home assistant (0-255) will be mapped to this range.

@Securond
Copy link
Author

In the latest version, I get this error.

Source: custom_components/localtuya/light.py:91
First occurred: 17:00:35 (1 occurrences)
Last logged: 17:00:35

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 283, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 322, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 442, in state_attributes
data[ATTR_COLOR_TEMP] = self.color_temp
File "/config/custom_components/localtuya/light.py", line 91, in color_temp
return int(MAX_MIRED - (((MAX_MIRED - MIN_MIRED) / 255) * self._color_temp))
TypeError: can't multiply sequence by non-int of type 'float'

@Securond
Copy link
Author

When adding the device, I did not configure "COLOR_TEMP", left this field empty and now EVERYTHING works as it should, without errors. ))

@postlund
Copy link
Collaborator

Yeah, I'm using the approach that if you configure something it is assumed to be supported by the device (since we can't really deduce that in a decent way). In the future you will be able to unset options so you don't have to remove and re-add. But that's how it works now.

@postlund
Copy link
Collaborator

Also, maybe we can close this issue then?

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

No branches or pull requests

2 participants