Wednesday, August 11, 2021

TP Link Local API

 Due to recent issues I have experienced with my TP Link outlets becoming unavailable for a brief moment causing some automations to be triggered, I have decided to reset all of my smart outlets to local only control to see if it resolves the issue. This has the added bonus of removing one of my dependencies on web services. 

To do this I had to sign out of the TP Link Kasa app. TP Link does not currently let you opt for local only control if you are signed into their app. Then one by one place the outlets in pairing mode by holding down the power button for a few seconds.

Local Only Access


Once each device was set to local only control I was able to remove the old Home Assistant GUI integration and instead configure it via the configurations.yaml. In order to make this a one time change I first had to set static IP addresses for each device. Since I make use a a PI Hole adblocker as both my DNS and DHCP server, I was able to easily find each device based on their hostname reported to the DHCP server matching their TP Link model number. The MAC address can also easily be found by reading the label on the physical device or checking the device info in the Kasa app.

         
MAC ADDRESS


Once the devices have a static IP it is just a simple matter of adding the appropriate config to Home assistant.  The below example shows the config I ended up using.  One interesting thing to note was that my existing automations and Dashboards in Home Assistant  didn't require reconfiguration. I don't know if that was due to the mac addresses not changing or the device descriptions in Kasa were not changed. 

Configuration.yaml


No comments:

Post a Comment

Server Monitoring

I have a headless Linux server that I have previously written about for ripping media disks.  While I have had MQTT integrated into the bash...