constructor(options) {
        this.config = options.config;
        this.robot = options.robot;
        this.valetudoEventStore = options.valetudoEventStore;
        this.valetudoHelper = options.valetudoHelper;

        this.mutexes = {
            reconfigure: Semaphore(1),
            configUpdate: Semaphore(1)
        };

        this.messageDeduplicationCache = new KeyValueDeduplicationCache({});

        this.client = null;
        this.refreshInterval = 30 * 1000;
        this.refreshIntervalID = null;

        /** @type {Array<import("./handles/NodeMqttHandle")>} */
        this.nodes = [];

        this.subscriptions = {};

        this.state = HomieCommonAttributes.STATE.DISCONNECTED;
        this.stats = {
            messages: {
                count: {
                    received: 0,
                    sent: 0
                },
                bytes: {
                    received: 0,
                    sent: 0
                }

            },
            connection: {
                connects: 0,
                disconnects: 0,
                reconnects: 0,
                errors: 0
            }
        };

        this.configDefaults = {
            identity: {
                identifier: Tools.GET_HUMAN_READABLE_SYSTEM_ID()
            },
            customizations: {
                topicPrefix: "valetudo"
            }
        };

        this.mqttClientCloseEventHandler = async () => {
            //intentionally empty default
        };

        this.loadConfig();

        this.robot.onMapUpdated(() => {
            this.onMapUpdated();
        });

        this.valetudoEventStore.onEventsUpdated(() => {
            this.onValetudoEventsUpdated();
        });

        /** @type {import("./handles/RobotMqttHandle")|null} */
        this.robotHandle = null;
        /** @type {HassController} */
        this.hassController = null;
        this.hassAnchorProvider = new HassAnchorProvider(); //Always required

        if (this.currentConfig.enabled) {
            if (this.currentConfig.interfaces.homeassistant.enabled) {
                this.hassController = new HassController({
                    controller: this,
                    robot: this.robot,
                    config: this.config,
                    friendlyName: this.valetudoHelper.getFriendlyName()
                });
            }

            this.robotHandle = new RobotMqttHandle({
                robot: this.robot,
                valetudoEventStore: this.valetudoEventStore,
                controller: this,
                baseTopic: this.currentConfig.customizations.topicPrefix,
                topicName: this.currentConfig.identity.identifier,
                friendlyName: this.valetudoHelper.getFriendlyName(),
                optionalExposedCapabilities: this.currentConfig.optionalExposedCapabilities
            });

            this.connect().catch(err => {
                Logger.error("Error during MQTT connect", err);
            });
        }

        this.config.onUpdate((key) => {
            if (key === "mqtt") {
                this.handleConfigUpdated().catch((err) => {
                    Logger.warn("Error while reconfiguring MQTT after configuration change", err);
                });
            }
        });

        this.valetudoHelper.onFriendlyNameChanged(() => {
            this.handleConfigUpdated().catch((err) => {
                Logger.warn("Error while reconfiguring MQTT after friendly name change", err);
            });
        });
    }
@param {object} options
@param {import("../core/ValetudoRobot")} options.robot
@param {import("../Configuration")} options.config
@param {import("../ValetudoEventStore")} options.valetudoEventStore
@param {import("../utils/ValetudoHelper")} options.valetudoHelper