rospogrigio / localtuya

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

Sadly localtuya will not work with IoT devices what are without internet connection #574

Open zeminator opened 2 years ago

zeminator commented 2 years ago

Environment

Steps to reproduce

  1. No internet for IoT devices
  2. Power lost or unplug IoT device (what doesn't have last state or forced power on)
  3. Device will stay unavailable

Configuration configuration.yaml or config_flow

N/A

Additional information

Environment: firewalled tuya devices. No connections to internet at all. What is working (example): In case smartplug has been started with internet connection, everything is working. Also in case if smartplug powered on with power button, everything will work.

What is not working: Incase there is no internet connection and smartplug has not been started first time from physical button, device will stay unavailable.

So, currently without internet connection. there is two options. start smartplug devices from button. But currently at least with some other machine/device we can use: "tuya-cli set --ip --key --id --protocol-version 3.3 --dps 1 --set true". That will start and initialize device so that localtuya will see the device and after that device can be managed by it.

Note! HA is in different VLAN than IoT devices. And IoT devices don't have internet connection.

zeminator commented 2 years ago

also extra comment. While localtuya says that devices are unavailable. I can do query of the device with "tuya-cli get --ip --key --id --protocol-version 3.3", and it is working just fine.

Elendilon commented 2 years ago

This is due to a missing initialization packet required by newer (2019/2020+ ish) devices. I put a PR up at https://github.com/rospogrigio/localtuya/pull/491 that may fix this - however because the way devices handle this packet, the lack of it, and the way they respond to it varies per manufacturer/firmware it may not cover all device cases.

shtrom commented 2 years ago

Dupe of #501 and #445?