devWaves / SwitchBot-MQTT-BLE-ESP32

Allows for multiple SwitchBot bots and curtains to be controlled via MQTT sent to ESP32. ESP32 will send BLE commands to switchbots and return MQTT responses to the broker. Also supports Temperature, Motion, Contact sensors
MIT License
549 stars 68 forks source link

Second button not updating entities - error: "Platform mqtt does not generate unique IDs" #69

Closed ScottG489 closed 2 years ago

ScottG489 commented 2 years ago

I've been getting errors like this since I think my first flash.

Platform mqtt does not generate unique IDs. ID switchbot_\<MAC>_linkquality already exists - ignoring sensor.lower_bed_switchbot_linkquality

I have two buttons. One is not getting these errors or experiencing any problems with it's associated entities.

The other button itself works fine, but all the entities associated with it like Battery, HoldSecs, Linkquality, etc. aren't updating.

Here is some relevant settings code in case I've missconfigured something:

/* Wifi Settings */
static const char* host = "switchbot-ble-mqtt-hub";
static const char* ssid = "<REDACTED>";
static const char* password = "<REDACTED>";

/* MQTT Settings */
/* MQTT Client name is set to WIFI host from Wifi Settings*/
static const char* mqtt_host = "<REDACTED>";
static const char* mqtt_user = "<REDACTED>";
static const char* mqtt_pass = "<REDACTED>";
static const int mqtt_port = 1883;
static const std::string mqtt_main_topic = "switchbot_ble_mqtt_hub";

/* Switchbot Bot Settings */
static std::map<std::string, std::string> allBots = {
  { "raise-bed-switchbot", "D4:<REDACTED>" },
  { "lower-bed-switchbot", "D7:<REDACTED>" }
};

static std::map<std::string, std::string> allBotTypes = {
  { "raise-bed-switchbot", "button" },
  { "lower-bed-switchbot", "button" }
};

Any idea what might be going on?

devWaves commented 2 years ago

I have just made updates to a v7.0-preRelease here https://github.com/devWaves/SwitchBot-MQTT-BLE-ESP32/tree/v7alpha

Can you try the v7.0-preRelease and let me know if you still have issues?

just ignore the new settings related to "mesh"

ScottG489 commented 2 years ago

Do you have any reason to suspect it's actually caused by this firmware?

I reinstalled my mosquitto broker and the errors went away. I think it was due to something in my mosquitto.db not clearing properly. Otherwise, I can close this issue.

devWaves commented 2 years ago

all good then. don't need to update if it's working

there is a minor change for bots, if they return a low battery error when attempting to control, a 1% battery will be sent on the new battery topic

clearing mqtt retained topics fixes most issues. the mqtt exploret program is good for that. that probably happened when u reinstalled mqtt