Skip to content

Instantly share code, notes, and snippets.

@Elwell
Created July 28, 2021 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Elwell/1b0421abea0fa7f90a139b3400c890f2 to your computer and use it in GitHub Desktop.
Save Elwell/1b0421abea0fa7f90a139b3400c890f2 to your computer and use it in GitHub Desktop.
MQTT "auto" discovery for home-assistant of flashed Mi sensors
### 264902
mosquitto_pub -h broker-int -r \
-t homeassistant/sensor/ATC_264902_temp/config \
-m '{"device_class": "temperature",
"state_topic": "tele/tasmota_ble/ATC264902",
"name": "ATC_264902 Temperature",
"uniq_id": "ATC_264902_temp",
"unit_of_meas": "°C",
"value_template": "{{ value_json.Temperature}}",
"device": { "name": "ATC_264902", "sw_version": "3.1", "identifiers": ["ATC_264902"]}
}'
mosquitto_pub -h broker-int -r \
-t homeassistant/sensor/ATC_264902_humidity/config \
-m '{"device_class": "humidity",
"state_topic": "tele/tasmota_ble/ATC264902",
"name": "ATC_264902 Humidity",
"uniq_id": "ATC_264902_humidity",
"unit_of_meas": "%",
"value_template": "{{ value_json.Humidity}}",
"device": { "name": "ATC_264902", "sw_version": "3.1", "identifiers": ["ATC_264902"]}
}'
mosquitto_pub -h broker-int -r \
-t homeassistant/sensor/ATC_264902_dewpt/config \
-m '{"device_class": "temperature",
"state_topic": "tele/tasmota_ble/ATC264902",
"name": "ATC_264902 Dew Point",
"uniq_id": "ATC_264902_dewpt",
"unit_of_meas": "°C",
"value_template": "{{ value_json.DewPoint}}",
"device": { "name": "ATC_264902", "sw_version": "3.1", "identifiers": ["ATC_264902"]}
}'
mosquitto_pub -h broker-int -r \
-t homeassistant/sensor/ATC_264902_batt/config \
-m '{"device_class": "battery",
"state_topic": "tele/tasmota_ble/ATC264902",
"name": "ATC_264902 Battery",
"uniq_id": "ATC_264902_batt",
"unit_of_meas": "%",
"value_template": "{{ value_json.Battery}}",
"device": { "name": "ATC_264902", "sw_version": "3.1", "identifiers": ["ATC_264902"]}
}'
mosquitto_pub -h broker-int -r \
-t homeassistant/sensor/ATC_264902_rssi/config \
-m '{"device_class": "signal_strength",
"state_topic": "tele/tasmota_ble/ATC264902",
"name": "ATC_264902 RSSI",
"uniq_id": "ATC_264902_rssi",
"unit_of_meas": "dBm",
"value_template": "{{ value_json.RSSI}}",
"device": { "name": "ATC_264902", "sw_version": "3.1", "identifiers": ["ATC_264902"]}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment