MiFlora Sensor Plant Database

Mine is the same:

'use strict';
const FlowerData =
{" -insert really long line - ]}
;
export {FlowerData};

I’ve no idea why is not working :sleepy:

What about the error message? Is it identical to Artem’s? or just similar?

It’s identical =(

I’ve resolved the issue, my mistake.
I’ve declared as JS instead of module the type of file that I was including.
Here the correct declaration inside Lovelace config:

resources:
  - type: js
    url: /local/customcards/github/thomasloven/card-tools.js?track=true
  - type: module
    url: /local/lovelace-flower-card/flower-card.js
1 Like

I’m working on a new solution to managing MiFlora sensors, i have so many that i need more then one receiver.

I’m currently hacking away at the backend, sadly i suck at frontend any one here who wants to lend a hand?

It will support using multiple receiver devices (currently based on ESP32 but more can be implemented) it will automatically calculate what receiver to use when getting data from a sensor and adding both receiver and MiFlora devices should be a push of a button.

Later i plan to add searching for plants and generating Home Assistant yaml so that you don’t have to edit them manually every time you change what plant you are using the sensor for.

Edit: It is open source and any one can sneak a peak at https://github.com/AnderssonPeter/MiFloraSwarm currently only the ESP32 code is there, when i have something usable i will commit the backend.

6 Likes

Great.
At the moment I created many min max sensor (using last ) combining data coming from 3 different esp32 lying around the house.

Pretty reliable

Hi Peter.
I currently use an ESP32 with ESPHome as the gateway for my mifloras.
Would you mind to explain what is the pros/cons of your approach vs ESPhome?

I have not used ESPHome so I’m not 100% sure I’m correct in my assumptions, also I’m not done yet.

When i say Device below i mean “Hardware that reads the miflora devices (Currently ESP32 but there is no restriction on that you could use a Raspberry pi zero if someone writes the correct software for it)”

Pros:

  • Adding a new device is as simple as starting it and pushing a scan button.
  • You don’t have to specify what device should read what MiFlora Sensor.
  • You can search the plant database in the application.
  • You can generate yaml for Home Assistant directly from the Application.
  • Adding new MiFlora sensors is as simple as pushing a scan button.

Cons:

  • My solution is not usable yet while ESPHome is!
  • ESPHome can be used to do other things not related to MiFlora.
  • ESPHome will be alot more stable as my c++ skills are lacking!
  • You have to run one more application.

All i have so far is a database and a API to query/modify the database.
So the following is left to do:

  • Add authentication.
  • Create a frontend.
  • Add logic that scans for new devices.
  • Add logic to scan for new MiFlora sensors.
  • Add the plant search code.
  • Add a background service that reads the MiFlora sensors and sends them to HA via MQTT.
  • More that i can’t think of now.
2 Likes

It sounds awesome!
Are you planning to use MQTT to discover the mifloras into HA?

I have only had trouble with the automatic mqtt ha sensors, but we could implement it if someone needs it.

I use around 3 pi zero’s using ble to MQTT, would be interested in having a look, although not too keen to get new (ESP would be new for me) hardware protocol in my already chatty house

Really nice, thank you !

2019-06-29%2011_33_47-Home%20Assistant

2 Likes

Sorry for the late reply, but ESP32 use WiFi so it would not be a new Communication Protocol.

But it would require new hardware or if you write the same software for a PI that i have written for a EPS32, then no new hardware would be required.

I can contribute here, I think. @jones it’s possible to build an API-like interface into a google sheet, which can be hit like a REST api. The only issue is that all requests would need to be able to handle redirects.

It’s possible to provide a restful endpoint on a sheet, and integrate form submissions as well. This would allow us to have a single, central, crowd-sourced database. I’m not sure what the shape of the data required by the script that @AnderssonPeter created, but I should be able to provide the required response if I know the spec.

The only limitation I can foresee is that there’s a limit to the number of calls that can be made, as it’s free. Likely wouldn’t become an issue unless/until the database grows very large and/or there are a lot of users on the app. A full SQL database would likely be the best solution, but isn’t as user-friendly, and I don’t have a free way of hosting that anywhere.

Please let me know if this is interesting, or if the solution has moved on past the Google sheets concept.

1 Like

could someone please share their working data.js file please? Thanks!

Here: https://filebin.net/wgn4vk9q8zni1lqh
FYI: Link expires after 2 weeks.

2 Likes

Thankyou, that’s very kind!

Hi,

So I am trying to configure this card and got pretty fare.
But I seem to have some problems to find the right entity

The card is setup as:

entity: sensor.spathiphyllum_zolder_moisture
species: spathiphyllum 'bingo cupido'
type: 'custom:flower-card'

This is giving me only the Moisture sensor data in the card.
chaning it in sensor.spathiphyllum_zolder or plant.spathiphyllum_zolder is not working.

How do I need to setup this sensor?

The sensor is setup as:

- platform: miflora
  mac: 'C4:7C:8D:6A:D2:39'
  name: Spathiphyllum - Zolder
  force_update: false
  # scan_interval: 30
  # scan_interval: 300
  scan_interval: 1800
  # median: 3
  monitored_conditions:
    - moisture
    - light
    - temperature
    - conductivity
    - battery

Found the sollution.

Adding a plant sensor in you configuration.yaml you can combine them in 1 entity.

spathiphyllum_zolder: 
  sensors:
    moisture: sensor.spathiphyllum_zolder_moisture
    battery: sensor.spathiphyllum_zolder_battery
    temperature: sensor.spathiphyllum_zolder_temperature
    conductivity: sensor.spathiphyllum_zolder_conductivity
    brightness: sensor.spathiphyllum_zolder_light_intensity
  min_battery: 17

Thought I would share my config for the plant card. With this, you can swipe between the old plant view and the new custom card… hope someone finds this as useful as I have in tidying up my UI

cards:
  - entity: plant.herbs
    species: thymus camphoratus
    type: 'custom:flower-card'
  - entity: plant.herbs
    name: Herbs
    type: plant-status
parameters:
  scrollbar:
    draggable: true
    hide: false
    snapOnRelease: true
  spaceBetween: 8
type: 'custom:swipe-card'
2 Likes