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
530 stars 66 forks source link

Remove MQTT entity names that start with device name #140

Open NewsGuyTor opened 6 months ago

NewsGuyTor commented 6 months ago

This should make it function better in Home Assistant

Capusjon commented 6 months ago

After implementing said changes almost all the warnings are gone. Only one that remains for me is:

2023-12-14 14:22:47.398 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.slaapkamergordijn_illuminance (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'Level' which is not a valid unit for the device class ('illuminance') it is using; expected one of ['lx']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22

changing line 3371 to

+ "\"unit_of_meas\": \"lx\", " +

should fix the warning, only issue I have with this fix is that the data produced by the Switchbot for Illuminance isn't in lux. So technically it's not the best solution, might need to use an other topic instead of illuminance. But for now this suits me and the warnings are gone.

@NewsGuyTor thanx for your part of the fix. If you could add in my previous comment that would be great, for this comment do with it what you want..

NewsGuyTor commented 6 months ago

@Capusjon : Fixed