homebridge-tplink-smarthome
homebridge-tplink-smarthome copied to clipboard
Renamed TP Plugs in HomeKit app are reset to default 'TP Plug' after Homebridge restart
Expected Behavior
Renamed plugs in homekit should persists across restarts of the Homebridge service.
Current Behavior
Plug name is reset to 'TP Plug' after Homebridge service restart Also the plug drops out of any automation in the HomeKit app
Steps to Reproduce (for bugs)
I don't believe this is a bug necessary - I did see some comments about limited support of naming devices from within Homebridge, but I don't see a way to name specific devices with this plugin anyway (am I missing something?)
Versions
- Node: v10.16.0
- Homebridge: 0.4.50
- OS: Linux docker 4.4.0-148-generic #174-Ubuntu SMP Tue May 7 12:20:14 UTC 2019 x86_64 GNU/Linux
Configuration
None - it was auto discovered and did not add any config
Homebridge Log / Command Output
[8/4/2019, 8:14:49 PM] [homebridge-tplink-smarthome.TplinkSmarthome] homebridge-tplink-smarthome v4.0.1, node v10.16.0, homebridge v0.4.50
[8/4/2019, 8:14:49 PM] [homebridge-tplink-smarthome.TplinkSmarthome] Configuring cached accessory: [TP-LINK_Smart Plug_2E48] undefined 479ed827-fdd3-42fb-b7c5-5475b043defd
.....
[8/4/2019, 8:14:49 PM] [homebridge-tplink-smarthome.TplinkSmarthome] New Device Online: [TP Plug] plug [8006CDA404CF0069BDBBB3BD90D6532F1AEE0DCB] 10.0.1.6 9999
[8/4/2019, 8:14:49 PM] [homebridge-tplink-smarthome.TplinkSmarthome] Adding: [TP Plug] plug [8006CDA404CF0069BDBBB3BD90D6532F1AEE0DCB]
HAP Warning: Characteristic 00000053-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 0000003E-0000-1000-8000-0026BB765291. Adding anyway.
from what I can see those are the only relevant logs.
thanks
That's odd, do you have other non tplink homebridge devices? If so do they have the same issue?
Actually I just saw the undefined
on the 2nd line of your log. It looks like the device lost its deviceId. You can manually edit the json files to add it, or you can remove them and restart and it should create it properly. You can follow the duplicate UUID instructions at the bottom of the readme. I think this issue is homebridge related, or at least I've never been able to figure out how this plugin would ever remove the deviceId.
Hi @plasticrake
Thanks for responding.
I have made the changes I think you are referring too:
"platforms": [ { "platform": "TplinkSmarthome", "name": "TplinkSmarthome", "devices": [ { "host": "10.0.1.81" } ] } ],
I did this after setting the plug to a static ip as the one in the config.
Issue is still the same as well as the logs.
@gramtech No the instructions are about deleting files:
UUID Errors ... By default they are stored in ~/.homebridge/accessories. In some cases you may also need to remove ~/.homebridge/persist and re-pair homebridge to your home.
You can remove them by running:
rm -rf ~/.homebridge/accessories
rm -rf ~/.homebridge/persist
So I followed those instructions and restarted and then needed to repaired homebridge with HomeKit which I did following that I renamed the plug to my desired name and then restarted homebridge which cause the plug to go back to its original name of 'TP Plug'
here are the logs again from after the latest restart, I also provided all logs incase you see something else that may be of interest:
[8/7/2019, 5:55:42 PM] [Config] Homebridge restart request received [8/7/2019, 5:55:43 PM] [Config] Executing restart command: killall -9 homebridge && killall -9 homebridge-config-ui-x [8/7/2019, 5:55:43 PM] [Config] Console v4.5.1 is listening on :: port 8383 [8/7/2019, 5:55:45 PM] Loaded config.json with 2 accessories and 1 platforms. [8/7/2019, 5:55:45 PM] --- [8/7/2019, 5:55:45 PM] Loaded plugin: homebridge-ifttt [8/7/2019, 5:55:45 PM] Registering platform 'homebridge-ifttt.IFTTT' [8/7/2019, 5:55:45 PM] --- [8/7/2019, 5:55:45 PM] Loaded plugin: homebridge-onkyo [8/7/2019, 5:55:45 PM] Registering accessory 'homebridge-onkyo.Onkyo' [8/7/2019, 5:55:45 PM] --- [8/7/2019, 5:55:45 PM] Loaded plugin: homebridge-tplink-smarthome [8/7/2019, 5:55:45 PM] Registering platform 'homebridge-tplink-smarthome.TplinkSmarthome' [8/7/2019, 5:55:45 PM] --- [8/7/2019, 5:55:45 PM] Loaded plugin: homebridge-webos-tv [8/7/2019, 5:55:45 PM] Registering accessory 'homebridge-webos-tv.webostv' [8/7/2019, 5:55:45 PM] --- [8/7/2019, 5:55:45 PM] Loaded plugin: homebridge-config-ui-x [8/7/2019, 5:55:45 PM] Registering platform 'homebridge-config-ui-x.config' [8/7/2019, 5:55:45 PM] --- [8/7/2019, 5:55:45 PM] Loading 1 platforms... [8/7/2019, 5:55:45 PM] [TplinkSmarthome] Initializing TplinkSmarthome platform... [8/7/2019, 5:55:45 PM] [TplinkSmarthome] homebridge-tplink-smarthome v4.0.1, node v10.16.0, homebridge v0.4.50 [8/7/2019, 5:55:45 PM] Loading 2 accessories... [8/7/2019, 5:55:45 PM] [My LG TV] Initializing webostv accessory... [8/7/2019, 5:55:45 PM] [Onkyo Stereo] Initializing Onkyo accessory... [8/7/2019, 5:55:45 PM] [TplinkSmarthome] Configuring cached accessory: [TP Plug] undefined 479ed827-fdd3-42fb-b7c5-5475b043defd Setup Payload: X-HM://0023ISYWY7COM Scan this code with your HomeKit app on your iOS device to pair with Homebridge:
... IMG ...
Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:
┌────────────┐
│ nnn-nn-nnn │
└────────────┘
[8/7/2019, 5:55:45 PM] Homebridge is running on port 51826. [8/7/2019, 5:55:45 PM] [TplinkSmarthome] New Device Online: [TP Plug] plug [8006CDA404CF0069BDBBB3BD90D6532F1AEE0DCB] 10.0.1.81 9999 [8/7/2019, 5:55:45 PM] [TplinkSmarthome] Adding: [TP Plug] plug [8006CDA404CF0069BDBBB3BD90D6532F1AEE0DCB] HAP Warning: Characteristic 00000053-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 0000003E-0000-1000-8000-0026BB765291. Adding anyway. [8/7/2019, 5:55:48 PM] [My LG TV] webOS - Error: connect EHOSTUNREACH 10.0.1.75:3000 [8/7/2019, 5:56:00 PM] [Config] [homebridge] Error: ETIMEDOUT
Any ideas on this? I am still having the same issue. I have upgraded to latest Homebridge version. removed all plugins, re-added this plugin and still getting same issues where it resets the TP Link plug details.
I have three tplink hs200 switches that have such a log when loading accessories:
[11/15/2019, 3:33:22 PM] Loading 1 accessories...
[11/15/2019, 3:33:22 PM] [TplinkSmarthome] Configuring cached accessory: [客厅灯] 80064A6B2D5D125DEEB1CE1BBECC024119AD9496 48f8a65b-27f2-46b9-abac-4106fb425d4c
[11/15/2019, 3:33:22 PM] [TplinkSmarthome] Configuring cached accessory: [前门夜灯] 800679A9709304C9497966E3070F430219AD6EBF 7f6f82c1-dea5-4ed3-b991-5084dd37308a
[11/15/2019, 3:33:22 PM] [TplinkSmarthome] Configuring cached accessory: [厨房] undefined 8dc9b6a7-d8f3-41fe-978b-21cace248edd
Then after displaying the QR code, the log will look like this:
[11/15/2019, 3:33:22 PM] Homebridge is running on port 51826.
[11/15/2019, 3:33:22 PM] [TplinkSmarthome] New Device Online: [前门夜灯] plug [800679A9709304C9497966E3070F430219AD6EBF] 192.168.86.28 9999
[11/15/2019, 3:33:22 PM] [TplinkSmarthome] Adding: [前门夜灯] plug [800679A9709304C9497966E3070F430219AD6EBF]
[11/15/2019, 3:33:22 PM] [TplinkSmarthome] New Device Online: [厨房] plug [800654285426D03DE9E1636819C2B85A1AB29343] 192.168.86.27 9999
[11/15/2019, 3:33:22 PM] [TplinkSmarthome] Adding: [厨房] plug [800654285426D03DE9E1636819C2B85A1AB29343]
HAP Warning: Characteristic 00000053-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 0000003E-0000-1000-8000-0026BB765291. Adding anyway.
[11/15/2019, 3:33:22 PM] [TplinkSmarthome] New Device Online: [客厅灯] plug [80064A6B2D5D125DEEB1CE1BBECC024119AD9496] 192.168.86.25 9999
[11/15/2019, 3:33:22 PM] [TplinkSmarthome] Adding: [客厅灯] plug [80064A6B2D5D125DEEB1CE1BBECC024119AD9496]
Two of the three switches have been normal, but one will become a new accessory every time Homebridge restarts. I don't know if it will be inspired?
Hi @plasticrake I've also been hitting this issue. What I've noticed by deleting the 'persist' and 'accessories' directories and restarting homebridge over and over again is that the last outlet discovered out of the three I have is always the one missing its UUID. I was able to work around the issue by manually splicing together good entries in the cachedAccessories JSON file for all three outlets.
@kevvok what do you mean by "manually splicing together"? can you describe the workaround with a bit more details? Tx!
I've been running into this issue too. I only have one TPLink device, so whenever homebridge restart, the plug resets in homekit.
@kevvok what do you mean by "manually splicing together"? can you describe the workaround with a bit more details? Tx!
Sorry for the ancient thread revival, but I've been going through this same issue and frustrated to not find a well documented fix. After a good deal of time, I've found a workaround that will fix this problem. I have no idea why it's happening, however, so I can't suggest a way to avoid it.
Essentially, when you boot TPLinkSmarthome for the first time, it creates the devices on your homebridge and makes a list (a cache) of all the installed HB devices. Whenever homebridge is rebooted, it looks to see if there are any new devices and compares it to the list of already installed devices. For whatever reason, the cached accessory list doesn't save the Device ID for the very last device from the first reboot, so it ends up creating a "new device" and the "old device" disappears, losing your configuration and automations. You can see how the culprit in your HB log (see bold section with "deviceID: undefined":
[1/7/2022, 12:19:14 AM] [TplinkSmarthome] Configuring cached accessory: [Lamp] UUID: 7cbfc004-2e24-4253-b066-3f503774492c **deviceId: undefined**
[1/7/2022, 12:19:14 AM] [TplinkSmarthome2] New Device Online: [Lamp] plug [800623A36772C7BA44E40A28CFA7B18F1E6E01AD] 192.168.1.94 9999
To fix this, you have to do a couple steps.
-
Find your device's missing deviceID. This is easy, it's located in your Homebridge log. The above log example's DeviceID would be "800623A36772C7BA44E40A28CFA7B18F1E6E01AD". If you have multiple devices, make sure you get the deviceID for the right device.
-
Find your device's MAC address. Couple ways to do this, either check your router's device connections, or look for the sticker on the actual device. It'll look something like this "D8:0D:17:F0:3F:F9"
-
Find your Homebridge's installation folder, called ".homebridge". I'm using hb-service installed on Windows 10, and it's located at C:\Users\USERNAME.homebridge. It'll be a different location depending on what OS your Homebridge is installed on.
-
Open the accessories folder, and find your most recently modified "cachedAccessories" file, and open it. I used VisualStudio but I believe you can open it with notepad as well. Find this exact text string seen below. If you have multiple TPLink devices, this will be repeated for each one. Make sure the "displayName" that follows directly after the text string matches the name of your plug on Homebridge's configuration page.
"platform":"TplinkSmarthome","context":
-
Modify the text string so that it reads (replacing the 8006## string with YOUR deviceID):
"platform":"TplinkSmarthome","context":{"deviceId":"800623A36772C7BA44E40A28CFA7B18F1E6E01AD"}
-
A few lines after that should be a line that reads like this:
"SerialNumber","value":"Default-SerialNumber"
This may not be the exact string, I can't remember exactly what it said.
- Modify that text string so it contains the MAC address and your DeviceID with a space in between, like this:
"SerialNumber","value":"D8:0D:17:F0:3F:F9 800623A36772C7BA44E40A28CFA7B18F1E6E01AD".
Save your file, reboot Homebridge, and hopefully your buggy device should stay put!