Open Clement-B opened 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).
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.
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)
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.
@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
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 👍
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):
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:
So the conclusion of my tests are:
As a reminder, here was the state of my connection with version v0.10.0.1:
Network connection is not issue I think as my wifi router is at a few meters of the tablet.
So questions are :
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?
I'm actually seeing the same behavior (screenshot from MQTT broker):
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?
We're not using Paho. We're using HiveMQTT since v0.10 beta0
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.
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?
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:
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:
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"
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
@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.
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.
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!
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 :
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 ?
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>
Description
After some time or specifc actions, I lost connection to wall panel , here is my observations:
To restore Wall Panel, I can:
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.