OzturkAlperen / homebridge-tuya-switch

homebridge-tuya-switch is a homebridge plugin that lets you control your Tuya based switch devices with HomeKit.
MIT License
10 stars 4 forks source link

This plugin generated a warning from characteristic 'on' #2

Closed clokey closed 3 years ago

clokey commented 3 years ago

Hi,

First off, thanks for this plugin, it's the first lan based Tuya plugin I could actually get to work. I have managed to successfully add my devices and I can control them, but there appear to errors getting the initial state of the devices

I enabled debugging in homebridge and generated the log below.

As I said, I am able to control the devices, but getting the initial state or subsequent state of the switch doesn't seem to work.

[3/4/2021, 10:07:04 AM] [TuyaLan] Connected to Matt Office
[TuyaAccessory] Sending first query to Matt Office (3.3)
[TuyaAccessory] Matt Office (3.3) didn't respond with its current state.
[3/4/2021, 10:07:04 AM] [TuyaLan] Ready to handle Matt Office (Switch:3.3) with signature {}
[3/4/2021, 10:07:04 AM] [homebridge-tuya-switch] This plugin generated a warning from the characteristic 'On': characteristic value expected boolean and received undefined. See https://git.io/JtMGR for more info.
[3/4/2021, 10:07:04 AM] [homebridge-tuya-switch] Error: 
    at On.Characteristic.characteristicWarning (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2164:105)
    at On.Characteristic.validateUserInput (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1931:16)
    at On.Characteristic.updateValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1365:20)
    at /usr/local/lib/node_modules/homebridge-tuya-switch/lib/SwitchAccessory.js:56:18
    at Array.forEach (<anonymous>)
    at SwitchAccessory._registerCharacteristics (/usr/local/lib/node_modules/homebridge-tuya-switch/lib/SwitchAccessory.js:49:33)
    at TuyaAccessory.<anonymous> (/usr/local/lib/node_modules/homebridge-tuya-switch/lib/BaseAccessory.js:22:18)
    at Object.onceWrapper (events.js:313:26)
    at TuyaAccessory.emit (events.js:223:5)
    at TuyaAccessory._msgHandler_3_3 (/usr/local/lib/node_modules/homebridge-tuya-switch/lib/TuyaAccessory.js:299:18)

and a snippet from the config.json

        {
            "platform": "TuyaLan",
            "name": "TuyaLan",
            "devices": [
                {
                    "name": "Matt Office",
                    "type": "Switch",
                    "manufacturer": "EZH",
                    "model": "Wifi Mini Smart Life Outlet",
                    "id": "bfeb84623f663d146316cd",
                    "key": "redacted_but_correct"
                }
             ]
         }
        ... 
OzturkAlperen commented 3 years ago

I am aware of this situation but i am not going to try to fix it since this doesn’t affect the usage of accessories. State of the accessory should be visible on Home app and on Homebridge Config UI X without any issues.

Also i encourage users to go check out Tuya Lan plugin by @iRayanKhan. My repository is just a placeholder until he pushes a new update with added multi channel switch support. He already merged my pull request so it should be available soon if it is not available already.

iRayanKhan commented 3 years ago

It should have been included in 1.5.0, if not please let me know.