feat: allow starting z2m without mqtt (Frontend+WebSocket / WebSocket only mode)#32314
feat: allow starting z2m without mqtt (Frontend+WebSocket / WebSocket only mode)#32314marmurek wants to merge 4 commits into
Conversation
|
This will not result in the intended behavior. PS: bumping settings version & adding settings migrations is only for breaking changes that require migrating to keep on working. |
|
I was able to start z2m without MQTT connection, successfully pair and control the devices using only Frontend + Websocket, without any errors, so it seems it wont fail while trying to pub/sub. Fair enough, that it may require deeper look e.g. regarding the HA and not bumping settings version if not needed. |
|
You'd have to be hitting code paths like this: Lines 225 to 231 in fd8bafc But something like this should not be relying on that kind of code in any case (even if it somewhat works). If no mqtt, mqtt should not be instanciated at all, otherwise the potential for weird bugs goes off the chart. |
|
Actually, its like that: Not creating instances is actually a much, much nicer approach, but - it looks like WebSocket shares some of the logic with the current parts around mqtt and wow, it in fact seems to be a lot of work. |
I know this might seem strange, given that the project name is Zigbee2MQTT, but sometimes MQTT communication and an additional MQTT broker process running alongside aren't really necessary - we have an excellent replacement in WebSocket.
Based on #16590, #19524 and, for example, how ioBroker substitutes a dummy MQTT server just to start the application correctly and use WebSocket as the main channel later on, I decided to implement an additional toggle for the MQTT settings.
This is my first PR, so I'm not entirely sure if I did everything correctly. If anything is wrong, please let me know.