TheTimeWalker / wallpanel-android

WallPanel is an Android application for Web Based Dashboards and Home Automation Platforms
https://wallpanel.xyz
Apache License 2.0
414 stars 42 forks source link

[BUG] Lost connection to wall panel #39

Open Clement-B opened 1 year ago

Clement-B commented 1 year ago

Description

After some time or specifc actions, I lost connection to wall panel , here is my observations:

To restore Wall Panel, I can:

  1. Wake up manually the device ;
  2. Go to the settings of Wall Panel ;
  3. Go back to the webview ;
  4. MQTT / HTTP commands immediatly work then ;

Informations about my configuration:

Steps to reproduce

Bug occure when :

Sometime, there is day with no disconnection, sometimes it's 2 or 3 times a day. Right now, Wall Panel seems to disconnect every morning after boot since a few day.

Versions

Some logs

Logs form HA, when trying to enable camera and loosing connection from Wall Panel

Maybe something important to note here is my system have sent in the example 3 or 4 MQTT messages to Wall Panel to enable or disable wall panel camera within like 25 seconds.

2022-10-17 19:05:46.837 DEBUG (MainThread) [homeassistant.components.mqtt.client] Transmitting message on wallpanel/mywallpanel/command: '{"camera":true}', mid: 223
2022-10-17 19:05:47.433 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/sensor/mywallpanel/battery/config: b'{"name":"My Wall Panel Battery Level","state_topic":"wallpanel\\/mywallpanel\\/sensor\\/battery","unit_of_measurement":"%","value_template":"{{ value_json.value | float }}","device_class":"battery","unique_id":"wallpanel_mywallpanel_battery","device":{"identifiers":"[wallpanel_mywallpanel]","name":"My Wall Panel","manufacturer":"Archos","model":"Archos 101 Platinum 3G"},"availability_topic":"wallpanel\\/mywallpanel\\/connection"}'
2022-10-17 19:05:47.437 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'My Wall Panel Battery Level', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'unit_of_measurement': '%', 'value_template': '{{ value_json.value | float }}', 'device_class': 'battery', 'unique_id': 'wallpanel_mywallpanel_battery', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}
2022-10-17 19:05:47.438 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor mywallpanel battery, sending update
2022-10-17 19:05:47.439 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/binary_sensor/mywallpanel/usbPlugged/config: b'{"name":"My Wall Panel USB Plugged","state_topic":"wallpanel\\/mywallpanel\\/sensor\\/battery","payload_on":true,"payload_off":false,"value_template":"{{ value_json.usbPlugged }}","device_class":"power","unique_id":"wallpanel_mywallpanel_usbPlugged","device":{"identifiers":"[wallpanel_mywallpanel]","name":"My Wall Panel","manufacturer":"Archos","model":"Archos 101 Platinum 3G"},"availability_topic":"wallpanel\\/mywallpanel\\/connection"}'
2022-10-17 19:05:47.440 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/binary_sensor/mywallpanel/acPlugged/config: b'{"name":"My Wall Panel AC Plugged","state_topic":"wallpanel\\/mywallpanel\\/sensor\\/battery","payload_on":true,"payload_off":false,"value_template":"{{ value_json.acPlugged }}","device_class":"power","unique_id":"wallpanel_mywallpanel_acPlugged","device":{"identifiers":"[wallpanel_mywallpanel]","name":"My Wall Panel","manufacturer":"Archos","model":"Archos 101 Platinum 3G"},"availability_topic":"wallpanel\\/mywallpanel\\/connection"}'
2022-10-17 19:05:47.445 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/binary_sensor/mywallpanel/charging/config: b'{"name":"My Wall Panel Charging","state_topic":"wallpanel\\/mywallpanel\\/sensor\\/battery","payload_on":true,"payload_off":false,"value_template":"{{ value_json.charging }}","device_class":"battery_charging","unique_id":"wallpanel_mywallpanel_charging","device":{"identifiers":"[wallpanel_mywallpanel]","name":"My Wall Panel","manufacturer":"Archos","model":"Archos 101 Platinum 3G"},"availability_topic":"wallpanel\\/mywallpanel\\/connection"}'
2022-10-17 19:05:47.446 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/binary_sensor/mywallpanel/face/config: b''
2022-10-17 19:05:47.447 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/binary_sensor/mywallpanel/motion/config: b'{"name":"My Wall Panel Motion Detected","state_topic":"wallpanel\\/mywallpanel\\/sensor\\/motion","payload_on":true,"payload_off":false,"value_template":"{{ value_json.value }}","device_class":"motion","unique_id":"wallpanel_mywallpanel_motion","device":{"identifiers":"[wallpanel_mywallpanel]","name":"My Wall Panel","manufacturer":"Archos","model":"Archos 101 Platinum 3G"},"availability_topic":"wallpanel\\/mywallpanel\\/connection"}'
2022-10-17 19:05:47.448 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/tag/mywallpanel/qr/config: b''
2022-10-17 19:05:47.449 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('sensor', 'mywallpanel battery') '{'name': 'My Wall Panel Battery Level', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'unit_of_measurement': '%', 'value_template': '{{ value_json.value | float }}', 'device_class': 'battery', 'unique_id': 'wallpanel_mywallpanel_battery', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}'
2022-10-17 19:05:47.449 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: sensor.my_wall_panel_battery_level
2022-10-17 19:05:47.449 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'My Wall Panel USB Plugged', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'payload_on': True, 'payload_off': False, 'value_template': '{{ value_json.usbPlugged }}', 'device_class': 'power', 'unique_id': 'wallpanel_mywallpanel_usbPlugged', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}
2022-10-17 19:05:47.450 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: binary_sensor mywallpanel usbPlugged, sending update
2022-10-17 19:05:47.450 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'My Wall Panel AC Plugged', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'payload_on': True, 'payload_off': False, 'value_template': '{{ value_json.acPlugged }}', 'device_class': 'power', 'unique_id': 'wallpanel_mywallpanel_acPlugged', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}
2022-10-17 19:05:47.450 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: binary_sensor mywallpanel acPlugged, sending update
2022-10-17 19:05:47.450 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'My Wall Panel Charging', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'payload_on': True, 'payload_off': False, 'value_template': '{{ value_json.charging }}', 'device_class': 'battery_charging', 'unique_id': 'wallpanel_mywallpanel_charging', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}
2022-10-17 19:05:47.451 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: binary_sensor mywallpanel charging, sending update
2022-10-17 19:05:47.451 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {}
2022-10-17 19:05:47.451 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'My Wall Panel Motion Detected', 'state_topic': 'wallpanel/mywallpanel/sensor/motion', 'payload_on': True, 'payload_off': False, 'value_template': '{{ value_json.value }}', 'device_class': 'motion', 'unique_id': 'wallpanel_mywallpanel_motion', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}
2022-10-17 19:05:47.451 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: binary_sensor mywallpanel motion
2022-10-17 19:05:47.451 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {}
2022-10-17 19:05:47.461 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('sensor', 'mywallpanel battery'): deque([])
2022-10-17 19:05:47.462 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('binary_sensor', 'mywallpanel usbPlugged') '{'name': 'My Wall Panel USB Plugged', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'payload_on': True, 'payload_off': False, 'value_template': '{{ value_json.usbPlugged }}', 'device_class': 'power', 'unique_id': 'wallpanel_mywallpanel_usbPlugged', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}'
2022-10-17 19:05:47.462 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: binary_sensor.my_wall_panel_usb_plugged
2022-10-17 19:05:47.462 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on wallpanel/mywallpanel/state: b'{"currentUrl":"http:\\/\\/192.168.0.15:8123\\/la-maison\\/default_view","screenOn":false,"camera":true,"brightness":133}'
2022-10-17 19:05:47.464 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('binary_sensor', 'mywallpanel acPlugged') '{'name': 'My Wall Panel AC Plugged', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'payload_on': True, 'payload_off': False, 'value_template': '{{ value_json.acPlugged }}', 'device_class': 'power', 'unique_id': 'wallpanel_mywallpanel_acPlugged', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}'
2022-10-17 19:05:47.464 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: binary_sensor.my_wall_panel_ac_plugged
2022-10-17 19:05:47.464 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('binary_sensor', 'mywallpanel charging') '{'name': 'My Wall Panel Charging', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'payload_on': True, 'payload_off': False, 'value_template': '{{ value_json.charging }}', 'device_class': 'battery_charging', 'unique_id': 'wallpanel_mywallpanel_charging', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}'
2022-10-17 19:05:47.464 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: binary_sensor.my_wall_panel_charging
2022-10-17 19:05:47.466 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('binary_sensor', 'mywallpanel usbPlugged'): deque([])
2022-10-17 19:05:47.474 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('binary_sensor', 'mywallpanel acPlugged'): deque([])
2022-10-17 19:05:47.474 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('binary_sensor', 'mywallpanel charging'): deque([])
2022-10-17 19:05:47.476 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.mqtt entity: binary_sensor.my_wall_panel_motion_detected
2022-10-17 19:05:47.487 DEBUG (SyncWorker_3) [homeassistant.components.mqtt.client] Subscribing to wallpanel/mywallpanel/connection, mid: 224
2022-10-17 19:05:47.513 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on wallpanel/mywallpanel/connection (retained): b'online'
2022-10-17 19:05:47.526 DEBUG (SyncWorker_8) [homeassistant.components.mqtt.client] Subscribing to wallpanel/mywallpanel/sensor/motion, mid: 225
2022-10-17 19:05:47.541 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on wallpanel/mywallpanel/sensor/motion: b'{"value":true}'
2022-10-17 19:05:47.551 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('binary_sensor', 'mywallpanel motion'): deque([])
2022-10-17 19:06:07.316 INFO (MainThread) [homeassistant.components.script.desactive_la_camera] Désactive la caméra: Executing step call service
2022-10-17 19:06:07.326 DEBUG (MainThread) [homeassistant.components.mqtt.client] Transmitting message on wallpanel/mywallpanel/command: '{"camera":false}', mid: 226
2022-10-17 19:06:07.375 INFO (MainThread) [homeassistant.components.script.eteindre_tablette] Eteindre tablette: Running script sequence
2022-10-17 19:06:07.376 INFO (MainThread) [homeassistant.components.script.eteindre_tablette] Eteindre tablette: Executing step call service
2022-10-17 19:06:07.528 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/sensor/mywallpanel/battery/config: b'{"name":"My Wall Panel Battery Level","state_topic":"wallpanel\\/mywallpanel\\/sensor\\/battery","unit_of_measurement":"%","value_template":"{{ value_json.value | float }}","device_class":"battery","unique_id":"wallpanel_mywallpanel_battery","device":{"identifiers":"[wallpanel_mywallpanel]","name":"My Wall Panel","manufacturer":"Archos","model":"Archos 101 Platinum 3G"},"availability_topic":"wallpanel\\/mywallpanel\\/connection"}'
2022-10-17 19:06:07.538 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'My Wall Panel Battery Level', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'unit_of_measurement': '%', 'value_template': '{{ value_json.value | float }}', 'device_class': 'battery', 'unique_id': 'wallpanel_mywallpanel_battery', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}
2022-10-17 19:06:07.538 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor mywallpanel battery, sending update
2022-10-17 19:06:07.538 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/binary_sensor/mywallpanel/usbPlugged/config: b'{"name":"My Wall Panel USB Plugged","state_topic":"wallpanel\\/mywallpanel\\/sensor\\/battery","payload_on":true,"payload_off":false,"value_template":"{{ value_json.usbPlugged }}","device_class":"power","unique_id":"wallpanel_mywallpanel_usbPlugged","device":{"identifiers":"[wallpanel_mywallpanel]","name":"My Wall Panel","manufacturer":"Archos","model":"Archos 101 Platinum 3G"},"availability_topic":"wallpanel\\/mywallpanel\\/connection"}'
2022-10-17 19:06:07.539 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/binary_sensor/mywallpanel/acPlugged/config: b'{"name":"My Wall Panel AC Plugged","state_topic":"wallpanel\\/mywallpanel\\/sensor\\/battery","payload_on":true,"payload_off":false,"value_template":"{{ value_json.acPlugged }}","device_class":"power","unique_id":"wallpanel_mywallpanel_acPlugged","device":{"identifiers":"[wallpanel_mywallpanel]","name":"My Wall Panel","manufacturer":"Archos","model":"Archos 101 Platinum 3G"},"availability_topic":"wallpanel\\/mywallpanel\\/connection"}'
2022-10-17 19:06:07.539 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/binary_sensor/mywallpanel/charging/config: b'{"name":"My Wall Panel Charging","state_topic":"wallpanel\\/mywallpanel\\/sensor\\/battery","payload_on":true,"payload_off":false,"value_template":"{{ value_json.charging }}","device_class":"battery_charging","unique_id":"wallpanel_mywallpanel_charging","device":{"identifiers":"[wallpanel_mywallpanel]","name":"My Wall Panel","manufacturer":"Archos","model":"Archos 101 Platinum 3G"},"availability_topic":"wallpanel\\/mywallpanel\\/connection"}'
2022-10-17 19:06:07.540 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('sensor', 'mywallpanel battery') '{'name': 'My Wall Panel Battery Level', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'unit_of_measurement': '%', 'value_template': '{{ value_json.value | float }}', 'device_class': 'battery', 'unique_id': 'wallpanel_mywallpanel_battery', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}'
2022-10-17 19:06:07.540 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: sensor.my_wall_panel_battery_level
2022-10-17 19:06:07.541 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'My Wall Panel USB Plugged', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'payload_on': True, 'payload_off': False, 'value_template': '{{ value_json.usbPlugged }}', 'device_class': 'power', 'unique_id': 'wallpanel_mywallpanel_usbPlugged', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}
2022-10-17 19:06:07.541 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: binary_sensor mywallpanel usbPlugged, sending update
2022-10-17 19:06:07.541 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'My Wall Panel AC Plugged', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'payload_on': True, 'payload_off': False, 'value_template': '{{ value_json.acPlugged }}', 'device_class': 'power', 'unique_id': 'wallpanel_mywallpanel_acPlugged', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}
2022-10-17 19:06:07.542 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: binary_sensor mywallpanel acPlugged, sending update
2022-10-17 19:06:07.542 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {'name': 'My Wall Panel Charging', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'payload_on': True, 'payload_off': False, 'value_template': '{{ value_json.charging }}', 'device_class': 'battery_charging', 'unique_id': 'wallpanel_mywallpanel_charging', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}
2022-10-17 19:06:07.542 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: binary_sensor mywallpanel charging, sending update
2022-10-17 19:06:07.542 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/binary_sensor/mywallpanel/face/config: b''
2022-10-17 19:06:07.543 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/binary_sensor/mywallpanel/motion/config: b''
2022-10-17 19:06:07.544 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on homeassistant/tag/mywallpanel/qr/config: b''
2022-10-17 19:06:07.544 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on wallpanel/mywallpanel/state: b'{"currentUrl":"http:\\/\\/192.168.0.15:8123\\/la-maison\\/default_view","screenOn":true,"camera":false,"brightness":133}'
2022-10-17 19:06:07.550 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('sensor', 'mywallpanel battery'): deque([])
2022-10-17 19:06:07.551 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('binary_sensor', 'mywallpanel usbPlugged') '{'name': 'My Wall Panel USB Plugged', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'payload_on': True, 'payload_off': False, 'value_template': '{{ value_json.usbPlugged }}', 'device_class': 'power', 'unique_id': 'wallpanel_mywallpanel_usbPlugged', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}'
2022-10-17 19:06:07.551 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: binary_sensor.my_wall_panel_usb_plugged
2022-10-17 19:06:07.552 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('binary_sensor', 'mywallpanel acPlugged') '{'name': 'My Wall Panel AC Plugged', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'payload_on': True, 'payload_off': False, 'value_template': '{{ value_json.acPlugged }}', 'device_class': 'power', 'unique_id': 'wallpanel_mywallpanel_acPlugged', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}'
2022-10-17 19:06:07.552 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: binary_sensor.my_wall_panel_ac_plugged
2022-10-17 19:06:07.552 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('binary_sensor', 'mywallpanel charging') '{'name': 'My Wall Panel Charging', 'state_topic': 'wallpanel/mywallpanel/sensor/battery', 'payload_on': True, 'payload_off': False, 'value_template': '{{ value_json.charging }}', 'device_class': 'battery_charging', 'unique_id': 'wallpanel_mywallpanel_charging', 'device': {'identifiers': '[wallpanel_mywallpanel]', 'name': 'My Wall Panel', 'manufacturer': 'Archos', 'model': 'Archos 101 Platinum 3G'}, 'availability_topic': 'wallpanel/mywallpanel/connection', 'platform': 'mqtt'}'
2022-10-17 19:06:07.552 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: binary_sensor.my_wall_panel_charging
2022-10-17 19:06:07.552 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {}
2022-10-17 19:06:07.553 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {}
2022-10-17 19:06:07.553 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: binary_sensor mywallpanel motion, sending update
2022-10-17 19:06:07.553 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Process discovery payload {}
2022-10-17 19:06:07.571 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('binary_sensor', 'mywallpanel usbPlugged'): deque([])
2022-10-17 19:06:07.571 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('binary_sensor', 'mywallpanel acPlugged'): deque([])
2022-10-17 19:06:07.572 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('binary_sensor', 'mywallpanel charging'): deque([])
2022-10-17 19:06:07.572 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('binary_sensor', 'mywallpanel motion') '{}'
2022-10-17 19:06:07.572 INFO (MainThread) [homeassistant.components.mqtt.mixins] Removing component: binary_sensor.my_wall_panel_motion_detected
2022-10-17 19:06:07.581 DEBUG (MainThread) [homeassistant.components.mqtt.discovery] Pending discovery for ('binary_sensor', 'mywallpanel motion'): deque([])
2022-10-17 19:06:07.617 DEBUG (SyncWorker_10) [homeassistant.components.mqtt.client] Unsubscribing from wallpanel/mywallpanel/sensor/motion, mid: 227
[...]
2022-10-17 19:07:53.989 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on wallpanel/mywallpanel/connection: b'offline'
Superpiffer commented 1 year ago

