TPLink Kasa (Homekit/Dashboard/MQTT control)

This is for my HS100 Kasa power point controlling a heater.

There is:

  1. A switch in my Home app (iOS)
  2. A dashboard switch
  3. An already running MQTT server on a Pi3

The heater can be activated by pressing a physical button on the HS100, this will dress the dashboard/Home switches to match.

Either of the dashboard or Homekit switches will dress the other.

Any issues let me know!

[{"id":"c2b6e3e3.2a67f","type":"homekit-service","z":"d176a11a.5c791","isParent":true,"bridge":"","parentService":"","name":"Homekit Switch - garage heater","serviceName":"Switch","topic":"","filter":false,"manufacturer":"null","model":"null","serialNo":"null","characteristicProperties":"","x":230,"y":700,"wires":[["b53b2578.2b3258","edd16f89.2f71d"]],"inputLabels":["input"]},{"id":"b53b2578.2b3258","type":"ui_switch","z":"d176a11a.5c791","name":"Dashboard Switch - garage heater","label":"Garage heater","tooltip":"","group":"e5d2a9af.291328","order":1,"width":0,"height":0,"passthru":false,"topic":"","style":"","onvalue":"{\"On\":true}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"On\":false}","offvalueType":"json","officon":"","offcolor":"","x":240,"y":560,"wires":[["c2b6e3e3.2a67f"]]},{"id":"9c64ffd8.35a05","type":"smart-plug","z":"d176a11a.5c791","name":"Kasa HS100 garage heater","device":"","interval":10000,"eventInterval":1000,"x":780,"y":700,"wires":[["21178081.1c86a"]]},{"id":"edd16f89.2f71d","type":"function","z":"d176a11a.5c791","name":"function","func":"node.status({fill:\"green\",shape:\"ring\",text:msg.payload.On});  \nreturn { payload: msg.payload.On };","outputs":1,"noerr":0,"x":500,"y":700,"wires":[["9c64ffd8.35a05"]]},{"id":"bf24899d.631db8","type":"inject","z":"d176a11a.5c791","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":530,"y":540,"wires":[["9c64ffd8.35a05"]]},{"id":"8514eb6.40b2918","type":"inject","z":"d176a11a.5c791","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":530,"y":580,"wires":[["9c64ffd8.35a05"]]},{"id":"695831bc.f2022","type":"mqtt out","z":"d176a11a.5c791","name":"MQTT: Garage heater 1","topic":"garage/heating/heater1","qos":"","retain":"","broker":"","x":1070,"y":820,"wires":[],"info":"if relay_state = 0\n{ return msg.payload = false}\nelse\nreturn msg.payload = true;"},{"id":"21178081.1c86a","type":"change","z":"d176a11a.5c791","name":"(Set) Relay State","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.relay_state","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":820,"wires":[["695831bc.f2022"]]},{"id":"a91703c3.0816a","type":"mqtt in","z":"d176a11a.5c791","name":"garage/heating/heater1","topic":"garage/heating/heater1","qos":"1","datatype":"auto","broker":"","x":140,"y":820,"wires":[["f66524fc.d561f8"]]},{"id":"f66524fc.d561f8","type":"change","z":"d176a11a.5c791","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"str","to":"{\"On\":true}","tot":"json"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"str","to":"{\"On\":false}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":820,"wires":[["c2b6e3e3.2a67f"]]},{"id":"e5d2a9af.291328","type":"ui_group","z":"","name":"Heating","tab":"5958998c.f31b08","disp":true,"width":"6","collapse":false},{"id":"5958998c.f31b08","type":"ui_tab","z":"","name":"Garage","icon":"dashboard","order":4,"disabled":false,"hidden":false}]

Flow Info

Created 6 years, 5 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x2)
  • function (x1)
  • inject (x2)
  • mqtt in (x1)
  • mqtt out (x1)
Other
  • homekit-service (x1)
  • smart-plug (x1)
  • ui_group (x1)
  • ui_switch (x1)
  • ui_tab (x1)

Tags

  • kasa
  • tplink
  • dashboard
  • homekit
  • homebridge
  • heater
  • switch
  • garage
  • 877
  • mqtt
  • 877dev
  • hs100
  • socket
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option