NorthernMan54 / homebridge-tasmota

Plugin for Tasmota devices leveraging Home Assistant auto discovery
Apache License 2.0
35 stars 9 forks source link

Devices disappear for no reason #25

Open magimat opened 3 years ago

magimat commented 3 years ago

Hi,

I have 4 tasmota switches/outlets and after setting SetOption19 1 on each one and restarting homebridge, they all get auto discovered fine and work flawlessly in Home app... but only for a few minutes, and then they disappear without any error message in the logs?!?

If I restart homebridge, they get back, but disappear again a few minutes later.

Really annoying, because everything works fine, if the devices would just stay there!

Anything I am overlooking here?

NorthernMan54 commented 3 years ago

What version of Tasmota ?

Did you change any of the plugin config defaults ?

magimat commented 3 years ago

devices are using tasmota 8.5.1

and I dont think I changed any setting, here is my config:

    {
        "name": "Tasmota",
        "mqttHost": "192.168.11.202",
        "cleanup": 24,
        "debug": true,
        "history": true,
        "historyInterval": 10,
        "effects": false,
        "platform": "Tasmota"
    }
NorthernMan54 commented 3 years ago

I installed 8.5.1 on one of my test devices and was not able to recreate your issue

Devices being removed can be triggered by two different conditions

1 - Turning off autodiscovery ( ie setoption19 0 ) - This will immediately remove the device from homebridge and HomeKit

2 - Cleanup period occurring without a status message being received from the device.

If you run in debug mode, logging will include more details about what is occurring and possibly why.

magimat commented 3 years ago

I did some more testing this morning.

I enabled all the debug info and here is what I get as soon as I set "setoption19 1" on one device, so discovery looks fine from what I can tell:

2021-01-17T16:55:42.132Z Tasmota:platform Discovered -> homeassistant/switch/62064B_RL_1/config tswitch_house { name: 'tswitch_house', stat_t: 'tele/tswitch_house/STATE', avty_t: 'tele/tswitch_house/LWT', pl_avail: 'Online', pl_not_avail: 'Offline', cmd_t: 'cmnd/tswitch_house/POWER', val_tpl: '{{value_json.POWER}}', pl_off: 'OFF', pl_on: 'ON', uniq_id: '62064B_RL_1', dev: { ids: [ '62064B' ] }, tasmotaType: 'switch' } 2021-01-17T16:55:42.140Z Tasmota:Service fakegatoService exists tswitch_house 2021-01-17T16:55:42.141Z Tasmota:mqtt sendMessage cmnd/tswitch_house/teleperiod 300 2021-01-17T16:55:42.143Z Tasmota:platform discovery devices - this.api.registerPlatformAccessories [1/17/2021, 11:55:42 AM] [Tasmota] Adding new accessory: tswitch_house [1/17/2021, 11:55:42 AM] [Tasmota] Creating statusUpdate listener for tele/tswitch_house/STATE tswitch_house HAP Warning: Characteristic 000000E3-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 00000049-0000-1000-8000-0026BB765291. Adding anyway. 2021-01-17T16:55:42.183Z Tasmota:platform Discovered -> homeassistant/sensor/62064B_status/config tswitch_house status { name: 'tswitch_house status', stat_t: 'tele/tswitch_house/HASS_STATE', avty_t: 'tele/tswitch_house/LWT', pl_avail: 'Online', pl_not_avail: 'Offline', json_attr_t: 'tele/tswitch_house/HASS_STATE', unit_of_meas: '%', val_tpl: "{{value_json['RSSI']}}", ic: 'mdi:information-outline', uniq_id: '62064B_status', dev: { ids: [ '62064B' ], name: 'tswitch_house', mdl: 'Tuya MCU', sw: '8.5.1(tasmota)', mf: 'Tasmota' }, tasmotaType: 'sensor' } [1/17/2021, 11:55:42 AM] [Tasmota] Found existing accessory: tswitch_house status [1/17/2021, 11:55:42 AM] [Tasmota] Creating service: tswitch_house status sensor [1/17/2021, 11:55:42 AM] [Tasmota] Setting accessory information tswitch_house status 2021-01-17T16:55:42.190Z Tasmota:Service fakegatoService exists tswitch_house status 2021-01-17T16:55:42.191Z Tasmota:mqtt sendMessage cmnd/tswitch_house/teleperiod 300 2021-01-17T16:55:42.192Z Tasmota:platform discoveryDevices - this.api.updatePlatformAccessories 2021-01-17T16:55:42.986Z Tasmota:switch MQTT tele/tswitch_house/STATE {"Time":"2021-01-17T17:55:42","Uptime":"96T15:41:07","UptimeSec":8350867,"Heap":25,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":2,"POWER":"OFF","Wifi":{"AP":1,"SSId":"matnet","BSSId":"D8:6C:63:E6:37:1D","Channel":6,"RSSI":90,"Signal":-55,"LinkCount":2,"Downtime":"0T00:01:15"}} [1/17/2021, 11:55:42 AM] [Tasmota] Updating 'tswitch_house' to false

Like I said, at this point, device shows in Home app and works just fine and after about 1 minute, it just vanishes, and I get absolutely nothing is homebridge's log.

Apparently, my devices only disappear from the Home app, but not really from your plugin, because after it disappears, if I go to the tasmota console and force "setoption19 0", I instantly get this in the logs:

2021-01-17T17:01:07.130Z Tasmota:platform serviceCleanup 62064B_RL_1 [1/17/2021, 12:01:07 PM] [Tasmota] Removing Service tswitch_house [1/17/2021, 12:01:07 PM] [Tasmota] availabilitySubscribe missing tswitch_house 2021-01-17T17:01:07.147Z Tasmota:platform serviceCleanup - this.api.updatePlatformAccessories [1/17/2021, 12:01:07 PM] [Tasmota] Removing Accessory tswitch_house 2021-01-17T17:01:07.157Z Tasmota:platform serviceCleanup 62064B_status 2021-01-17T17:01:07.157Z Tasmota:platform serviceCleanup - object 2021-01-17T17:01:07.157Z Tasmota:platform unregister - this.api.unregisterPlatformAccessories

which leads me to believe that up to that point, it was still registered somehow, even though it's not visible anymore in the Home app.... really confusing!

Thanks for your help btw!

NorthernMan54 commented 3 years ago

What version of homebridge?

magimat commented 3 years ago

v1.2.5 installed with docker on a raspberry pi 3.

NorthernMan54 commented 3 years ago

Any other plugins in the same homebridge instance?

later today I will update one of my instances to match

magimat commented 3 years ago

I have a couple other plugins installed in my homebridge instance, maybe 3-4.

When I get some time, I will try to start a fresh homebridge instance to test.