I just login to report exactly the same issue, I have random disconnections since I installed v0.10.1, no problem with the latest beta (v0.10.0-beta1).

Clement-B commented 1 year ago

I rollback to version https://github.com/TheTimeWalker/wallpanel-android/releases/tag/v0.10.0.1 and I can confirm I do not reproduce bug that occured in the morning after boot.

From my memory, this version suffered of the same issue that, after a while, sending a mqtt message to switch camera can sometimes "disconnect" wall panel. But it occured like one time in a few day compare to the last version where connection is lost 2 or 3 times a day.

Clement-B commented 1 year ago

Hey, @TheTimeWalker can you try to te reproduce the issue ? Or maybe @FredericMa you can rollback your modifications about MQTT reconnection in #29 ? (But keep battery sensor reconnection fix)

FredericMa commented 1 year ago

I've created PR #47 that should handle all MQTT disconnects. Before, only one particular type of disconnects would have been handled. My expectation is that this solves this issue but it doesn't clarify why the disconnects happen while using the camera.

TheTimeWalker commented 1 year ago

@Clement-B I was able to reproduce it myself before but haven't come around for a fix.

Thanks to @FredericMa there's a possible fix. I'm keeping this issue open just to be sure. Please try out v0.10.4 as soon as it's available in the Releases section and report back if that fixes the problem

