rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.87k stars 552 forks source link

Local tuya devices become un available when internet is disconnected #1116

Open INVADIA666 opened 1 year ago

INVADIA666 commented 1 year ago

The problem : I spent quite some time adding all the devices on the local tuya integration, everything works perfectly and fast as long as the internet is working , the other day the internet stopped working for 10minutes and I was hoping all my lights will turn on as I'm using the local integration, well al the devices in the local integration were unavailable, once the internet came back , the devices became available, so I tried to remove the internet from my router and test it that way and I confirmed that the devices added within the local tuya integration need the internet connection to work . They're not local at all .

Am I doing something wrong in the set up ?

Am I going

Environment

Steps to reproduce

1.

Configuration configuration.yaml or config_flow

DP dump

Provide Home Assistant taceback/logs

Additional information

renegad84 commented 1 year ago

That is happen to me too!

asopoku commented 1 year ago

This keeps happening to me too. But initially it wasn't like that.

MarkNZD commented 1 year ago

Hi, same issue here. Hope that it can help someone. In my case removing Cloud API account configuration from Local Tuya restored this functionality and now everything is available in Local Tuya even if internet is down. Re-adding Cloud API account configuration makes this bug kick in again.

asopoku commented 1 year ago

How do I remove the CLOUD API account?

MarkNZD commented 1 year ago

Settings>Devices&Service.

Click on Configure 1

select Reconfigure Cloud API Account and click on submit 2

check "Do Not Configure Cloud API Account" and submit. 3

Hope this bug will be fixed so i can reconfigure Cloud API Account (i like it especially during the adding process of new devices).

asopoku commented 1 year ago

Thanks I'll try and give you feedback

asopoku commented 1 year ago

It worked with Internet now. Thanks so much. It was really helpful.

SgtJalau commented 1 year ago

I have the same issue. They continue to work for a bit then they are unavailable, while the Smart Life app still works. This happens as soon as I block internet access for my smart plugs. On a previous version this worked for 100%.

frlequ commented 1 year ago

I have the same problem. As soon as I block internet access the Light becomes unavailable. But another device (thermostat) linked in Tuya Local works fine even if I block internet access.

SgtJalau commented 1 year ago

Okay guys. I got it fixed on my end by doing the following: It was working on one of my two plugs so I compared the configurations. I found that the one working had "model": "Smart Socket", set while the other didn't. I added it manually to the config (via ssh, navigate to the core data config (hidden folder/files) "/root/config/.storage/core.config_entries"). Then I restarted home assisstant. However that did not fix the issue sadly. Then I downgraded to v4.0.2. To downgrade download the following zip from GitHub (just the tag 4.0.2 from the main repo): https://github.com/rospogrigio/localtuya/archive/refs/tags/v4.0.2.zip Then unzip and overwrite the contents in the custom_addons/local_tuya directory inside your home assisstant installation.

Downgrading fixed the issue or at least made a new error show up. This time it was that one of the plugs had "scan_interval": "30", written in the config which makes it read the 30 as a string instead of a double. This caused a casting error which was reflected in the logs. I then removed the " and this fixed it. Now everything is running smoothly. I haven't yet tested if upgrading to the newest version and removing the " in the config causes the issue to be fixed as well. In the newer version no casting error was reflected in the config but it could be that this was just eaten up by some new exception handling or something. Either way here is my working config:

"data": {
    "device_config": {
      "friendly_name": "Power Monitor",
      "host": "192.168.1.---",
      "device_id": "-----",
      "local_key": "----",
      "protocol_version": "3.3",
      "enable_debug": false,
      "scan_interval": 30,
      "model": "Smart Socket",
      "dps_strings": [
        "1 (value: True)",
        "9 (value: 0)",
        "18 (value: 609)",
        "19 (value: 809)",
        "20 (value: 2325)",
        "21 (value: 1)",
        "22 (value: 740)",
        "23 (value: 31468)",
        "24 (value: 21666)",
        "25 (value: 965)"
      ],
      "entities": [
        {
          "id": 1,
          "friendly_name": "Power Monitor",
          "restore_on_reconnect": true,
          "is_passive_entity": false,
          "current": 18,
          "current_consumption": 19,
          "voltage": 20,
          "platform": "switch"
        }
      ],
      "product_key": "----"
    }
  }
Cadseubi commented 1 year ago

I have the same problem. I can control the devices locally, but only when they are connected to Tuya cloud servers. Otherwise there are malfunctions and some of the lights don't work

pituluk commented 4 weeks ago

Years later this is still an issue. Some Tuya devices work fine through their wifi direct protocol though