madl3x / miflora_rbs

Xiaomi Mi-Flora ESP32 Receiver base station
MIT License
2 stars 0 forks source link

auto detect device #2

Open garudaonekh opened 2 years ago

garudaonekh commented 2 years ago

Hi, can it auto detect new sensor? what is the registration process of new sensor? Can we move sensor from a station and register to new station?

garudaonekh commented 2 years ago

Thanks, how to do it via OTA? Can we configure this via MQTT? This mechanism is hard for normal user to use.

garudaonekh commented 2 years ago

I think the option to add new device on site is better. For example, click a button to add new device

madl3x commented 2 years ago

Hi, can it auto detect new sensor?

The firmware will automatically detect new devices, if you have FLORA_DISCOVER_DEVICES set to true in default_config.h (currently the default value).

Thanks, how to do it via OTA?

Check out this tutorial for how to update the "data" partition of an ESP32 using OTA and SPIFFS.

There are two templates in the /data folder: config.cfg.sample and devices.cfg.sample. Rename these to config.cfg and devices.cfg and edit them accordingly.

/data/config.cfg is used so to overwrite the default settings set at compile time by /include/default_config.h. This config file is useful if you want to use the same firmware image for multiple stations, and configure the stations differently, without recompiling.

When the station boots, it looks for this config.cfg file to overwrite the default settings configured via /include/default.config. If it's not found, it will continue using the default settings from default_config.h.

/data/devices.cfg contains the list of MiFlora devices "known" by the station. The configuration assigns a name, a unique ID, and the recommended limits for moisture, temperature, conductivity, illuminance, and RSSI, to each plant.

Can we configure this via MQTT? This mechanism is hard for normal user to use.

No.

It is the same mechanism that you use for flashing the firmware, it only adds a marginal effort to write the "data" partition.