Clement-B commented 1 year ago

Thanks a lot @FredericMa for giving a try to fix this issue and @TheTimeWalker for creating a new version!

I will install the new version right now and will give you my feedbacks after a few days. Hope this fix the issue 👍

Clement-B commented 1 year ago

So, it has been 2 days since upgrade.

As a reminder, here is my routines with wall Panel:

I monitor MQTT connection status with a custom binary sensor in HA :

binary_sensor:
  - state_topic: "wallpanel/mywallpanel/connection"
    name: "WallPanel - Connection (custom)"
    payload_on: "online"
    payload_off: "offline"

What I observe is:

To illustrate what I get, here is some history of the sensor in HA (I checked logs and there is no delay between logs and history):

image

You can see all the reconnections phases between 12 pm/2:30 pm and 7 am/9 am.

If we focus on a morning, you can see the duration needed to reconnect (seems quite long) and connection becoming stable again after I trigger manually camera when connection is fine:

image

So the conclusion of my tests are:

As a reminder, here was the state of my connection with version v0.10.0.1:

image

Network connection is not issue I think as my wifi router is at a few meters of the tablet.

So questions are :

TheTimeWalker commented 1 year ago

What I see from my side are 32 events with these two exceptions from your device: onMQTTException: Error establishing MQTT connection to MQTT broker with address [ip] and onMQTTException: Disconnected from: [ip], exception: io.netty.channel.ConnectTimeoutException: connection timed out: [ip]

