plasticrake / homebridge-tplink-smarthome

TP-Link Smarthome Plugin for Homebridge
MIT License
474 stars 70 forks source link

Scenes deleting when restarting #187

Open EugeneKallis opened 3 years ago

EugeneKallis commented 3 years ago

Expected Behavior

Expected Behavior is when i restart homebridge my scenes relating to my homebridge accessories should retain.

Current Behavior

Currently i only use tplink smarthome with homebridge. On the Homekit app i create a screen with just the tplink accessories and it works. The problem comes when i restart Homebridge that scene is deleted but the accessories persist.

Steps to Reproduce (for bugs)

Versions

Docker Ubuntu
 node --version 
v14.16.0
homebridge --version
1.3.3
Ubuntu server 18.04

Configuration

 {
            "name": "TplinkSmarthome",
            "addCustomCharacteristics": false,
            "deviceTypes": [
                "plug",
                "bulb"
            ],
            "devices": [
                {
                    "host": "192.168.10.30"
                },
                {
                    "host": "192.168.10.31"
                },
                {
                    "host": "192.168.10.32"
                },
                {
                    "host": "192.168.10.33"
                }
            ],
            "platform": "TplinkSmarthome"
        }

Homebridge Log / Command Output

[3/16/2021, 12:46:02 PM] [HB Supervisor] Started Homebridge v1.3.3 with PID: 1577
Initializing HAP-NodeJS v0.9.3...
[3/16/2021, 12:46:03 PM] Loaded config.json with 0 accessories and 2 platforms.
[3/16/2021, 12:46:03 PM] Loaded 4 cached accessories from cachedAccessories.
[3/16/2021, 12:46:03 PM] ---
[3/16/2021, 12:46:04 PM] Disabled plugin: homebridge-dummy@0.5.0
[3/16/2021, 12:46:04 PM] ---
[3/16/2021, 12:46:04 PM] Loaded plugin: homebridge-tplink-smarthome@6.3.0
[3/16/2021, 12:46:04 PM] Registering platform 'homebridge-tplink-smarthome.TplinkSmarthome'
[3/16/2021, 12:46:04 PM] ---
[3/16/2021, 12:46:04 PM] Loaded plugin: homebridge-config-ui-x@4.40.0
[3/16/2021, 12:46:04 PM] Registering platform 'homebridge-config-ui-x.config'
[3/16/2021, 12:46:04 PM] ---
[3/16/2021, 12:46:04 PM] Loading 2 platforms...
[3/16/2021, 12:46:04 PM] [Config] Initializing config platform...
[3/16/2021, 12:46:04 PM] [Config] Running in Service Mode
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] Initializing TplinkSmarthome platform...
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] homebridge-tplink-smarthome v6.3.0, node v14.16.0, homebridge v1.3.3, api v2.7
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] Configuring cached accessory: [Living room Fan] UUID: 2b5e48e2-1dd5-4944-9485-e7dab4cdccdf deviceId: 800654BCF606658071617DE4F03D16671CF2C84C 
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] Configuring cached accessory: [Living room Back Lights] UUID: db858ce2-2a75-45a1-8004-3fe42d422ae6 deviceId: 80065A138746A2B798741E9FAA78183B1B7476D9 
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] Configuring cached accessory: [Dining Room Lights] UUID: ea46fe54-0d8f-47cf-a754-cab9b7af1261 deviceId: 800686EE96CEAF9C8A1C7ECF0C1813591B74FBD0 
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] Configuring cached accessory: [Living room Spot lights] UUID: cab6aa34-d2f2-44ac-9d26-fff8135a590c deviceId: 8006F58A4916A2BB8EF788E19F166DF01B74E0E0 
Preparing Advertiser for 'Homebridge 35B3 4413' using bonjour-hap backend!

Starting to advertise 'Homebridge 35B3 4413' using bonjour-hap backend!
[3/16/2021, 12:46:04 PM] Homebridge v1.3.3 (Homebridge 35B3) is running on port 51957.
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] New Device Online: [Living room Fan] plug [800654BCF606658071617DE4F03D16671CF2C84C] 192.168.10.30 9999
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] Adding: [Living room Fan] plug [800654BCF606658071617DE4F03D16671CF2C84C]
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] New Device Online: [Living room Back Lights] plug [80065A138746A2B798741E9FAA78183B1B7476D9] 192.168.10.32 9999
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] Adding: [Living room Back Lights] plug [80065A138746A2B798741E9FAA78183B1B7476D9]
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] New Device Online: [Dining Room Lights] plug [800686EE96CEAF9C8A1C7ECF0C1813591B74FBD0] 192.168.10.33 9999
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] Adding: [Dining Room Lights] plug [800686EE96CEAF9C8A1C7ECF0C1813591B74FBD0]
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] New Device Online: [Living room Spot lights] plug [8006F58A4916A2BB8EF788E19F166DF01B74E0E0] 192.168.10.31 9999
[3/16/2021, 12:46:04 PM] [TplinkSmarthome] Adding: [Living room Spot lights] plug [8006F58A4916A2BB8EF788E19F166DF01B74E0E0]
EugeneKallis commented 3 years ago

I wanted to add a note, i changed from manual discovery to automatic and Im now able to restart Homebridge without having to add the switches to my scenes.

IGLarrea commented 3 years ago

Hi there,

I seem to be having the same exact problem. This plugin is forcing my entire homebridge setup to forget all cached devices on every restart. Could you be more specific as what you did to remedy this?

EugeneKallis commented 3 years ago

Hello @IGLarrea,

So i actually did 2 things but i didnt take the time to figure out which exactly fixed it.

First thing was i had 2 networks, 192.168.1.1 and 192.168.10.1. I had my Homebridge on 192.168.1.1 and my lights on the other network. So i switched the lights to be on the same network. On top of that i removed static ip and let it discover automatically. From that point on i havent had a issue.

I hope this helps.