Hypfer / Valetudo

Cloud replacement for vacuum robots enabling local-only operation
https://valetudo.cloud
Apache License 2.0
6.65k stars 396 forks source link

Mqtt topic for hass not correct after upgrade, sets to "undefined" #1067

Closed pkishino closed 3 years ago

pkishino commented 3 years ago

Describe the bug

Before the upgrade the mqtt topic for hass integration was the following: valetudo>robot>hass Now, when checking mqtt it is sending to undefined>robot>hass

Screen Shot 2021-09-03 at 12 13 07

the other parts under valetudo>robot update correctly

To Reproduce

I have tried to restart mqtt/restart vacuum/enable-disable hass integration etc.. looking at the code it seem the topic is never set for this.

Screenshots

See below for mqtt hass config

{
    "name": "Valetudo Robot",
    "schema": "state",
    "supported_features": ["battery", "status", "start", "stop", "pause", "return_home", "fan_speed", "locate"],
    "state_topic": "undefined/robot/hass/robot_vacuum/state",
    "command_topic": "undefined/robot/hass/robot_vacuum/command",
    "payload_start": "START",
    "payload_pause": "PAUSE",
    "payload_return_to_base": "HOME",
    "payload_stop": "STOP",
    "payload_locate": "LOCATE",
    "fan_speed_list": ["min", "low", "medium", "high", "max"],
    "set_fan_speed_topic": "valetudo/robot/FanSpeedControlCapability/preset/set",
    "unique_id": "robot_vacuum",
    "availability_topic": "valetudo/robot/$state",
    "payload_available": "ready",
    "payload_not_available": "lost",
    "device": {
        "manufacturer": "Roborock",
        "model": "Xiaomi Mi Robot Vacuum",
        "name": "Valetudo Robot",
        "identifiers": ["robot"],
        "sw_version": "2021.08.1 (Valetudo)"
    }
}

Vacuum Model

Xiaomi gen 1

Valetudo Version

2021.8.1

Expected behavior

the hass integration/autodiscovery should write to valetudo>robot>hass topic

Additional context

Hypfer commented 3 years ago

Indeed :(

When working on 65a335ba, I've missed that the HassController also reads the config file by itself which led to this. This wasn't discovered during testing as home assistant just started using the topics starting with undefined/

f00edb32 fixes this. Note that that is a breaking change and will require reconfiguration due to the different MQTT config schema

pkishino commented 3 years ago

Awesome, thanks for the fix, looking forward to this soon. Yeah, it works but just looks strange, thanks!