Is your Wi-Fi more polluted right now? Is the graph from the older version a bit older, or is that what happens right now as well? Also, have you checked that your MQTT broker isn't closing all the time accidentally now? Lastly, have you checked that the app isn't getting battery optimized?

FredericMa commented 1 year ago

I'm actually seeing the same behavior (screenshot from MQTT broker): image This only happens when the screen is off. I don't use face recognition or presence detection but turn off the screen if the home alarm system is turned on.

Specs: Lenovo TB-X304F Android 10 (Unofficial LineageOS) Battery optimization disabled

I searched a bit and found this for the paho mqtt client: https://github.com/hannesa2/paho.mqtt.android/pull/7 @TheTimeWalker: I don't know if this could fix the issue?

@Clement-B: it is strange you face this issue on Android 7 since this particular issue seem related to Android version >= 8. Can you verify the tablet runs on Android 7?

TheTimeWalker commented 1 year ago

We're not using Paho. We're using HiveMQTT since v0.10 beta0

FredericMa commented 1 year ago

We're not using Paho. We're using HiveMQTT since v0.10 beta0

True but that PR describes a way to solve exactly the same issue we see here, by creating a foreground service notification.

I reviewed my recent changes but I can't see any change that could induce this behavior. I have the feeling that the code below, that was previously in both the MQTT 3 and 5 service, covered this issue up by accident: https://github.com/TheTimeWalker/wallpanel-android/blob/169dae5849117207148b8d745732bfbbb1739dc0/WallPanelApp/src/main/java/xyz/wallpanel/app/network/MQTT3Service.kt#L103-L123

@TheTimeWalker if you feel more comfortable with reverting my changes feel free to do so.

Clement-B commented 1 year ago

