I’m confused, is method 1 or 2 still preferred?
I am just configuring the device in the configuration.yaml, like this (working perfectly for 5 Govee leak sensors):
binary_sensor:
- platform: mqtt
name: "Water Heater Leak Detector"
unique_id: "binary_sensor.water_heater_leak_detector"
payload_on: "A123FB"
payload_off: "A123FA"
device_class: moisture
state_topic: "tele/tasmota_XXXXXX/RESULT"
value_template: "{{ value_json.RfReceived.Data }}"
availability_topic: "tele/tasmota_XXXXXX/LWT"
payload_available: "Online"
payload_not_available: "Offline"
This seems extremely easy, scalable, and requires zero scripting.
Big thanks to @kosherPowerhaus for the tip.