This is a custom component for home assistant to integrate Tuya switch device locally.
This custom component supports both HACS and legacy custom componennts methods.
This component supports config flow, so you can either configure it in configuration.yaml or add from frontend "Configuration -> Integrations"
switch:
- platform: localtuya
host: 192.168.10.122 # (required) ip addres of the device
local_key: !secret local_key # (required) local key of the device
device_id: !secret device_id # (required) device id
update_interval: 10 # (optional) frequency to update the status in seconds, default: 10
current: 5 # (optional) attribute id for current
current_consumption: 6 #(optional) attribute id for current consumption
voltage: 7 #(optional) attribute id for voltage
switches: # (optional)
switch1:
friendly_name: tuya switch restroom
id: 1
_update_interval is different from scan_interval, this value limits the frequency between updates of a tuya device. Default value is 10, generally 3 seconds works fine._
Credits: Thanks to @mileperhour for all the work.