rand256 / valetudo

Valetudo RE - experimental vacuum software, cloud free
Apache License 2.0
667 stars 73 forks source link

MQTT entities naming for Home Assistant guidelines #506

Closed xorguy closed 1 year ago

xorguy commented 1 year ago

Describe the bug

Starting with Home Assistant 2023.8.0 a warning about entities naming that will stop working in upcoming release (2024.2).

More information The naming of MQTT entities changes to correspond with HA guidelines

How to Reproduce

Steps to reproduce the behavior:

  1. Install Home Assistant 2023.8 or greater with MQTT'...'
  2. Setup MQTT at vacuum
  3. Discover and add device to MQTT
  4. See warning at Home Assistant settings page

Expected behavior

Devices are discovered and no warning is shown.

rand256 commented 1 year ago

i can take a look into this one but i'm not going to install Home Assistant or anything, so maybe could you at least show the warnings you're talking about? or is it like "your entries are wrong but we won't tell you which ones and how"?

dckiller51 commented 1 year ago

i can take a look into this one but i'm not going to install Home Assistant or anything, so maybe could you at least show the warnings you're talking about? or is it like "your entries are wrong but we won't tell you which ones and how"?

Hello,

        this.autoconf_payloads = {
            vacuum: {
                name: this.identifier,
                unique_id: this.identifier,
                schema: "state",
                device: { manufacturer: "Roborock", model: this.vacuum.model, name: this.identifier, identifiers: [ this.identifier ], sw_version: valetudo.version },
                supported_features: [
                    "start",
                    "pause",
                    "stop",
                    "return_home",
                    "battery",
                    "status",
                    "locate",
                    "clean_spot",
                    "fan_speed",
                    "send_command"
                ],

to

        this.autoconf_payloads = {
            vacuum: {
                name: this.identifier,
                unique_id: this.identifier,
                schema: "state",
                device: { manufacturer: "Roborock", model: this.vacuum.model, name: "vacuum", identifiers: [ this.identifier ], sw_version: valetudo.version },
                supported_features: [
                    "start",
                    "pause",
                    "stop",
                    "return_home",
                    "battery",
                    "status",
                    "locate",
                    "clean_spot",
                    "fan_speed",
                    "send_command"
                ],

I think that should fix the problem.

Discussion link https://community.home-assistant.io/t/psa-mqtt-name-changes-in-2023-8/598099

for valetudo-mapper

    this.autoconf_payloads = {
        map: {
            name: this.identifier + "_map",
            unique_id: this.identifier + "_map",
            device: { manufacturer: "Roborock", name: this.identifier, identifiers: [ this.identifier ] },
            topic: this.topics.map
        }
    };

to

    this.autoconf_payloads = {
        map: {
            name: this.identifier,
            unique_id: this.identifier + "_map",
            device: { manufacturer: "Roborock", name: "map", identifiers: [ this.identifier ] },
            topic: this.topics.map
        }
    };
xorguy commented 1 year ago

These are the warning messages.

Captura de pantalla 2023-08-06 a las 18 44 47 Captura de pantalla 2023-08-06 a las 18 45 06
MadJoker0815 commented 1 year ago

@dckiller51 This really does fix it for HomeAssistant. I changed the line in valetudo-mapper and the warning disapears after a Mapper and HA restart. My guess is that it will be the same with valetudo itself.

dekiesel commented 1 year ago

Is there anything I can help with to get this merged? It would be great to have clean logs.

rand256 commented 1 year ago

i've updated the mapper today, it was autopublished to docker hub few hour ago.

as for the vacuum itself, could anyone please check if this new binary fixes the naming issue before i actually publish it along with prebuild images and other stuff? i'm pretty sure it should, but still. i myself don't use home assistant and it seems i've even been banned recently from cloudmqtt service i used for testing before (it just doesn't allow me to connect now), so it's getting a little difficult to test all these things.

rand256 commented 1 year ago

well. i have just released version 0.10.10 which includes the aforementioned changes (and some more). still i'm not sure if they work properly since no one has checked them and i don't have HA, but let's assume they will.

xorguy commented 1 year ago

Hi, I missed the comment about the new binary before the release. I've updated two vacuums with 0.10.10 and I see no complaints at Home Assistant 2023.9.2. Tried to change name and it was changed at Home Assistant immediately, so far seems good.

Thanks for the work.