Skip to content

Commit

Permalink
issues#2
Browse files Browse the repository at this point in the history
add: get device information.
  • Loading branch information
sanlike0911 committed Aug 19, 2021
1 parent ca89b55 commit eb15edd
Show file tree
Hide file tree
Showing 10 changed files with 885 additions and 345 deletions.
246 changes: 241 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ npm install node-red-contrib-tplink-tapo-connect-api

1) payload: numbar `*required`

set ON/OFF of the smart plug.
Set ON/OFF of the smart plug.
Get device information in the option settings.

```json
0: power off
1: power on
```text
0: smart plug power off
1: smart plug power on
255: smart plug device infomation
```
- Outputs
Expand All @@ -76,8 +78,242 @@ npm install node-red-contrib-tplink-tapo-connect-api
}
```
[smart plug device infomation]
You can tell if the device is on or off by getting "device_on".
```text
true: smart plug power on
false: smart plug power off
```
```javascript
{
result: true,
tapoDeviceInfo: {
device_id: "*************"
fw_ver: "1.2.10 Build 20200609 Rel. 33394"
hw_ver: "1.0.0"
type: "SMART.TAPOPLUG"
model: "P105"
mac: "XX-XX-XX-XX-XX-XX"
hw_id: "*************"
fw_id: "*************"
oem_id: "*************"
specs: "JP"
device_on: false
on_time: 0
overheated: false
nickname: "3d printer power supply"
location: "XXXXXXXXXXXXXXXX"
avatar: "plug"
time_usage_today: 0
time_usage_past7: 0
time_usage_past30: 0
longitude: 0
latitude: 0
has_set_location_info: true
ip: "192.168.0.XXX"
ssid: "SSID"
signal_level: 0
rssi: 0
region: "Asia/Tokyo"
time_diff: 0
lang: "ja_JP"
}
}
```
- example
```json
[{"id":"35250d14.0fb0b2","type":"tab","label":"example-1","disabled":false,"info":""},{"id":"fb493813.249f08","type":"tplink_tapo_connect_api","z":"35250d14.0fb0b2","name":"","email":"[email protected]","password":"password","deviceIp":"192.168.0.100","deviceAlias":"3d printer power supply","deviceIpRange":"192.168.0.0/24","x":570,"y":140,"wires":[["2aa38c09.564724"]]},{"id":"8311f395.25e56","type":"inject","z":"35250d14.0fb0b2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":310,"y":140,"wires":[["fb493813.249f08"]]},{"id":"2aa38c09.564724","type":"debug","z":"35250d14.0fb0b2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":790,"y":140,"wires":[]},{"id":"9158e6ef.dd5d78","type":"inject","z":"35250d14.0fb0b2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"str","x":310,"y":220,"wires":[["fb493813.249f08"]]},{"id":"79f7a84a.4c4d88","type":"comment","z":"35250d14.0fb0b2","name":"power on","info":"","x":260,"y":100,"wires":[]},{"id":"27568da0.cc1852","type":"comment","z":"35250d14.0fb0b2","name":"power off","info":"","x":260,"y":180,"wires":[]}]
[
{
"id": "b5e3d925d80b36ad",
"type": "group",
"z": "35250d14.0fb0b2",
"style": {
"stroke": "#999999",
"stroke-opacity": "1",
"fill": "none",
"fill-opacity": "1",
"label": true,
"label-position": "nw",
"color": "#a4a4a4"
},
"nodes": [
"fb493813.249f08",
"8311f395.25e56",
"2aa38c09.564724",
"9158e6ef.dd5d78",
"79f7a84a.4c4d88",
"27568da0.cc1852",
"3338a0f2585b9662",
"f5ca83ef74c5c137"
],
"x": 34,
"y": 19,
"w": 772,
"h": 302
},
{
"id": "fb493813.249f08",
"type": "tplink_tapo_connect_api",
"z": "35250d14.0fb0b2",
"g": "b5e3d925d80b36ad",
"name": "",
"email": "[email protected]",
"password": "password",
"deviceIp": "192.168.0.120",
"deviceAlias": "3d printer power supply",
"deviceIpRange": "192.168.0.0/24",
"x": 470,
"y": 100,
"wires": [
[
"2aa38c09.564724"
]
]
},
{
"id": "8311f395.25e56",
"type": "inject",
"z": "35250d14.0fb0b2",
"g": "b5e3d925d80b36ad",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 210,
"y": 180,
"wires": [
[
"fb493813.249f08"
]
]
},
{
"id": "2aa38c09.564724",
"type": "debug",
"z": "35250d14.0fb0b2",
"g": "b5e3d925d80b36ad",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 690,
"y": 100,
"wires": []
},
{
"id": "9158e6ef.dd5d78",
"type": "inject",
"z": "35250d14.0fb0b2",
"g": "b5e3d925d80b36ad",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "0",
"payloadType": "str",
"x": 210,
"y": 100,
"wires": [
[
"fb493813.249f08"
]
]
},
{
"id": "79f7a84a.4c4d88",
"type": "comment",
"z": "35250d14.0fb0b2",
"g": "b5e3d925d80b36ad",
"name": "tapo device infomation",
"info": "",
"x": 160,
"y": 240,
"wires": []
},
{
"id": "27568da0.cc1852",
"type": "comment",
"z": "35250d14.0fb0b2",
"g": "b5e3d925d80b36ad",
"name": "power off",
"info": "",
"x": 120,
"y": 60,
"wires": []
},
{
"id": "3338a0f2585b9662",
"type": "inject",
"z": "35250d14.0fb0b2",
"g": "b5e3d925d80b36ad",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "255",
"payloadType": "num",
"x": 210,
"y": 280,
"wires": [
[
"fb493813.249f08"
]
]
},
{
"id": "f5ca83ef74c5c137",
"type": "comment",
"z": "35250d14.0fb0b2",
"g": "b5e3d925d80b36ad",
"name": "power on",
"info": "",
"x": 120,
"y": 140,
"wires": []
}
]
```
Loading

0 comments on commit eb15edd

Please sign in to comment.