PricelessToolkit / Droplet

ALL-IN-ONE Irrigation and monitoring system for ESPHome and Home Assistant.
https://www.youtube.com/c/PricelessToolkit
BSD 3-Clause "New" or "Revised" License
158 stars 17 forks source link

Soil senor update interval #14

Closed arne182 closed 4 months ago

arne182 commented 5 months ago

Would it be possible to reduce the interval so that home assistant is not overloaded with reading s. Maybe an averaged reading every few seconds is better. Or even every minute would be more than good enough

PricelessToolkit commented 5 months ago

HI, yes just change "update_interval: xx" for the sensors. For "COMPARISON SENSOR" and "MOISTUR LEVEL SENSOR" don't put a big number, for example, "2s" means it will pump 2s after reading "sensor value", but if the sensor value does not change 1 minute it will pump 30 times.

TMP SENSOR

dallas:  # Integrated Temperature Sensor. https://esphome.io/components/sensor/dallas.html
  - pin: 25
    update_interval: 5s

MOISTUR LEVEL SENSORS

sensor:
  # MOISTUR LEVEL SENSORS #   https://esphome.io/components/sensor/adc.html?highlight=adc
  - platform: adc
    pin: 34
    id: "Soil1"
    name: "${name} SoilM Sens 1"
    icon: "mdi:water-percent"
    update_interval: 2s
    unit_of_measurement: "%"
    attenuation: 11db
    filters:
    - calibrate_linear:
        - 2.520 -> 0.00  # Calibrate Min in dry soil
        - 0.99 -> 100.00 # Calibrate MAX in 100% wet soil 
    - lambda: |
        if (x < 0) return 0; 
        else if (x > 100) return 100;
        else return (x);
    accuracy_decimals: 0

COMPARISON SENSOR


  - platform: template
    name: "Comparison Sens1"
    internal: true
    update_interval: 2s # Seconds to pump water then stops pumping and starts comparing sensors data, if needed it will pump again
    lambda: |-
      if (id(Soil1).state < id(desired_mois_value_1).state) {
        id(pump1).toggle();
      } else {
        id(pump1).turn_off();
      }
      return {};