miflora-mqtt-daemon icon indicating copy to clipboard operation
miflora-mqtt-daemon copied to clipboard

Home Assistant example

Open itayraviv opened this issue 4 years ago β€’ 7 comments

I followed the instructions and installed this great project on a RPi3 trying to send MiFlora sensors data back the my main HA system running on an Ubuntu server. I see in my MQTT broker a successful connection from the RPi. now, how can I present the sensors data as sensors in HA? can someone share the needed "plant" and "sensor" config? Thanks !

itayraviv avatar Feb 11 '20 15:02 itayraviv

Try latest git version, it has improved HA sensor discovery (see @ #101 ). After successful miflora-mqtt-daemon configuration (for home-assistant) and connecting it to integrated HA MQTT broker, you should see each Miflora sensor as separate HA Device (with lux, temp, moisture, conductivity and battery sensors/entities) under HA MQTT broker Integrations.

Regarding Plant component (https://www.home-assistant.io/integrations/plant/): this must be defined manually in configuration.yaml. For example if you have mqtt-daemon advertising Plant01 Miflora sensor, then configuration.yaml could look like this:

plant:
  plant01:
    sensors:
      moisture: sensor.plant01_moisture
      battery: sensor.plant01_battery
      temperature: sensor.plant01_temperature
      conductivity: sensor.plant01_conductivity
      brightness: sensor.plant01_light
    min_moisture: 28
    max_moisture: 75
    min_battery: 20
    min_conductivity: 100
    max_conductivity: 2000
    min_temperature: 5
    max_temperature: 35
    min_brightness: 2500
    max_brightness: 55000
    check_days: 3

bangom avatar Mar 30 '20 13:03 bangom

Thanks @bangom for your addition! Just to clarify, it doesn't have to the be integrated MQTT broker. Any connected broker will do.

Thanks for the example. Would you want to create a pull request against the README?

ThomDietrich avatar Mar 30 '20 14:03 ThomDietrich

Thanks @bangom for your addition! Just to clarify, it doesn't have to the be integrated MQTT broker. Any connected broker will do.

I suspect if one uses general (external) MQTT broker with HA, then one must modify HA configuration.yaml:

# Example configuration.yaml entry
mqtt:
  discovery: true
  discovery_prefix: homeassistant

With integrated MQTT broker this is enabled by default or offered during MQTT Integration setup...

Thanks for the example. Would you want to create a pull request against the README?

Regarding plant component configuration.yaml example? Personally I'm not satisfied with this manual solution. My goal is that miflora-mqtt-daemon will add Plant component device (for monitoring Plant state based on particular plant type) automatically (via HA API) ... possibly customised Plant component, because current implementation is quite limited and not user friendly. Final goal is to to have miflora in HA more like "ESPhome experience" compared to "Tasmota in HA via MQTT"... (try for yourself :)

bangom avatar Mar 30 '20 14:03 bangom

Fine by me. Kind of agree. Could you elaborate on the "ESPhome experience" piece? Generally I would expect the Home Assistant core developers to support plant entities to be MQTT discoverable at some point, I would just await this step.

Regarding custom card: There are two-three cards for plants, all with their own little drawbacks. Would be could to merge their concepts to support: individual entities AND a plant entity, presented values AND icons only, configurable warning behavior, ...

Is this something you would want to work on?

ThomDietrich avatar Apr 01 '20 18:04 ThomDietrich

Fine by me. Kind of agree. Could you elaborate on the "ESPhome experience" piece? Generally I would expect the Home Assistant core developers to support plant entities to be MQTT discoverable at some point, I would just await this step.

ESPhome communicates with HA via HA API and therefore can do more. I'm thinking miflora-mqtt-daemon automatically creating plant entity via HA API for the user with adversited sensors.

Regarding custom card: There are two-three cards for plants, all with their own little drawbacks. Would be could to merge their concepts to support: individual entities AND a plant entity, presented values AND icons only, configurable warning behavior, ...

Is this something you would want to work on?

I did not mean custom Lovelace card but custom (advanced) plant component (like there is old plant component: https://www.home-assistant.io/integrations/plant/). This new plant component would automatically set monitoring lux, temp, moisture ranges according to the plant name/type (grabbed from miflora DB which is "free" on the internet). Old plant component is not sufficient and hard to manage (imagine 10s of plant component for different plant types... and the probability of the error you can make setting the plant parameters. How hard it is to set those plant components up.

bangom avatar Apr 07 '20 20:04 bangom

i just found this project here because my miflora sensors are not working with hass.io. BUT i m not able to install it on my system. i m running it on hass.io. how can i install it? the terminal says ➜ ~ sudo apt install git python3 python3-pip bluetooth bluez sudo: apt: command not found @bangom are you using it on hass.os?

Dreamoffice avatar Apr 19 '20 20:04 Dreamoffice

Hassio is not made to be used as a host system. You'd need a docker based hassio add-on. It's not awfully difficult to write but I did not do that so far. If you look into this, feel free to provide a PR!

Till then the workaround by @bangom, me, and others is to execute the daemon on a different system :)

ThomDietrich avatar May 07 '20 09:05 ThomDietrich