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

Tuya (some) lights (sometimes) unavailable #30311

Closed
davr opened this issue Dec 30, 2019 · 12 comments
Closed

Tuya (some) lights (sometimes) unavailable #30311

davr opened this issue Dec 30, 2019 · 12 comments

Comments

@davr
Copy link

davr commented Dec 30, 2019

Home Assistant release with the issue: 0.103.4

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.): Hass.io on raspberry pi 3 b+

Integration: https://www.home-assistant.io/integrations/tuya/

Description of problem:
I have several different devices that are set up via the smartlife app (aka tuya). Some of them will sometimes show Unavailable in HA until I restart it (calling tuya.force_update or tuya.pull_devices doesn't fix it). In addition, I see the traceback repeatedly in the log.
I think the error may only happen when the lights are in certain states (eg color and not white), but I'm not 100% sure yet, need to test more to see if there's a correlation.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

tuya:
  username: "[email protected]"
  password: xxx
  country_code: "1"
  platform: "smart_life"

Traceback (if applicable):

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 408, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 286, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 418, in state_attributes
    data[ATTR_BRIGHTNESS] = self.brightness
  File "/usr/src/homeassistant/homeassistant/components/tuya/light.py", line 43, in brightness
    if self.tuya.brightness() is None:
  File "/usr/local/lib/python3.7/site-packages/tuyaha/devices/light.py", line 16, in brightness
    brightness = int(self.data.get('color').get('brightness') * 255 / 100)
AttributeError: 'NoneType' object has no attribute 'get'

Additional information:

@Tuncay-Ayhan
Copy link

0.103.5 doesn’t work either. Gives the same error

@davr
Copy link
Author

davr commented Jan 2, 2020

I used the "hack" mentioned in other threads (eg #28602), and it allows me to control the on/off state of all of the lights, and now all of the lights allow color commands to be sent, but only some of them do the color commands actually work.

@davr
Copy link
Author

davr commented Jan 2, 2020

Related issue on tuyaha package: PaulAnnekov/tuyaha#17

@stale
Copy link

stale bot commented Apr 1, 2020

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 1, 2020
@JeffD57
Copy link

JeffD57 commented Apr 3, 2020

I'm running the latest version 107.7 and I'm still getting unavailable on some of my tuya devices

@stale stale bot removed the stale label Apr 3, 2020
@cwelsh1812
Copy link

v108.8 and one of my Tuya sockets/switches is unavailable despite functioning as expected within the Tuya app and another 5 sockets/switches working perfectly well within HA.

@vern59
Copy link

vern59 commented May 21, 2020

I have the same problem, my Tuya wi-fi smart sockets in Smart Life quit working about a month ago. They show up as unavailable. I keep upgrading home assistant hope they would be fixed. I added the new integration for Tuya but it did not help. My zwave Tuya smart switches work fine. here is little of the log file. I am running v0.110

2020-05-21 15:16:17 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.680751013c71bf228d79 is taking over 10 seconds
2020-05-21 15:16:17 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.61178771b4e62d79076e is taking over 10 seconds
2020-05-21 15:16:17 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.273758613c71bf228b95 is taking over 10 seconds
2020-05-21 15:16:17 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.20808285cc50e3566046 is taking over 10 seconds
2020-05-21 15:16:17 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.208082853c71bf222187 is taking over 10 seconds

@stale
Copy link

stale bot commented Aug 22, 2020

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 22, 2020
@JeffD57
Copy link

JeffD57 commented Aug 22, 2020

I've upgraded to 114 and still get unavailable at times on a couple of smart sockets. Has anyone found a solution yet?

@stale stale bot removed the stale label Aug 22, 2020
@tareko
Copy link

tareko commented Sep 13, 2020

I'm seeing the same issue as well with some blinds. This also began after my upgrade to 114

@jcbagtas
Copy link

jcbagtas commented Dec 7, 2020

I can confirm that my tuya bulb keeps on being unavailable and having no color control as well. I am using an updated OS, Supervisor,and RPi4B 8GB.

I want to try if the unavailability issue can be fixed by removing internet access from my bulb. (Blocked outbound internet for an IP)

@github-actions
Copy link

github-actions bot commented Mar 7, 2021

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants