drumfreak / homebridge-tuya-powerstrip Goto Github PK
View Code? Open in Web Editor NEWhomebridge-tuya-powerstrip
License: MIT License
homebridge-tuya-powerstrip
License: MIT License
I've gotten the device ID and IP address and the localkey but still can't get it to work.
Here is my config.json
{
"accessory": "TuyaPowerStrip",
"name": "Outside Outlets",
"description": "Tuya Power Strip Outlet 1",
"ip": "192.168.3.124",
"devId": "03200209dc4f2xxxxxxx”,
"localKey": "ebc20793cxxxxxxx”,
"dps": 2,
"apiMinTimeout": 100,
"apiMaxTimeout": 1000,
"apiRetries": 1,
"apiDebug": false,
"refreshInterval": 120,
"debugPrefix": "~~~!~~~ ",
"debug": false,
"deviceEnabled": true
}],
I'm getting this Error message since this morning. Any ideas where this is coming from? I just added an Airport Express to my Home at about the same time. Is this connected?
Regards,
Bart
I got this setup and working on my local server. I have three of these Power Strips and everything seems to mostly work well.
The only one issue is that, sometimes when I try to Toggle a device, the whole strip in question will Turn OFF & then back to its original state. Also, if I try to command multiple outlets on the same strip together, then at rare times things function as intended, but not always.
The debug logs do not indicate anything weird at all when this happens.
One of power outlets works with TuyaOutlet plugin, but they doesn’t work with tuya-powerstrip.
I’ve gotten the device ID, IP address and local key.
Could you tell me what is wrong?
I got this error log.
[2018-6-10 16:47:30] [Tuya Powerstrip - ライト2] connect ECONNREFUSED 219.102.113.66:6668
[2018-6-10 16:47:30] [Tuya Powerstrip - ライト1] connect ECONNREFUSED 219.102.113.66:6668
[2018-6-10 16:47:30] [Tuya Powerstrip - ライト6] connect ECONNREFUSED 219.102.113.66:6668
[2018-6-10 16:47:30] [Tuya Powerstrip - ライト5] connect ECONNREFUSED 219.102.113.66:6668
[2018-6-10 16:47:30] [Tuya Powerstrip - ライト4] connect ECONNREFUSED 219.102.113.66:6668
[2018-6-10 16:47:30] [Tuya Powerstrip - ライト3] connect ECONNREFUSED 219.102.113.66:6668
here is my config.json
"accessories": [
{
"accessory": "TuyaOutlet",
"name": "Tuya Outlet221",
"devId": "01205862dc4a341ac124",
"localKey": "a0f0c285dc88041b"
},
{
"accessory": "TuyaPowerStrip",
"name": "ライト1",
"description" : "Tuya Power Strip Outlet 1",
"ip": "219.102.113.66",
"devId": "01205862dc4a341ac124",
"localKey": "a0f0c285dc88041b",
"dps" : 1,
"apiMinTimeout" : 100,
"apiMaxTimeout" : 1000,
"apiRetries": 1,
"apiDebug" : false,
"refreshInterval" : 120,
"debugPrefix" : "~~~!~~~ ",
"debug" : false,
"deviceEnabled" : true },
{
"accessory": "TuyaPowerStrip",
"name": "ライト2",
"description" : "Tuya Power Strip Outlet 2",
"ip": "219.102.113.66",
"devId": "01205862dc4a341ac124",
"localKey": "a0f0c285dc88041b",
"dps" : 2,
"apiMinTimeout" : 100,
"apiMaxTimeout" : 1000,
"apiRetries": 1,
"apiDebug" : false,
"refreshInterval" : 120,
"debugPrefix" : "~~~!~~~ ",
"debug" : false,
"deviceEnabled" : true
},
{
"accessory": "TuyaPowerStrip",
"name": "ライト3",
"description" : "Tuya Power Strip Outlet 3",
"ip": "219.102.113.66",
"devId": "01205862dc4a341ac124",
"localKey": "a0f0c285dc88041b",
"dps" : 3,
"apiMinTimeout" : 100,
"apiMaxTimeout" : 1000,
"apiRetries": 1,
"apiDebug" : false,
"refreshInterval" : 120,
"debugPrefix" : "~~~!~~~ ",
"debug" : false,
"deviceEnabled" : true
},
{
"accessory": "TuyaPowerStrip",
"name": "ライト4",
"description" : "Tuya Power Strip Outlet 4",
"ip": "219.102.113.66",
"devId": "01205862dc4a341ac124",
"localKey": "a0f0c285dc88041b",
"dps" : 4,
"apiMinTimeout" : 100,
"apiMaxTimeout" : 1000,
"apiRetries": 1,
"apiDebug" : false,
"refreshInterval" : 120,
"debugPrefix" : "~~~!~~~ ",
"debug" : false,
"deviceEnabled" : true
},
{
"accessory": "TuyaPowerStrip",
"name": "ライト5",
"description" : "Tuya Power Strip Outlet 3",
"ip": "219.102.113.66",
"devId": "01205862dc4a341ac124",
"localKey": "a0f0c285dc88041b",
"dps" : 5,
"apiMinTimeout" : 100,
"apiMaxTimeout" : 1000,
"apiRetries": 1,
"apiDebug" : false,
"refreshInterval" : 120,
"debugPrefix" : "~~~!~~~ ",
"debug" : false,
"deviceEnabled" : true
},
{
"accessory": "TuyaPowerStrip",
"name": "ライト6",
"description" : "Tuya Power Strip Outlet 3",
"ip": "219.102.113.66",
"devId": "01205862dc4a341ac124",
"localKey": "a0f0c285dc88041b",
"dps" : 6,
"apiMinTimeout" : 100,
"apiMaxTimeout" : 1000,
"apiRetries": 1,
"apiDebug" : false,
"refreshInterval" : 120,
"debugPrefix" : "~~~!~~~ ",
"debug" : false,
"deviceEnabled" : true
}]
}
I have installed the plugin via npm and made the necessary changes to the config.json (all settings have been verified working using the homebridge-tuya-outlet plugin previously). But when I reboot my Raspberry Pi to add the new accessories, homebridge fails to start.
The syslog reports problems with a homebridge.hap.Service although I have other plugins using the same service perfectly.
Mar 26 23:19:43 TW_Server homebridge[989]: [2018-3-26 23:19:43] Loaded plugin: homebridge-tuya-powerstrip
Mar 26 23:19:43 TW_Server homebridge[989]: /opt/node/lib/node_modules/homebridge-tuya-powerstrip/index.js:6
Mar 26 23:19:43 TW_Server homebridge[989]: Service = homebridge.hap.Service;
Mar 26 23:19:43 TW_Server homebridge[989]: ^
Mar 26 23:19:43 TW_Server homebridge[989]: ReferenceError: Service is not defined
Mar 26 23:19:43 TW_Server homebridge[989]: at Plugin.module.exports [as initializer] (/opt/node/lib/node_modules/homebridge-tu$
Mar 26 23:19:43 TW_Server homebridge[989]: at Server.<anonymous> (/opt/node/lib/node_modules/homebridge/lib/server.js:160:14)
Mar 26 23:19:43 TW_Server homebridge[989]: at Array.forEach (native)
Mar 26 23:19:43 TW_Server homebridge[989]: at Server._loadPlugins (/opt/node/lib/node_modules/homebridge/lib/server.js:138:22)
Mar 26 23:19:43 TW_Server homebridge[989]: at new Server (/opt/node/lib/node_modules/homebridge/lib/server.js:56:24)
Mar 26 23:19:43 TW_Server homebridge[989]: at module.exports (/opt/node/lib/node_modules/homebridge/lib/cli.js:26:16)
Mar 26 23:19:43 TW_Server homebridge[989]: at Object.<anonymous> (/opt/node/lib/node_modules/homebridge/bin/homebridge:17:22)
Mar 26 23:19:43 TW_Server homebridge[989]: at Module._compile (module.js:569:30)
Mar 26 23:19:43 TW_Server homebridge[989]: at Object.Module._extensions..js (module.js:580:10)
Mar 26 23:19:43 TW_Server homebridge[989]: at Module.load (module.js:503:32)
Mar 26 23:19:43 TW_Server homebridge[989]: at tryModuleLoad (module.js:466:12)
Mar 26 23:19:43 TW_Server homebridge[989]: at Function.Module._load (module.js:458:3)
Mar 26 23:19:43 TW_Server homebridge[989]: at Function.Module.runMain (module.js:605:10)
Mar 26 23:19:43 TW_Server homebridge[989]: at startup (bootstrap_node.js:158:16)
Mar 26 23:19:43 TW_Server homebridge[989]: at bootstrap_node.js:575:3
Mar 26 23:19:43 TW_Server systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
Mar 26 23:19:43 TW_Server systemd[1]: homebridge.service: Unit entered failed state.
Mar 26 23:19:43 TW_Server systemd[1]: homebridge.service: Failed with result 'exit-code'.
please bear with me for opening an issue about the dps:
i managed to get the 4 power outlets of my tuya power strip working as well as the usb outlet. i also found these dps values in the 1.abj file from efamilycloud's 1.abj file:
"dps":{"1":true,"2":true,"101":0,"3":true,"102":0,"4":true,"103":0,"104":0,"105":0,"7":true}
unfortunately, the master switch (called below "Master???") does not work and i don't know how to figure out available/correct dps (since i don't understand how to use the "journalctl -f -u homebridge" command. i also use "DEBUG=* homebridge -D" to get some insights but i don't see available dps values) or use the dps values from the 1.abj file. i only see that 1, 2, 3, 4, and 7 are used correctly in my config:
"accessories": [
{
"accessory": "TuyaPowerStrip",
"name": "Master???",
"description": "Master???",
"ip": "192.168.178.200",
"devId": "17007751600194afc8de",
"localKey": "d2c2512966953903",
"dps": ???,
"apiMinTimeout": 100,
"apiMaxTimeout": 1000,
"apiRetries": 1,
"apiDebug": false,
"refreshInterval": 120,
"debugPrefix": "~~~!~~~ ",
"debug": true,
"superDebug": true,
"deviceEnabled": true
},
{
"accessory": "TuyaPowerStrip",
"name": "Subwoofer",
"description": "Subwoofer",
"ip": "192.168.178.200",
"devId": "17007751600194afc8de",
"localKey": "d2c2512966953903",
"dps": 1,
"apiMinTimeout": 100,
"apiMaxTimeout": 1000,
"apiRetries": 1,
"apiDebug": false,
"refreshInterval": 120,
"debugPrefix": "~~~!~~~ ",
"debug": true,
"superDebug": true,
"deviceEnabled": true
},
{
"accessory": "TuyaPowerStrip",
"name": "Drucker",
"description": "Drucker",
"ip": "192.168.178.200",
"devId": "17007751600194afc8de",
"localKey": "d2c2512966953903",
"dps": 2,
"apiMinTimeout": 100,
"apiMaxTimeout": 1000,
"apiRetries": 1,
"apiDebug": false,
"refreshInterval": 120,
"debugPrefix": "~~~!~~~ ",
"debug": true,
"superDebug": true,
"deviceEnabled": true
},
{
"accessory": "TuyaPowerStrip",
"name": "Lüfter",
"description": "Lüfter",
"ip": "192.168.178.200",
"devId": "17007751600194afc8de",
"localKey": "d2c2512966953903",
"dps": 3,
"apiMinTimeout": 100,
"apiMaxTimeout": 1000,
"apiRetries": 1,
"apiDebug": false,
"refreshInterval": 120,
"debugPrefix": "~~~!~~~ ",
"debug": true,
"superDebug": true,
"deviceEnabled": true
},
{
"accessory": "TuyaPowerStrip",
"name": "TV",
"description": "TV",
"ip": "192.168.178.200",
"devId": "17007751600194afc8de",
"localKey": "d2c2512966953903",
"dps": 4,
"apiMinTimeout": 100,
"apiMaxTimeout": 1000,
"apiRetries": 1,
"apiDebug": false,
"refreshInterval": 120,
"debugPrefix": "~~~!~~~ ",
"debug": true,
"superDebug": true,
"deviceEnabled": true
},
{
"accessory": "TuyaPowerStrip",
"name": "USB",
"description": "USB",
"ip": "192.168.178.200",
"devId": "17007751600194afc8de",
"localKey": "d2c2512966953903",
"dps": 7,
"apiMinTimeout": 100,
"apiMaxTimeout": 1000,
"apiRetries": 1,
"apiDebug": false,
"refreshInterval": 120,
"debugPrefix": "~~~!~~~ ",
"debug": true,
"superDebug": true,
"deviceEnabled": true
}
]
it would be wonderful if you could have a look and maybe help me with "journalctl -f -u homebridge" and figuring out the dps numbers. thank you in advance :)
Finally had a chance to re-test this issue.
I have a Tuya-Based plug that has been installed and configured using the eFamilyCloud app. I can power the plug on and off using the supplied app.
I have also installed the homebridge-tuya-powerstrip plugin and added the necessary entries to my config.json. Following reboot, the plug appears in the Home app, and Homebridge correctly reports the power status - on or off.
But... instructions to toggle power are never received by the plug.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.