Wondering what’s next for npm?Check out our public roadmap! »

homebridge-tuya-smartlamp

0.5.7 • Public • Published

Homebridge plugin for Lohas/Tuya Led Smart Bulb and Teckin/Tuya Smart Socket

npm npm GitHub last commit GitHub license

Example config.json for Tuya based LED Smart Lamp that support dimmable and changing of color temperature:

    "accessories"[
        {
            "accessory": "TuyaSmartDevice",
            "name": "Kitchen Light",
            "type": "lightbulb dimmable tunable",
            "manufacturer": "LOHAS",
            "model": "Smart Lamp",
            "devId": "XXXXXXXXXX",
            "localKey": "XXXXXXXXXXXXXX",
            "brightMin": 11
        }
    ]

Example config.json for Tuya based multiple LED Smart Lamp, the second one is Multicolor LED RGB Lamp:

    "accessories"[
        {
            "accessory": "TuyaSmartDevice",
            "name": "Kitchen Light",
            "type": "lightbulb dimmable tunable",
            "manufacturer": "LOHAS",
            "model": "Smart Lamp",
            "devId": "XXXXXXXXXX",
            "localKey": "XXXXXXXXXXXXXX",
            "brightMin": 11
        },
        {
            "accessory": "TuyaSmartDevice",
            "name": "Bedroom Light",
            "type": "lightbulb dimmable tunable color",
            "manufacturer": "LOHAS",
            "model": "Smart Lamp Multicolor",
            "devId": "XXXXXXXXXX",
            "localKey": "XXXXXXXXXXXXXX",
            "enableColor": true
        },
    ]

Example config.json for Tuya based Smart Socket with energy monitoring

    "accessories"[
        {
            "accessory": "TuyaSmartDevice",
            "name": "Coffee Machine",
            "type": "outlet monitoring",
            "manufacturer": "Teckin",
            "model": "Smart Socket SP23",
            "devId": "XXXXXXXXXX",
            "localKey": "XXXXXXXXXXXXXX",
            "interval": 15
        }
    ]

Example config.json for Tuya based Power Strip

    "accessories"[
        {
            "accessory": "TuyaSmartDevice",
            "name": "PSB",
            "type": "powerstrip",
            "manufacturer": "China",
            "model": "3A4U-UK",
            "devId": "XXXXXXXXXX",
            "localKey": "XXXXXXXXXXXXXX",
            "switchNames": ["Plug1", "Plug2", "Plug3", "USB"],
            "switchDPSs": [1, 2, 3, 4],
        }
    ]

To obtain the devId (hint: it has the MAC address in it), the localKey and the productKey, carefully read and review these procedures: Linking a Tuya Device

Description of config structure:

Key Purpose
accessory obligatory set to "TuyaSmartDevice"
name device name passed to HomeKit
type characteristic of device - tunable means posibility of changing white light temperature
manufacturer simply passed to HomeKit, can be found in device details
model simply passed to HomeKit, can be found in device details
devId must be obtained from device Linking a Tuya Device
localKey must be obtained from device Linking a Tuya Device
ip specify an ip address (optional)
version TuyAPI protocol version, default is 3.1, for new devices use 3.3
brightMin minimum value which can be set as bulb's brightness, usualy it's 25 (default) for RGB bulbs and 11 for others
brightMax maximum value which can be set as bulb's brightness, default is 255
tempMin minimum value which can be set as bulb's warm white light temperature, default is 0
tempMax maximum value which can be set as bulb's cool white light temperature, default is 255
interval interval in seconds for pooling energy parameters and saving in history for Eve App
enableColor enable color controls for bulb
switchNames names of plugs in power strip
switchDPSs DPS numbers corresponding with plugs in power strip
logErrors if true errors are logged into homebridge

Tested on the following Smart LED bulbs (Non affiliated links following) and Smart WiFi sockets:

This plugin should work with any Tuya based LED bulb that can be added to the Tuya or Smart Life apps, or even any Tuya based Samrt Switch (simply set type as an empty string).

LOHAS is a popular brand and theirs products can be found on LOHAS Lights or on Amazon: LOHAS Lights on Amazon

Work in progress...

Install

npm i homebridge-tuya-smartlamp

DownloadsWeekly Downloads

41

Version

0.5.7

License

MIT

Unpacked Size

151 kB

Total Files

16

Last publish

Collaborators

  • avatar