Is your Wi-Fi more polluted right now? Is the graph from the older version a bit older, or is that what happens right now as well? Also, have you checked that your MQTT broker isn't closing all the time accidentally now? Lastly, have you checked that the app isn't getting battery optimized?

image

I use Mosquitto broker add-on from HA. I have mqtt debug enabled in HA but didnt see anything unusual in logs. I dont have test such debug tool like mqtt explorer for a deeper analysis. I just found out that there is a debug option in add-on configuration, I enabled it et will see tomorrow if I got something.

@Clement-B: it is strange you face this issue on Android 7 since this particular issue seem related to Android version >= 8. Can you verify the tablet runs on Android 7?

I confirm my tablet run on Android 7.

One thing to note is my tablet is fixed on a wall near a corridor so we used to pass a lot near during the day where camera is triggered each time. So I was thinking that when tablet enter in a state of connection unstability, it would be cause by a long idle time without triggering motion and screen on.

After checking this hypothesis, I found that instability can come just after a few trigger in v0.10.14: image

But with the previous version, I found out that connection may become unstable just exactly after 1 hour without motion detection (and screen on) detected, see below:

image

Clement-B commented 1 year ago

Here is some logs from mqtt broker if it can help, we can see a strange error where username, cloent id is not found, dont know if it's related to wall panel.

