AMoo-Miki / homebridge-tuya-lan

Homebridge plugin for IoT devices that use Tuya Smart's platform
MIT License
202 stars 51 forks source link

characteristic value expected boolean and received undefined -- Cree Connected Max Floodlight #243

Open kennethahoward opened 3 years ago

kennethahoward commented 3 years ago

I'm having some issues getting a Cree Connected Max PAR38 White+Color Floodlight bulb working with Homebridge Tuya. I used TinyTuya to gather the device ID and key for the light. Cree has their own app but it appears to be just a rebranded version of the Tuya app and I'm able to control it identically with the Tuya app. I also registered it in Tuya Cloud as part of the process outlined in the TinyTuya docs to get the ID and key. I can see that there is communication with the light when homebridge starts up:

[5/22/2021, 3:38:56 PM] [TuyaLan] Ready to handle Floodlight (RGBTWLight:3.3) with signature {"20":false,"21":"white","22":499,"23":116,"24":"000003e803e8","25":"0032320000000000000001f40000","26":0}

But when I try to control the light (power it on), I get this error:

5/22/2021, 3:39:14 PM] [homebridge-tuya] This plugin generated a warning from the characteristic 'On': characteristic value expected boolean and received undefined. See https://git.io/JtMGR for more info.

I restarted Homebridge in debug mode to get more information and saw the same behavior from start. Oddly, though, after a number of minutes, I saw this in the log:

[Tuya] Sending Floodlight {"1":true}

I could then see it appearing to respond in my Home app on the iPad I'm using as a Home Hub, however the light itself remained off.

[Tuya] Sending Floodlight {"3":255}
[Tuya] setColorTemperature: 203
[Tuya] Sending Floodlight {"2":"white","4":115}
[Tuya] Sending Floodlight {"1":true}

I still see some of this in the log as well.

[5/22/2021, 4:11:02 PM] [homebridge-tuya] This plugin generated a warning from the characteristic 'Brightness': characteristic was supplied illegal value: number -11 exceeded minimum of 0. See https://git.io/JtMGR for more info.
[5/22/2021, 4:11:02 PM] [homebridge-tuya] Error: 
    at Brightness.Characteristic.characteristicWarning (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2038:105)
    at Brightness.Characteristic.validateUserInput (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1946:16)
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1533:24
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:9:18
    at RGBTWLightAccessory.getBrightness (/homebridge/node_modules/homebridge-tuya/lib/RGBTWLightAccessory.js:141:70)
    at Brightness.emit (events.js:315:20)
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1508:14
    at new Promise (<anonymous>)
    at Brightness.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1506:12)
    at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:143:27)
[5/22/2021, 4:11:02 PM] [homebridge-tuya] This plugin generated a warning from the characteristic 'Color Temperature': characteristic value expected valid finite number and received "NaN" (number). See https://git.io/JtMGR for more info.
[5/22/2021, 4:11:02 PM] [homebridge-tuya] Error: 
    at ColorTemperature.Characteristic.characteristicWarning (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2038:105)
    at ColorTemperature.Characteristic.validateUserInput (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1931:16)
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1533:24
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:9:18
    at RGBTWLightAccessory.getColorTemperature (/homebridge/node_modules/homebridge-tuya/lib/RGBTWLightAccessory.js:152:9)
    at ColorTemperature.emit (events.js:315:20)
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1508:14
    at new Promise (<anonymous>)
    at ColorTemperature.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1506:12)
    at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:143:27)
[5/22/2021, 4:11:02 PM] [homebridge-tuya] This plugin generated a warning from the characteristic 'On': characteristic value expected boolean and received undefined. See https://git.io/JtMGR for more info.
[5/22/2021, 4:11:02 PM] [homebridge-tuya] Error: 
    at On.Characteristic.characteristicWarning (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2038:105)
    at On.Characteristic.validateUserInput (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1915:14)
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1533:24
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:9:18
    at _callback (/homebridge/node_modules/homebridge-tuya/lib/BaseAccessory.js:71:17)
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

Are there any further troubleshooting steps I might take, or does this indicate a bug with this particular model of bulb (Cree)? I'm willing to provide any further logs or info if it would help.

I'm running Homebridge v1.3.4 with Node.js v14.16.1 with homebridge-tuya v2.0.1 within the onzu-homebridge1 docker container on a Synology NAS.

kameshtagore commented 2 years ago

+1

mjmvisser commented 2 years ago

I'm having the exact same problem with a generic Tuya downlight. I retrieved the keys via tinytuya. The Tuya app can control the light. It appears in Homebridge, but nothing happens when I turn it on/off/change settings. I tried both HEXHSB and HSB - no difference.

Log spew:

[TuyaDiscovery] Discovery started on port 6666.
[TuyaDiscovery] Discovery started on port 6667.
[24/12/2021, 22:19:03] Homebridge v1.3.8 (HAP v0.9.7) (Homebridge C8E2) is running on port 51779.
[24/12/2021, 22:19:04] [TuyaLan] Discovered Smart Bulb 2 (ebbc5c932afe52aebab7fx) identified as RGBTWLight (3.3)
[Tuya] Changing ping gap for Smart Bulb 2 to 9s
[Tuya DEBUG] reconnect called for Smart Bulb 2
[24/12/2021, 22:19:04] [TuyaLan] Connected to Smart Bulb 2
[Tuya] Sending first query to Smart Bulb 2 (3.3)
[Tuya] Heard back from Smart Bulb 2 with command 10
[24/12/2021, 22:19:04] [TuyaLan] Ready to handle Smart Bulb 2 (RGBTWLight:3.3) with signature {"20":true,"21":"white","22":1000,"23":1000,"24":"000003e803e8","25":"000e0d0000000000000000c80000","26":0}
[24/12/2021, 22:19:05] [homebridge-tuya] This plugin generated a warning from the characteristic 'On': characteristic value expected boolean and received undefined. See https://git.io/JtMGR for more info.
[24/12/2021, 22:19:05] [homebridge-tuya] This plugin generated a warning from the characteristic 'On': characteristic value expected boolean and received undefined. See https://git.io/JtMGR for more info.

Switching back to tuya-web for now :-(.

Config:

            "type": "RGBTWLight",
            "name": "Smart Bulb 1",
            "id": "eb2a3268a518fe06d9tzno",
            "key": "XXXXXXXXXXXXXX",
            "manufacturer": "Tuya",
            "model": "Default-Model",
            "colorFunction": "HSB"