Help: making this automation/blueprint work to check plant soil conductivity to trigger a 'fertilization required' notification!

Automations created with this blueprint is not triggering as intended.

blueprint:
  name: Plants low fertilizer detection and notification.
  description: Regularly test all plant sensors with 'conductivity low' problem 
    and notify via Mobile App and Voice Assistants.
  domain: automation



  input:
    check_time:
      name: 'Time of the day to test on: '
      description: Test is run at this configured time
      default: '10:00:00'
      selector:
        time:

    conductivity_threshold:
      name: 'Threshold under which notification is triggered:'
      selector:
        number:
          min: 0
          max: 500
          step: 1
          unit_of_measurement: "µS/cm"
          mode: slider


    check_day:
      name: Weekday to test on
      description: 'Test is run at configured time either everyday (0) or on a given
        weekday (1: Monday ... 7: Sunday)'
      default: '0'
      selector:
        select:
          options:
            - label: Everyday
              value: '0'
            - label: Monday
              value: '1'
            - label: Tuesday
              value: '2'
            - label: Wednesday
              value: '3'
            - label: Thursday
              value: '4'
            - label: Friday
              value: '5'
            - label: Saturday
              value: '6'
            - label: Sunday
              value: '7'
          mode: list


    excluded_plants:
      name: Excluded Plants
      description: Plant entities (e.g. cactus) to exclude from detection. Only entities are supported!
      default: {entity_id: []}
      selector:
        target:
          entity:
            domain: plant
      
# variables
variables:
  day: !input 'check_day'
  excluded_plants: !input 'excluded_plants'
  threshold: !input 'conductivity_threshold'

  hungry_plants: >-

    {% set hungry = namespace( plants = [] ) %}
    {% set allplants = states.plant %}
    {% for plant in allplants if 'conductivity low' in plant.attributes.problem %}
      {% if not plant.entity_id in excluded_plants.entity_id %}
        {% if plant.attributes.conductivity | int < threshold %}
            {% set hungry.plants = hungry.plants + [plant.attributes.friendly_name] %}
        {% endif %}
      {% endif %}
    {% endfor %}

    {% if hungry.plants|length >= 2 %}
      {{ hungry.plants|join(', ') + ' have' }}
    {% elif hungry.plant|length == 1 %}
      {{ hungry.plants|join(', ') + ' has' }}
    {% else %}
      {{ '' }}
    {% endif %} 


# trigger
trigger:
- platform: time
  at: !input 'check_time'

