Closed snowgumrd closed 3 years ago
The ID refers to the datapoint in the plug that corresponds to the switch state. So if it's an identical plug, you should use the same id. Power plugs usually use id 1 for state (and 2 if it's a double gang switch).
ConnectionResetError
usually means that someone else is using the plug, e.g. the app or regular tuya integration. Make sure your close/kill the all and don't use anything else that can communicate with it.
I can't quite confirm what worked in the end, but I've got it working.
List of things I did: 1) Deleted the switch entries from the registry 2) Removed the integration from the configuration.yaml file AND the interface. 3) Reset the switch to factory settings using smartlife 4) Re-installed the switch on smartlife and pulled the updated key 5) Re-installed via configuration.yaml
Took a while but I got there in the end. Thanks again guys!
Hi guys, Switch A works great with localtuya. I get the power monitoring stats into HA and it drives a bunch of alerts and automations. Set up through YAML but not the interface - i'm not fussed, i'm just happy that it works.
I bought an identical switch, but it doesn't seem to connect to HA.
The error shows up in the log as "connect to switch failed"
Connect to 192.168.x.xx failed Traceback (most recent call last): File "/share/CACHEDEV1_DATA/.qpkg/Home-Assistant/CONFIG_DIR/custom_components/localtuya/common.py", line 141, in _make_connection self._interface = await pytuya.connect( File "/share/CACHEDEV1_DATA/.qpkg/Home-Assistant/CONFIG_DIR/customcomponents/localtuya/pytuya/init.py", line 593, in connect , protocol = await loop.create_connection( File "/opt/Home-Assistant/lib/python3.8/asyncio/base_events.py", line 1021, in create_connection raise exceptions[0] File "/opt/Home-Assistant/lib/python3.8/asyncio/base_events.py", line 1006, in create_connection sock = await self._connect_sock( File "/opt/Home-Assistant/lib/python3.8/asyncio/base_events.py", line 920, in _connect_sock await self.sock_connect(sock, address) File "/opt/Home-Assistant/lib/python3.8/asyncio/selector_events.py", line 494, in sock_connect return await fut File "/opt/Home-Assistant/lib/python3.8/asyncio/selector_events.py", line 526, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') ConnectionResetError: [Errno 104] Connect call failed ('192.168.x.xx', 6668)
I'm wondering if it has something to do with the id for the switch. Should both IDs ( flagged with <--- below) be different? I'm not sure if the id refers to the device type or if it's a unique identifier.
host: 192.168.x.xx device_id: 464xxxxxxxxxxxx412 local_key: f3xxxxxxxxxxxxxx57 friendly_name: Switch A entities:
host: 192.168.x.xx device_id: 464xxxxxxxxxxxx413 local_key: f3xxxxxxxxxxxxxx35 friendly_name: Switch B entities: