Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95358

Help getting LocalTuya to work

$
0
0

@chansearrington wrote:

Hey guys,

I’m trying to get a tuya device working with localtuya and currently running 107 in VM.

I’ve copied over the localtuya directory from @mileperhour and now have

config

custom_components

localtuya

switch.py
manifest.json
init.py
pytuya

init.py

I updated the switch.py code to have from . import pytuya

I’ve confirmed that the device ID, Local Key and IP address are all correct and working using TuyaCLI, where I’m able to successfully tun on the device.

But I’m still getting an error in the Developer Tools Logs

Log Details (ERROR)
Logger: homeassistant.components.switch
Source: custom_components/localtuya/switch.py:97
Integration: Switch (documentation, issues)
First occurred: 9:48:01 AM (1 occurrences)
Last logged: 9:48:01 AM

Error while setting up localtuya platform for switch
Traceback (most recent call last):
  File "/config/custom_components/localtuya/switch.py", line 93, in __get_status
    status = self._device.status()
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 259, in status
    data = self._send_receive(payload)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 171, in _send_receive
    data = s.recv(1024)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 179, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/localtuya/switch.py", line 74, in setup_platform
    config.get(CONF_ID)
  File "/config/custom_components/localtuya/switch.py", line 127, in __init__
    self._status = self._device.status()
  File "/config/custom_components/localtuya/switch.py", line 111, in status
    self._cached_status = self.__get_status()
  File "/config/custom_components/localtuya/switch.py", line 97, in __get_status
    raise ConnectionError("Failed to update status.")
ConnectionError: Failed to update status.

Any ideas what this could be? How I might be able to fix it?

I have the following setup as a package for my config

###################################
# RecTec RT-700 Bull Package
###################################


###################################
# Climate
###################################


###################################
# Sensors
###################################

sensor:
 - platform: template
   sensors:
     rectec_target:
       value_template: >-
         {{ states.switch.rectec.attributes.target }}
       unit_of_measurement: 'F' 
     rectec_current:
       value_template: >-     
         {{ states.switch.rectec.attributes.current }}
       unit_of_measurement: 'F'      
     rectec_probea:
       value_template: >-
         {{ states.switch.rectec.attributes.probea }}
       unit_of_measurement: 'F'
     rectec_probeb:
       value_template: >-
         {{ states.switch.rectec.attributes.probeb }}
       unit_of_measurement: 'F'


###################################
# switch
###################################

switch:
  - platform: localtuya
    host: !secret rectec_host
    local_key: !secret rectec_local_key
    device_id: !secret rectec_device_id
    name: smoker

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95358

Trending Articles