# condition
condition:
- '{{ hungry_plants != '''' and (day | int == 0 or day | int == now().isoweekday()) }}'

# action
action:
- service: notify.all_devices
  data:
    title: Plant Conductivity Alert
    message: '{{ hungry_plants }} low conductivity, consider fertilizing!'
    data:
      group: plantfertlizer-notification-group

- service: notify.alexa_media
  data:
    data:
      type: announce
    target:
    - media_player.echo_main_bedroom
    - media_player.echo_kitchen
    message: 'Attention: {{ hungry_plants }} low conductivity, consider fertilizing!'

Automation:

- id: '1651426849206'
  alias: 'Test: Plants low fertilizer detection and notification.'
  description: ''
  use_blueprint:
    path: skepticautonetic/routines/plants/low-fertilizer-check.yaml
    input:
      conductivity_threshold: 100
      excluded_plants:
        entity_id:
        - plant.dypsis_lutescens
      check_time: '11:00:00'
      check_day: '0'

Edit:

Add the automation part.

I have set the conductivity_threshold: in the blueprint as 100µS/cm. The plant which has conductivity below 100 is Ficus Elastica and the template was successfully able to catch that.

Developer Tools > Template:

Plant List:

Automation:

- id: '1651426849206'
  alias: 'Test: Plants low fertilizer detection and notification.'
  description: ''
  use_blueprint:
    path: skepticautonetic/routines/plants/low-fertilizer-check.yaml
    input:
      conductivity_threshold: 100
      excluded_plants:
        entity_id:
        - plant.dypsis_lutescens
      check_time: '11:00:00'
      check_day: '0'

The automation is not triggering for some reason, any help is greatly appreciated. Thanks

What sensor do you use to check fertilizer status?
And do you take into consideration that many sensor methods produce different results depending on the voltage on the battery and how much liquid there is in the area around the sensor?

@WallyR Thank you for your reply. I am looking for help to find out what is making the automation not to trigger.

I am aware that the soil conductivity readings are depended on many factors. I am no way expecting some medical-grade precision from these sensors as well. I just need some ballpark figures to aid my personal evaluation of the house plant nutritional requirements.

Edit:

May be I would as well modify the template logic to look if the moisture level is not too low as well before filtering the plants for low soil electrical conductivity and in need for nutrients.

Modified the template logic to also use the soil moisture level and tested the automation once again and it seems to work now. I did not make much of a change in the automation part apart from how the conditional was formatted.

Blueprint

blueprint:
  name: Plants low fertilizer detection and notification.
  description: Regularly test all plant sensors with 'conductivity low' problem 
    and notify via Mobile App and Voice Assistants.
  domain: automation



  input:
    check_time:
      name: 'Time of the day to test on: '
      description: Test is run at this configured time
      default: '10:00:00'
      selector:
        time:

    conductivity_threshold:
      name: 'Soil conductivity lower-threshold: '
      description: Lowest soil conductivity value under which notification is triggered.
      default: 100
      selector:
        number:
          min: 0
          max: 500
          step: 1
          unit_of_measurement: "µS/cm"
          mode: slider

    moisture_threshold:
      name: 'Soil moisture lower-threshold: '
      description: Lowest soil moisture value below which low fertility is not checked.
      default: 25
      selector:
        number:
          min: 1
          max: 100
          step: 1
          unit_of_measurement: "%"
          mode: slider

    check_day:
      name: Weekday to test on
      description: 'Test is run at configured time either everyday (0) or on a given
        weekday (1: Monday ... 7: Sunday)'
      default: '0'
      selector:
        select:
          options:
            - label: Everyday
              value: '0'
            - label: Monday
              value: '1'
            - label: Tuesday
              value: '2'
            - label: Wednesday
              value: '3'
            - label: Thursday
              value: '4'
            - label: Friday
              value: '5'
            - label: Saturday
              value: '6'
            - label: Sunday
              value: '7'
          mode: list


    excluded_plants:
      name: Excluded Plants
      description: Plant entities (e.g. cactus) to exclude from detection.
      default: {entity_id: []}
      selector:
        target:
          entity:
            domain: plant
      
# variables
variables:
  check_day: !input 'check_day'
  excluded_plants: !input 'excluded_plants'
  conductivity_threshold: !input 'conductivity_threshold'
  moisture_threshold: !input 'moisture_threshold'

  hungry_plants: >-
    {% set hungry = namespace( plants = [] ) %}
    {% set allplants = states.plant %}
    {% for plant in allplants if 'conductivity low' in plant.attributes.problem %}
      {% if not plant.entity_id in excluded_plants.entity_id %}
        {% if plant.attributes.moisture | int >= moisture_threshold and plant.attributes.conductivity | int < conductivity_threshold %}
            {% set hungry.plants = hungry.plants + [plant.attributes.friendly_name] %}
        {% endif %}
      {% endif %}
    {% endfor %}

    {% if hungry.plants|length >= 2 %}
      {{ hungry.plants|join(', ') + ' have' }}
    {% elif hungry.plant|length == 1 %}
      {{ hungry.plants|join(', ') + ' has' }}
    {% else %}
      {{ '' }}
    {% endif %} 


# trigger
trigger:
- platform: time
  at: !input 'check_time'

# condition
condition:
- "{{ hungry_plants != '' and (check_day | int == 0 or check_day | int == now().isoweekday()) }}"

# action
action:
- service: notify.aruns_devices
  data:
    title: 🪴 Plant Soil Fertility Alert!
    message: '{{ hungry_plants }} low soil conductivity, consider fertilizing!'
    data:
      group: plants-notice-group
      actions:
        - action: "URI"
          title: "Go to Plants"
          uri: "/house-plants/default_view"

- service: notify.alexa_media
  data:
    data:
      type: announce
    target: 
    - media_player.echo_main_bedroom
    - media_player.echo_kitchen
    message: 'Attention: {{ hungry_plants }} low soil conductivity, consider fertilizing!'

- service: tts.google_translate_say
  entity_id: media_player.homemini_living_room
  data_template:
    message: >
      Attention: {{ hungry_plants }} low soil conductivity, consider fertilizing!

The reason why I asked was that my own attempts with does sensors ended when I realized that the value span was impossible to map with mathematical functions.
The voltage of the battery did not change the fertilization value in a logical way and the waster level did not change the fertilization value in a logical way.
When I combined those two findings then it went all weird.

My conclusion was that fertilization could only somewhat useful be measured shirtly after watering and even then it was unreliable.

In the end I gav up completely when the erosion of the sensor points started to have an effect on the findings too, which all resistive sensors suffer under.

Now I use capacitative sensors, but they can only measure water level.

I use Mi Flora/Flower Care plant sensors. Product model: HHCCJCY01HHCC

http://www.huahuacaocao.com/product

I believe these uses capacitive method for measuring soil moisture and resistive method for soil EC. But the EC electrodes itself on these seems corrosion resistive and chunkier. Many on this forum have them for more than 3 years I guess. Soil EC is also dependent on factors like clay content of the soil, temperature etc. Regardless an EC range of 100 - 500 µS/cm seems to be ideal for making nutrients readily available for plant roots, but please don’t quote me on that.