Hi All,
I have integrated an MQTT based door sensor (without ESPhome), to home assistant.
I have observed that intermittently the sensor goes to unknown.
I am not sure for the reason.
Sensor setup: Firmware running in esp32c3 (xiao) with door sensor, publishing data to an MQTT topic to which Homeassistant is subscribed to.
Any specific reason for this?
You can find the firmware and home assistant configuration file here: Github Repo
Appreciate your valuable time for this.
francisp
(Francis)
2
Publish the message as a retained message.
1 Like
Troon
(Troon)
3
https://pubsubclient.knolleary.net/api#publish
if (lastDoorState == LOW && currentDoorState == HIGH) {
Serial.println("The door-opening event is detected");
client.publish("office/balcony/door", "OPEN", true);
} else if (lastDoorState == HIGH && currentDoorState == LOW) {
Serial.println("The door-closing event is detected");
client.publish("office/balcony/door", "CLOSED", true);
Troon, I have updated the firmware to the same. Observing it for some days, and I will update here.