Closed LuckyTriple7 closed 3 years ago
Hi, I have the same problem
What do you see in logs?
same issue here.. logs don't seem to have much of interest...
Same. Downgrade to 3.1 and everything is fine again
May sound like a silly question, but how do you downgrade to 3.1?
Im having the same issue, all ~70 odd devices unavailable. Have even tried manually re adding some, with no change.
HACS -> Integrations -> Local Tuya -> REINSTALL
Select Version 3.1.0 -> INSTALL -> Restart HASS
HACS -> Integrations -> Local Tuya -> REINSTALL
Select Version 3.1.0 -> INSTALL -> Restart HASS
Legend! Cheers LuckyTriple7 - All backup and running :)
Please try #288.
Enable debug logs with
logger:
default: warning
logs:
custom_components.localtuya: debug
Downgrading also worked for me.
Please try #288.
Same problem here, I had to create an automation, which reloads localtuya one minute after HA restart, but I'm also thinking about reverting to 3.1.0 and staying there.
Log file shows no extra errors besides of already known: "File "/config/custom_components/localtuya/init.py", line 209, in _async_reconnect device = entry[TUYA_DEVICE] TypeError: string indices must be integers`"
@AdmiralStipe What version are you on? I couldn't find the code device = entry[TUYA_DEVICE]
anywhere on GitHub.
Remaining at 3.2.0 for now despite the problems... it kinda works, but not the way I would like it to :).
@AdmiralStipe This is what's at line 209: https://github.com/rospogrigio/localtuya/blob/master/custom_components/localtuya/__init__.py#L209 _async_reconnect
isn't declared anywhere in the file either.
Well, not sure what are you trying to tell me... the described error happened when i tried to use the pull request #288, not at normal 3.2.0 version, which I use now, if that's what you mean.
I don't think you're running the latest version of that PR. This is what's at line 209: https://github.com/rospogrigio/localtuya/blob/simple_reconnect/custom_components/localtuya/__init__.py#L209
I am not running it at all... as I said, I'm running the official latest release 3.2.0 from 30th December... just for testing I tried out the changes from PR288 about two weeks ago and when I did, the mentioned error appeared... then I switched back to official latest release. And I have no idea what is in which line and what it's supposed to do, as I'm no programmer... just stating, that I tried the PR, it didn't work for me, described the outcome and that's all.
@AdmiralStipe Could you reinstall the latest version and see if you still get the same error?
Once again, the "string indices must be integers" error does not happen with the latest version. Problem with the latest version (which I have already reinstalled just to be sure) is, that the devices become unavailable (at least at restart, possibly also later on) and I have to reload the integration after restart to make it run normally, as other users have reported. The "string indices must be integers" error happened, when I installed the PR288 over the latest version. So, after restart the devices were unavailable and also remained unavailable even after integration reload, additionally to that the "string indices must be integers" error appeared. Therefore I noticed about that and reinstalled the latest version without the PR288. So, now there is no "string indices must be integers" error anymore, but the inital "devices become unavailable" error remains at restart at least until reloading the integration. Hopefully I have made myself clear now.
@AdmiralStipe How do you reload the integration after restart?
@AdmiralStipe How do you reload the integration after restart?
With this automation:
alias: _LocalTuya reload description: '' trigger:
Sorry, bad formatting here, but i guess you can see the point...
I'm also having a similar issue I believe with Teckin SB50+ bulbs (Tuya - Smart Life). I find that I can almost randomly get them working when on 3.1.0 via YAML Configuration. I have other Teckin bulbs that do work perfectly fine in 3.1.0 but when I upgrade to 3.2.0 they all end up failing. Downgrade to 3.1.0 and things work again (Minus the SB50+ which I seem to have random luck getting back online since I power them off at night (may need to stop doing that..). On 3.1.0, WITHOUT PR#288 I get these logs:
2021-02-01 12:15:18 ERROR (MainThread) [custom_components.localtuya.common] [360...72f] Connect to 192.168.50.106 failed
Traceback (most recent call last):
File "/config/custom_components/localtuya/common.py", line 156, in _make_connection
status = await self._interface.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 461, in status
status = await self.exchange(STATUS)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 456, in exchange
return await self.exchange(command, dps)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 440, in exchange
msg = await self.dispatcher.wait_for(seqno)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 239, in wait_for
await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
File "/usr/local/lib/python3.8/asyncio/tasks.py", line 501, in wait_for
raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
If I upgrade to 3.2.0, I wont see anything special on my warning level, but if I enable debug on localtuya, I'll see this:
2021-02-01 12:25:41 DEBUG (MainThread) [custom_components.localtuya.discovery] Listening to broadcasts on UDP port 6666 and 6667
2021-02-01 12:25:43 DEBUG (MainThread) [custom_components.localtuya.light] [360...72f] Adding light.office_2 with configuration: {'platform': 'light', 'friendly_name': 'Office 2', 'id': 20, 'color_mode': 21, 'brightness': 22, 'color_temp': 23, 'color': 24, 'brightness_lower': 29, 'brightness_upper': 1000, 'color_temp_min_kelvin': 2700, 'color_temp_max_kelvin': 6500, 'scene': 25, 'music_mode': False}
In the above situation, on 3.2.0, none of my lights end up working, even the ones that were perfectly fine in 3.1.0.
Next, I pull in PR288 and end up with this result:
2021-02-01 12:43:12 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/localtuya/__init__.py", line 216, in _async_reconnect
device = entry[TUYA_DEVICE]
TypeError: string indices must be integers
2021-02-01 12:43:12 ERROR (MainThread) [custom_components.localtuya.common] [360...72f] Connect to 192.168.50.106 failed
Traceback (most recent call last):
File "/config/custom_components/localtuya/common.py", line 149, in _make_connection
status = await self._interface.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 472, in status
status = await self.exchange(STATUS)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 467, in exchange
return await self.exchange(command, dps)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 451, in exchange
msg = await self.dispatcher.wait_for(seqno)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 240, in wait_for
await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
File "/usr/local/lib/python3.8/asyncio/tasks.py", line 501, in wait_for
raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
2021-02-01 12:43:12 DEBUG (MainThread) [custom_components.localtuya.pytuya] [360...72f] Closing connection
2021-02-01 12:43:12 DEBUG (MainThread) [custom_components.localtuya.pytuya] [360...72f] Stopped heartbeat loop
2021-02-01 12:43:12 DEBUG (MainThread) [custom_components.localtuya.pytuya] [360...72f] Connection lost: None
2021-02-01 12:43:12 DEBUG (MainThread) [custom_components.localtuya.common] [360...72f] Disconnected - waiting for discovery broadcast
I hope this information helps, Happy to test more if need be, Please tag me if you need anymore info or have any suggestions.
3.2.2 fix this Problem for me, thx a lot !
I have updatet to the latest Version 3.2.0 After restarting Homeassistant, all Devices are unavailable.
When im reload the Integration, devices comes back until the next reboot. No error messages appear in the log.
Reverting back to 3.1.0 all works fine