Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concept for plants without sensors #133

Closed
wehrstedt opened this issue Jan 20, 2024 · 2 comments
Closed

Concept for plants without sensors #133

wehrstedt opened this issue Jan 20, 2024 · 2 comments

Comments

@wehrstedt
Copy link

I have some flowers without sensor and would like to handle them with this Integration, too, because i like the concept and the idea of this integreation and it would be awesome to have every flower state united in one tool. I know that having sensors is much more accurate than "water your plants every 5 days".

Is there any concept implemented or planned? I was thinking about

  • water frequency (input number, e. g. every 5-6 days)
  • last watered at (date time)
  • button "watered now" which sets "last watered at" to now
  • plant state will change to "problem" if "last watered at" < now
@Olen
Copy link
Owner

Olen commented Jan 30, 2024

I don't think I am going to implement this, as it sounds like something completely different from what this integration does.
You can either set up a local "plant watering"-calendar, and a few buttons/scripts/automations to modify entries in the calendar.

You could even expand that a step further, and create an automation that "fakes" a moisture-sensor based on the age of the "last watered" calendar entry.
E.g. a template-sensor that will show 100% if calendar.plant_watered is today, 80% if calendar.plant_watered is yesterday, 60% if calendar.plant_watered is two days ago etc.

Or, if you water your plants every sunday, just create a template sensor that is < {low}% on sundays and > {low}% on all other days.

That will trigger the problem state, and any notifications you have bound to that will also work as expected.

@Olen
Copy link
Owner

Olen commented Feb 5, 2024

Just for my own convenience - I'll probably implement something similar for a few plants where I don't have a sensor.

Create an input_datetime.myplant_last_watered

Create a button.water_myplant

Create a template sensor sensor.myplant_soil_moisture The following is just a rough version that "counts down" from "max" to "min" over "frequency" days. Can obviously be improved.

{% set last = states('input_datetime.plant_last_watered')[:10] %}
{% set num_days = (today_at() - last | as_datetime | as_local).days %}
{% set max = 80 %}
{% set min = 0 %}
{% set frequency = 7 %}
{% set daily = (max - min) / frequency %}  
{% set current = int(max - (num_days * daily)) %}
{% if current < min %}
{% set current = min %}
{% endif %}
{{ current }}

This can then be used as the source sensor for a plant.

Create an automation:

alias: Water My Plant
trigger:
  - platform: state
    entity_id:
      - input_button.water_myplant
action:
  - service: input_datetime.set_datetime
    data:
      datetime: "{{ now().timestamp() | timestamp_local }}"
    target:
      entity_id: input_datetime.myplant_last_watered

So when you have watered your plant, just press the button and the fake moisture-sensor resets to "max", and starts counting down for every day.

@Olen Olen closed this as completed Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants