openHASP: Arc sending too many MQTT messages
Create a page like this:

{"page":2,"comment":"---------- Page 2 ----------"}
{"obj":"btn","id":1,"x":0,"y":0,"w":240,"h":30,"text":"HÁLÓSZOBA","value_font":22,"bg_color":"#2C3E50","text_color":"#FFFFFF","radius":0,"border_side":0}
{"obj":"btn","id":3,"x":195,"y":0,"h":30,"w":40,"text":"22.1°C","val":"0","bg_color":"#2C3E50","text_color":"#FFFFFF","radius":0,"border_side":0}
{"obj":"label","id":4,"x":10,"y":40,"w":220,"h":30,"text":"Kívánt hőmérséklet:","align":1,"padh":50}
{"obj":"arc","id":5,"x":20,"y":75,"w":200,"h":200,"min":150,"max":350,"border_side":0,"type":0,"rotation":0,"start_angle":135,"end_angle":45,"start_angle1":135,"end_angle1":45,"value_font":44,"value_color":"#2C3E50","adjustable":"true","groupid":7}
{"obj":"switch","id":6,"x":89,"y":235,"w":66,"h":30,"toggle":"TRUE"}
(don’t forget to adjust font sizes to values supported by your build)
Create an automation in Home Assistant to update values:
- alias: lanbon-arc-update
initial_state: 'on'
trigger:
- platform: mqtt
topic: 'hasp/plate/state/p2b5'
condition:
- condition: template
value_template: "{{ trigger.payload_json.event == 'changed' }}"
action:
- service: mqtt.publish
data:
topic: hasp/plate/command/p2b5.value_str
payload: "{{ trigger.payload_json.val / 10 | float }}"
Try to move the handle of the arc, relatively fast, to about 50%. You’ll notice how slow the value updates in the middle. The reason is that MQTT is flooded with a lot of messages, and Home Assistant tries to process all of them:
2021-03-09 22:34:54 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:23 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:25 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:35:26 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:58 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:39:59 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:40:02 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:40:02 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:40:02 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:40:02 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:40:02 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
2021-03-09 22:40:02 WARNING (MainThread) [homeassistant.components.automation.lanbon_arc_update] lanbon-arc-update: Already running
Of course if we use a smaller interval for arc, like "min":15,"max":35 messages will be much fewer, but that’s not acceptable because of https://github.com/fvanroie/hasp-lvgl/issues/81.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 26
Commits related to this issue
- Address issue #88 — committed to HASwitchPlate/openHASP by fvanroie 3 years ago
- Merge pull request #111 from fvanroie/feature-reduce-slider-events Address issue #88 — committed to HASwitchPlate/openHASP by fvanroie 3 years ago
Seems stable enough 👍
I’ve had so many issues last couple of days testing more that 10 builds across 4 different plates with 3 different display hw setups. Main worry was that all plates at some point froze and just stopped sending mqtt messages completely. Really have no idea what happened ? Perhaps a small memory leak somewhere, triggered by the many, many hundreds in- /out bound mqtt messages in only minutes when testing arc/slider ? But now I’ll stick with this latest build for a couple of days to test reliability in my environment. My general mqtt broker load is also now below 160 (recieved) messages/minut. Under previous testing it hit some 500+ recieved messages/minut - easily… 🤯
The mqtt throttling seems to work perfectly. And on top of this the ‘event up’ message for sliders/arcs - what’s not to like 😉 I’ll now be able to rewrite and simplify some of my automations with this.
Thanks !!
We’ll have to see what @fvanroie has to say on the subject. He knows his code backwards and forwards - even while asleep 😉
I would call this an unintended design flaw, not showing up until now.
Best solution was if hasp-lvgl code could handle this internally. Update objects
value_strif already predefined in jsonl. This check is needed, as not all sliders, arcs etc. neccesarily has anvalue_strto be displayed.Second best solution was to deal with the mqtt delays for inbound messages to active plate page. I guess that code temporarily disables handling of inbound mqtt messages, in order to be able to send outbound messages without any delays. Or code isn’t fully async or can’t run async for any number of reasons - MQTT message buffer limit or other ressource issues. I really don’t know - just guessing 😁
FYI: I use
mode: restartfor my volume slider automations. IMO this gives the best result with sliders, arcs etc. that issues sh*tloads of mqtt messages. I sync my sliders across all active plates as well (four so far) and with HA and Sonos component itself. So the mqtt messages explodes when i pull a volume slider 😆parallelmode most likely won’t work well, as it will soon run out of threads if you yank the arc vigorously.queuedmode will produce massive ‘elastic’ sensor delays in HA several seconds after if you ‘play’ with arc.singlemode will (as you know) miss several mqtt messages which ends up in HA’s log as warnings instead