Tag Archives: ha

Mi Flora, Home ASSISTANT and MQTT Gateway

I’ve recently got an ESP32 and decided to try and use it as an MQTT gateway for my hassio installation. It’s running on esx on a NUC and no matter what I do I can’t get bluetooth to work, so I gave up and bought this little controller.

Instructions to install it are here – https://docs.openmqttgateway.com/ It took a bit of fiddling with some io errors. If using adrduino ide you might have to make some changes such as setting the board partition to be minimal SPIFFS.

After installation connect to it via it’s AP, give it your wifi information and MQTT broker and you should see things appear. The MiFlora will show under something like home/OpenMQTTGateway/BTtoMQTT/MACADDRESS

Once it’s there, it’s fairly simple to set up the sensor within HA. But here’s my code for the lazy:

  • #replace MAC with your actuall mac address!
  • platform: mqtt
    state_topic: 'home/OpenMQTTGateway/BTtoMQTT/MAC
    name: "plant_temperature"
    unit_of_measurement: '°C'
    value_template: '{{ value_json.tem | is_defined }}'
  • platform: mqtt
    state_topic: 'home/OpenMQTTGateway/BTtoMQTT/MAC'
    name: "plant_moisture"
    unit_of_measurement: '%'
    value_template: '{{ value_json.moi | is_defined }}'
  • platform: mqtt
    state_topic: 'home/OpenMQTTGateway/BTtoMQTT/MAC'
    name: "plant_battery"
    unit_of_measurement: '%'
    value_template: '{{ value_json.bat | is_defined }}'
  • platform: mqtt
    state_topic: 'home/OpenMQTTGateway/BTtoMQTT/MAC'
    name: "plant_fertiliser"
    unit_of_measurement: '%'
    value_template: '{{ value_json.fer | is_defined }}'
  • platform: mqtt
    state_topic: 'home/OpenMQTTGateway/BTtoMQTT/MAC'
    name: "plant_light"
    unit_of_measurement: 'lux'
    value_template: '{{ value_json.lux | is_defined }}'