Closed tony-butchart closed 1 year ago
is this happened on every version of localtuya? or did it works on previous version?
is this happened on every version of localtuya? or did it works on previous version?
The two releases I have tested are 3.6.1 and 3.6.2-beta.3. The same issue occured on both.
Is it worth testing prior versions to 3.6.1?
ow wait, i see this. i'll take a look
File "/config/custom_components/localtuya/light.py", line 218, in color_temp
((self._max_mired - self._min_mired) / self._upper_color_temp)
TypeError: unsupported operand type(s) for *: 'float' and '
can you check if this beta 4 solved this problem? 3.6.2-beta.4
Just gave it a test, restarted the gateway and restarted my HA instance after installing. I still get all lights offline but a different error now:
This error originated from a custom integration.
Logger: homeassistant
Source: custom_components/localtuya/light.py:97
Integration: LocalTuya (documentation, issues)
First occurred: 11:39:05 AM (12 occurrences)
Last logged: 11:39:05 AM
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_update_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1004, in state_attributes
data[ATTR_BRIGHTNESS] = self.brightness
File "/config/custom_components/localtuya/light.py", line 189, in brightness
return map_range(
File "/config/custom_components/localtuya/light.py", line 97, in map_range
mapped = (value - from_lower) * (to_upper - to_lower) / (
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
Here's the full debug log as well if that helps: home-assistant_2022-12-31T00-44-00.467Z.log
Here's output from tinytuya directly on the status of a Bulb before restarting the gateway:
>>> d.detect_available_dps()
{'1': True, '2': 'colour', '3': 50, '4': 1000, '5': '0000019B0006'}
And what it looks like straight after restarting the GW:
>>> d.detect_available_dps()
{'1': True}
have a try on a newer version? 3.6.2-beta.5
Initial testing looks like the issue is resolved, thanks! I'll spend some more time with it today checking all the functions.
Initial testing looks like the issue is resolved, thanks! I'll spend some more time with it today checking all the functions.
nice, if everything goes well, the i will put this beta to release. unless there are more issue came up
I have one feedback related to _gateway_s: when setting up a gateway from UI, some text boxes have no hint:
But the main problem is that, even when enabling Is Gateway option, the next page will still ask me to setup entities and there's no way to skip:
I have one feedback related to _gateway_s: when setting up a gateway from UI, some text boxes have no hint:
But the main problem is that, even when enabling Is Gateway option, the next page will still ask me to setup entities and there's no way to skip:
nice catch, I'll create a new issue to fix this.
I'm using a Tuya Bluetooth WiFi gateway along with some Bluetooth light globes. I have the lights paired up fine with the gateway and all functions work fine through the Tuya app as expected. I had some trouble getting the lights connected to HA using localtuya initially which I resolved by using the app to set Brightness/Colour Temp on the light, strangely after which it was controllable using HA/localtuya.
This issue occurs every time the gateway itself is restarted, I did some poking with tuya-cli and what appears to be happening is that the gateway is not returning any data on certain DPs after being re-powered, for example polling dp 2 (colour mode) and dp 4 (colour temp) after the gateway has been restarted:
If i use tuya-cli to set the colour mode and the colour temp the data is retained and is retrievable afterwards, and further more the device becomes controllable via localtuya:
Here's the error reported when the issue is occurring:
I also see a number of these sorts of error in the logs:
This is the only gateway device i have to test with so it's unclear to me whether the return of null values is normal behavior for gateway devices and is expected to be handled by localtuya or whether that is the cause of the issue. I know once the initial problem is solved as long as the gateway stays on continuously it seems to retain the DP data and remains in a working state within home assistant.
Happy to do additional testing or logging if its needed for further information, just let me know.
Note: I've had to add my gateway via yaml as adding via the GUI results in a "Failed to authenticate with device. Verify that device id and local key are correct." error and the corresponding error in the log file: