I’ve made a Wemos D1-mini pro based device with some sensors and I’m struggling to publish the state of the rainsensor to Home Assistant. The rainsensor consist of “two wires” making contact when it rains, due to the angle it will reset (almost) as soon as there is no more rain. It has been configured as a button, because I believe it’s characteristics are best compared with that of a momentary button. With SO1 1 and SO13 I disable the hold function so it won’t reset the device. I’ve made it a sensor instead of a binary_sensor because I want it to show Rain or Dry instead of ON and OFF.
My Tasmota config:
Module 18
MQTTHost {ip-address}
MQTTUser {username}
MQTTPassword {password}
GroupTopic tasmota
Topic 17
WifiConfig 2
GPIO0 1760 - SDS0X1 Rx
GPIO2 1728 - SDS0X1 Tx
GPIO4 640 - I2C SDA
GPIO5 608 - I2C SCL
GPIO12 4384 - GPS TX
GPIO13 4352 - GPS RX
GPIO14 33 - Button2/Rainsensor
Switchmode2 13
SO1 1
SO13 1
My Tasmota Rules:
BACKLOG RULE1 ON Button2#State=1 DO PUBLISH stat/17/RAINSENSOR Rain ENDON ON Button2#State=0 DO PUBLISH stat/17/RAINSENSOR Dry; RULE1 1
BACKLOG RULE2 ON SYSTEM#BOOT DO PUBLISH2 homeassistant/sensor/%macaddr%_rainsensor/config {"name":"Rainsensor","state_topic":"stat/17/RAINSENSOR","device_class":null,"force_update":true,"availability_topic":"tele/17/LWT","qos":0,"retain":true,"unique_id":"%macaddr%_rainsensor","device":{"connections":[["mac","%macaddr%"]]}} ENDON; RULE2 1
The sensor is added to the device, but it’s unavailable
Even when I
publish stat/17/RAINSENSOR Rain
or stat/17/RAINSENSOR ON
it’ll still remain Unavailable, I can see the change with MQTT Explorer.
What have I overlooked/done wrong? Any help would be appreciated.