time="2022-11-05T10:54:29+01:00" level=debug msg="to auth record: [97 99 108 45 109 113 116 116 45 104 111 109 101 97 115 115 105 115 116 97 110 116 47 116 97 103 47 109 121 119 97 108 108 112 97 110 101 108 47 113 114 47 99 111 110 102 105 103 45 109 121 119 97 108 108 112 97 110 101 108 45 50 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n"
time="2022-11-05T10:54:29+01:00" level=debug msg="found in cache: mqtt"
time="2022-11-05T10:54:29+01:00" level=debug msg="checking acl cache for homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="to auth record: [97 99 108 45 104 111 109 101 97 115 115 105 115 116 97 110 116 45 104 111 109 101 97 115 115 105 115 116 97 110 116 47 116 97 103 47 109 121 119 97 108 108 112 97 110 101 108 47 113 114 47 99 111 110 102 105 103 45 55 65 71 108 55 70 119 97 79 54 80 101 81 49 68 76 120 66 85 54 85 69 45 49 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n"
time="2022-11-05T10:54:29+01:00" level=debug msg="found in cache: homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="checking acl cache for mqtt"
2022-11-05 10:54:29: Sending PUBLISH to 7AGl7FwaO6PeQ1DLxBU6UE (d0, q0, r0, m0, 'homeassistant/binary_sensor/mywallpanel/acPlugged/config', ... (433 bytes))
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
2022-11-05 10:54:29: Received PUBLISH from mywallpanel (d0, q0, r1, m0, 'homeassistant/binary_sensor/mywallpanel/charging/config', ... (440 bytes))
2022-11-05 10:54:29: Sending PUBLISH to 7AGl7FwaO6PeQ1DLxBU6UE (d0, q0, r0, m0, 'homeassistant/binary_sensor/mywallpanel/charging/config', ... (440 bytes))
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
2022-11-05 10:54:29: Received PUBLISH from mywallpanel (d0, q0, r0, m0, 'homeassistant/binary_sensor/mywallpanel/face/config', ... (0 bytes))
2022-11-05 10:54:29: Sending PUBLISH to 7AGl7FwaO6PeQ1DLxBU6UE (d0, q0, r0, m0, 'homeassistant/binary_sensor/mywallpanel/face/config', ... (0 bytes))
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
2022-11-05 10:54:29: Received PUBLISH from mywallpanel (d0, q0, r1, m0, 'homeassistant/binary_sensor/mywallpanel/motion/config', ... (431 bytes))
2022-11-05 10:54:29: Sending PUBLISH to 7AGl7FwaO6PeQ1DLxBU6UE (d0, q0, r0, m0, 'homeassistant/binary_sensor/mywallpanel/motion/config', ... (431 bytes))
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
2022-11-05 10:54:29: Received PUBLISH from mywallpanel (d0, q0, r0, m0, 'homeassistant/tag/mywallpanel/qr/config', ... (0 bytes))
2022-11-05 10:54:29: Sending PUBLISH to 7AGl7FwaO6PeQ1DLxBU6UE (d0, q0, r0, m0, 'homeassistant/tag/mywallpanel/qr/config', ... (0 bytes))
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
2022-11-05 10:54:29: Received PUBLISH from mywallpanel (d0, q0, r0, m0, 'wallpanel/mywallpanel/state', ... (116 bytes))
2022-11-05 10:54:29: Sending PUBLISH to 7AGl7FwaO6PeQ1DLxBU6UE (d0, q0, r0, m0, 'wallpanel/mywallpanel/state', ... (116 bytes))
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
time="2022-11-05T10:54:29+01:00" level=debug msg="to auth record: [97 99 108 45 109 113 116 116 45 119 97 108 108 112 97 110 101 108 47 109 121 119 97 108 108 112 97 110 101 108 47 115 116 97 116 101 45 109 121 119 97 108 108 112 97 110 101 108 45 50 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n"
time="2022-11-05T10:54:29+01:00" level=debug msg="found in cache: mqtt"
time="2022-11-05T10:54:29+01:00" level=debug msg="checking acl cache for homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="to auth record: [97 99 108 45 104 111 109 101 97 115 115 105 115 116 97 110 116 45 119 97 108 108 112 97 110 101 108 47 109 121 119 97 108 108 112 97 110 101 108 47 115 116 97 116 101 45 55 65 71 108 55 70 119 97 79 54 80 101 81 49 68 76 120 66 85 54 85 69 45 49 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n"
time="2022-11-05T10:54:29+01:00" level=debug msg="found in cache: homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="checking acl cache for homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="to auth record: [97 99 108 45 104 111 109 101 97 115 115 105 115 116 97 110 116 45 119 97 108 108 112 97 110 101 108 47 109 121 119 97 108 108 112 97 110 101 108 47 99 111 110 110 101 99 116 105 111 110 45 55 65 71 108 55 70 119 97 79 54 80 101 81 49 68 76 120 66 85 54 85 69 45 52 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n"
time="2022-11-05T10:54:29+01:00" level=debug msg="Superuser check with backend Files"
time="2022-11-05T10:54:29+01:00" level=debug msg="Superuser check with backend HTTP"
time="2022-11-05T10:54:29+01:00" level=debug msg="http request approved for homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="superuser homeassistant acl authenticated with backend HTTP"
time="2022-11-05T10:54:29+01:00" level=debug msg="setting acl cache (granted = true) for homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="to auth record: [97 99 108 45 104 111 109 101 97 115 115 105 115 116 97 110 116 45 119 97 108 108 112 97 110 101 108 47 109 121 119 97 108 108 112 97 110 101 108 47 99 111 110 110 101 99 116 105 111 110 45 55 65 71 108 55 70 119 97 79 54 80 101 81 49 68 76 120 66 85 54 85 69 45 52 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n"
time="2022-11-05T10:54:29+01:00" level=debug msg="Acl is true for user homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="checking acl cache for homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="to auth record: [97 99 108 45 104 111 109 101 97 115 115 105 115 116 97 110 116 45 119 97 108 108 112 97 110 101 108 47 109 121 119 97 108 108 112 97 110 101 108 47 99 111 110 110 101 99 116 105 111 110 45 55 65 71 108 55 70 119 97 79 54 80 101 81 49 68 76 120 66 85 54 85 69 45 49 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n"
time="2022-11-05T10:54:29+01:00" level=debug msg="found in cache: homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="checking acl cache for homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="to auth record: [97 99 108 45 104 111 109 101 97 115 115 105 115 116 97 110 116 45 119 97 108 108 112 97 110 101 108 47 109 121 119 97 108 108 112 97 110 101 108 47 115 101 110 115 111 114 47 109 111 116 105 111 110 45 55 65 71 108 55 70 119 97 79 54 80 101 81 49 68 76 120 66 85 54 85 69 45 52 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n"
time="2022-11-05T10:54:29+01:00" level=debug msg="Superuser check with backend Files"
time="2022-11-05T10:54:29+01:00" level=debug msg="Superuser check with backend HTTP"
time="2022-11-05T10:54:29+01:00" level=debug msg="http request approved for homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="superuser homeassistant acl authenticated with backend HTTP"
time="2022-11-05T10:54:29+01:00" level=debug msg="setting acl cache (granted = true) for homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="to auth record: [97 99 108 45 104 111 109 101 97 115 115 105 115 116 97 110 116 45 119 97 108 108 112 97 110 101 108 47 109 121 119 97 108 108 112 97 110 101 108 47 115 101 110 115 111 114 47 109 111 116 105 111 110 45 55 65 71 108 55 70 119 97 79 54 80 101 81 49 68 76 120 66 85 54 85 69 45 52 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n"
time="2022-11-05T10:54:29+01:00" level=debug msg="Acl is true for user homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="checking acl cache for mqtt"
time="2022-11-05T10:54:29+01:00" level=debug msg="to auth record: [97 99 108 45 109 113 116 116 45 119 97 108 108 112 97 110 101 108 47 109 121 119 97 108 108 112 97 110 101 108 47 115 101 110 115 111 114 47 109 111 116 105 111 110 45 109 121 119 97 108 108 112 97 110 101 108 45 50 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n"
time="2022-11-05T10:54:29+01:00" level=debug msg="Superuser check with backend Files"
time="2022-11-05T10:54:29+01:00" level=debug msg="Superuser check with backend HTTP"
time="2022-11-05T10:54:29+01:00" level=debug msg="http request approved for mqtt"
time="2022-11-05T10:54:29+01:00" level=debug msg="superuser mqtt acl authenticated with backend HTTP"
time="2022-11-05T10:54:29+01:00" level=debug msg="setting acl cache (granted = true) for mqtt"
time="2022-11-05T10:54:29+01:00" level=debug msg="to auth record: [97 99 108 45 109 113 116 116 45 119 97 108 108 112 97 110 101 108 47 109 121 119 97 108 108 112 97 110 101 108 47 115 101 110 115 111 114 47 109 111 116 105 111 110 45 109 121 119 97 108 108 112 97 110 101 108 45 50 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n"
time="2022-11-05T10:54:29+01:00" level=debug msg="Acl is true for user mqtt"
time="2022-11-05T10:54:29+01:00" level=debug msg="checking acl cache for homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="to auth record: [97 99 108 45 104 111 109 101 97 115 115 105 115 116 97 110 116 45 119 97 108 108 112 97 110 101 108 47 109 121 119 97 108 108 112 97 110 101 108 47 115 101 110 115 111 114 47 109 111 116 105 111 110 45 55 65 71 108 55 70 119 97 79 54 80 101 81 49 68 76 120 66 85 54 85 69 45 49 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n"
time="2022-11-05T10:54:29+01:00" level=debug msg="Superuser check with backend Files"
time="2022-11-05T10:54:29+01:00" level=debug msg="Superuser check with backend HTTP"
2022-11-05 10:54:29: Received SUBSCRIBE from 7AGl7FwaO6PeQ1DLxBU6UE
2022-11-05 10:54:29:    wallpanel/mywallpanel/connection (QoS 0)
2022-11-05 10:54:29: 7AGl7FwaO6PeQ1DLxBU6UE 0 wallpanel/mywallpanel/connection
2022-11-05 10:54:29: Sending SUBACK to 7AGl7FwaO6PeQ1DLxBU6UE
2022-11-05 10:54:29: Sending PUBLISH to 7AGl7FwaO6PeQ1DLxBU6UE (d0, q0, r1, m0, 'wallpanel/mywallpanel/connection', ... (6 bytes))
2022-11-05 10:54:29: Received SUBSCRIBE from 7AGl7FwaO6PeQ1DLxBU6UE
2022-11-05 10:54:29:    wallpanel/mywallpanel/sensor/motion (QoS 0)
2022-11-05 10:54:29: 7AGl7FwaO6PeQ1DLxBU6UE 0 wallpanel/mywallpanel/sensor/motion
2022-11-05 10:54:29: Sending SUBACK to 7AGl7FwaO6PeQ1DLxBU6UE
2022-11-05 10:54:29: Received PUBLISH from mywallpanel (d0, q0, r0, m0, 'wallpanel/mywallpanel/sensor/motion', ... (14 bytes))
2022-11-05 10:54:29: Sending PUBLISH to 7AGl7FwaO6PeQ1DLxBU6UE (d0, q0, r0, m0, 'wallpanel/mywallpanel/sensor/motion', ... (14 bytes))
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
error: received null username, clientid or topic, or access is equal or less than 0 for acl check
time="2022-11-05T10:54:29+01:00" level=debug msg="http request approved for homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="superuser homeassistant acl authenticated with backend HTTP"
time="2022-11-05T10:54:29+01:00" level=debug msg="setting acl cache (granted = true) for homeassistant"
time="2022-11-05T10:54:29+01:00" level=debug msg="to auth record: [97 99 108 45 104 111 109 101 97 115 115 105 115 116 97 110 116 45 119 97 108 108 112 97 110 101 108 47 109 121 119 97 108 108 112 97 110 101 108 47 115 101 110 115 111 114 47 109 111 116 105 111 110 45 55 65 71 108 55 70 119 97 79 54 80 101 81 49 68 76 120 66 85 54 85 69 45 49 218 57 163 238 94 107 75 13 50 85 191 239 149 96 24 144 175 216 7 9]\n"
time="2022-11-05T10:54:29+01:00" level=debug msg="Acl is true for user homeassistant"
TheTimeWalker commented 1 year ago

For the error: Are you trying to connect to your broker as anonymous / without username and password? It sounds like this issue: https://github.com/home-assistant/addons/issues/2474

FredericMa commented 1 year ago

@Clement-B Can you please also take the time to create a debug log of the previous working version (v0.10.0-beta1)? I also installed it again and I see the same kind of disconnects when the screen is off, except that connection is reestablished instantly:

2022-11-06T12:48:28+00:00 [PUBLISH] wallpanel@192.168.50.114:33552 msg: publish_to, topic: wallpanel/state, payload: {"currentUrl":"https:\/\/wallpanel.xyz","screenOn":false,"camera":false,"brightness":150}
2022-11-06T12:48:28+00:00 [PUBLISH] wallpanel@192.168.50.114:33552 msg: publish_to, topic: wallpanel/sensor/battery, payload: {"value":98,"unit":"%","charging":false,"acPlugged":false,"usbPlugged":false}
2022-11-06T12:48:28+00:00 [PUBLISH] wallpanel@192.168.50.114:33552 msg: publish_to, topic: wallpanel/sensor/battery, payload: {"value":98,"unit":"%","charging":false,"acPlugged":false,"usbPlugged":false}
2022-11-06T12:50:28+00:00 [PUBLISH] wallpanel@192.168.50.114:33552 msg: publish_to, topic: wallpanel/connection, payload: offline
2022-11-06T12:50:28+00:00 [PUBLISH] wallpanel@192.168.50.114:33556 msg: publish_to, topic: wallpanel/connection, payload: online
2022-11-06T12:50:28+00:00 [PUBLISH] wallpanel@192.168.50.114:33556 msg: publish_to, topic: wallpanel/sensor/battery, payload: {"value":98,"unit":"%","charging":false,"acPlugged":false,"usbPlugged":false}
2022-11-06T12:52:43+00:00 [PUBLISH] wallpanel@192.168.50.114:33556 msg: publish_to, topic: wallpanel/connection, payload: offline
2022-11-06T12:52:43+00:00 [PUBLISH] wallpanel@192.168.50.114:33557 msg: publish_to, topic: wallpanel/connection, payload: online
2022-11-06T12:52:43+00:00 [PUBLISH] wallpanel@192.168.50.114:33557 msg: publish_to, topic: wallpanel/sensor/battery, payload: {"value":98,"unit":"%","charging":false,"acPlugged":false,"usbPlugged":false}
2022-11-06T12:54:58+00:00 [PUBLISH] wallpanel@192.168.50.114:33557 msg: publish_to, topic: wallpanel/connection, payload: offline
2022-11-06T12:54:59+00:00 [PUBLISH] wallpanel@192.168.50.114:33558 msg: publish_to, topic: wallpanel/connection, payload: online
2022-11-06T12:54:59+00:00 [PUBLISH] wallpanel@192.168.50.114:33558 msg: publish_to, topic: wallpanel/sensor/battery, payload: {"value":98,"unit":"%","charging":false,"acPlugged":false,"usbPlugged":false}

You can also see that the publishing of the state only happens every 2 minutes instead of every minute as defined in the settings... So it looks like the problem already existed before and the reconnect in the publish of a message has hidden it. That is the piece of code I removed. We can add it again to hide the problem again.

FredericMa commented 1 year ago

I created PR #48 for this. I noticed that the CPU was turned off when the screen was off. It should be solved by that PR but it also required some additional changes to handle the screen state.

With these changes, no disconnects appear and the sensors are being updated every minute (default update interval) as it should. These changes might impact battery life since the CPU won't be turned off anymore so this is something to be monitored.

Clement-B commented 1 year ago

For the error: Are you trying to connect to your broker as anonymous / without username and password? It sounds like this issue: https://github.com/home-assistant/addons/issues/2474

I'm not connecting to broker as anonymous but you linked to the right issue. Yesterday, I uninstalled MQTT broker and installed it again.

I no longer see username error in mqtt broker logs. It was caused by I think old retained messages like explained in the issue you linked.

Also, this morning, I dont get the unstability (multiple disconnections each 2min) that I usually have. But it could be a coincidence as if camera is turned on when connection is on, wall panel become stable again. And tonight, I reproduced it again after I think multiples camera requests throught mqtt.

Here is the log of MQTT for the last disconnection tonight.

2022-11-06 23:26:58: Received PUBLISH from mywallpanel (d0, q0, r1, m0, 'homeassistant/binary_sensor/mywallpanel/charging/config', ... (440 bytes))
2022-11-06 23:26:58: Sending PUBLISH to 32ZKR95Nfsc4eaJTC89KyS (d0, q0, r0, m0, 'homeassistant/binary_sensor/mywallpanel/charging/config', ... (440 bytes))
2022-11-06 23:26:58: Received PUBLISH from mywallpanel (d0, q0, r0, m0, 'homeassistant/binary_sensor/mywallpanel/face/config', ... (0 bytes))
2022-11-06 23:26:58: Sending PUBLISH to 32ZKR95Nfsc4eaJTC89KyS (d0, q0, r0, m0, 'homeassistant/binary_sensor/mywallpanel/face/config', ... (0 bytes))
2022-11-06 23:26:58: Received PUBLISH from mywallpanel (d0, q0, r0, m0, 'homeassistant/binary_sensor/mywallpanel/motion/config', ... (0 bytes))
2022-11-06 23:26:58: Sending PUBLISH to 32ZKR95Nfsc4eaJTC89KyS (d0, q0, r0, m0, 'homeassistant/binary_sensor/mywallpanel/motion/config', ... (0 bytes))
2022-11-06 23:26:58: Received PUBLISH from mywallpanel (d0, q0, r0, m0, 'homeassistant/tag/mywallpanel/qr/config', ... (0 bytes))
2022-11-06 23:26:58: Sending PUBLISH to 32ZKR95Nfsc4eaJTC89KyS (d0, q0, r0, m0, 'homeassistant/tag/mywallpanel/qr/config', ... (0 bytes))
2022-11-06 23:27:40: New connection from 172.30.32.2:53032 on port 1883.
2022-11-06 23:27:40: Client <unknown> closed its connection.
2022-11-06 23:27:44: Received PINGREQ from 32ZKR95Nfsc4eaJTC89KyS
2022-11-06 23:27:44: Sending PINGRESP to 32ZKR95Nfsc4eaJTC89KyS
2022-11-06 23:28:25: Received PUBLISH from 32ZKR95Nfsc4eaJTC89KyS (d0, q0, r1, m0, 'wallpanel/mywallpanel/command', ... (16 bytes))

On thing I didnt mention is I use a mqtt switch configured in HA to enable / disable camera (previously I was using a simple script in HA), here is the configuration with the retain option :

mqtt:
  switch:
    - command_topic: "wallpanel/mywallpanel/command"
      name: "WallPanel - Camera switch"
      payload_on: '{"camera":true}'
      payload_off: '{"camera":false}'
      state_topic: "wallpanel/mywallpanel/state"
      state_on: True
      state_off: False
      value_template: "{{ value_json.camera }}"
      retain: true
      availability:
        - topic: "wallpanel/mywallpanel/connection"

@Clement-B Can you please also take the time to create a debug log of the previous working version (v0.10.0-beta1)?

I can try this if it can help.

I created PR https://github.com/TheTimeWalker/wallpanel-android/pull/48 for this.

Nice finding here! Unfortunately, I do not know much about android dev otherwise I will have tried to do a code review. But for sure, I would test your fix if it's released 👍 Thanks a lot for your help!

Clement-B commented 1 year ago

Just to make an update there.

Things has been better since I removed automation for switching off camera 5min before automatic shutdown of tablet and automatic re-enabling camera one hour after automatic boot.

Here is connection status since more than a week : image

As you can see, there not much of multiple disconnections phases since 9 november, where I disabled automatic switching on / off camera but it continue to occurs sometimes.

I dont know why it's better, maybe it could be reproduced by rebooting a device with wall panel where camera is disabled and try to send an MQTT request to enable camera BEFORE any other interaction after boot ?

imaginator commented 1 year ago

Just adding a datapoint here since I was struggling with tablets loosing connections and went down a rabbit hole of trying Fully Kiosk Browser as well as the HA companion app.

Running a wakelock manager with the following settings enabled seems to keep the tablet's connected (ie preventing Android from throttling wifi / cpu).

I ended up using the following settings in https://github.com/d4rken-org/wakelock-revamp and seem to be able to maintain a solid connection (approx 2% packet loss over and hour of pings).

It would be nice if these wakelock options were incorporated into the app.

<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <boolean name="core.autostart.call" value="true" />
    <set name="core.locks.saved">
        <string>PARTIAL_WAKE_LOCK</string>
        <string>WIFI_MODE_SCAN_ONLY</string>
        <string>SCREEN_DIM_WAKE_LOCK</string>
        <string>WIFI_MODE_FULL_HIGH_PERF</string>
        <string>WIFI_MODE_FULL</string>
    </set>
    <boolean name="core.paused" value="true" />
    <boolean name="core.autostart.boot" value="true" />
    <boolean name="core.onboarding.show" value="false" />
</map>