cobshopgrow
Well-Known Member
Well, who dont like to know how many days the plants are in flower?
many ways to do it, If you have a homeassistant running anyway its quite easy to let him do the counting for you.
insert this in your configurations.yaml first.
and this to your configurations.yaml
after a restart you should have a "Plant Blooming Days" sensor counting you the days.
you can set the start date under "configurations" "devices" "helpers".
if you want a reset button for the days, like me, you need to add this to your configurations.yaml also
and this to your automations.yaml
restart and you will have a "Reset Plant Blooming Days Counter" Button also which sets you the day counter to zero.
simple but usefull, hope it helps.
many ways to do it, If you have a homeassistant running anyway its quite easy to let him do the counting for you.
insert this in your configurations.yaml first.
YAML:
input_datetime:
plant_blooming_start:
name: Start of plant blooming
has_date: true
has_time: false
YAML:
sensor:
- platform: template
sensors:
plant_blooming_days:
friendly_name: 'Plant Blooming Days'
value_template: >
{% set bloom_start = states('input_datetime.plant_blooming_start') %}
{% if bloom_start %}
{% set bloom_date = strptime(bloom_start, '%Y-%m-%d') %}
{{ ((now().replace(tzinfo=None)) - bloom_date).days }}
{% else %}
'unknown'
{% endif %}
icon_template: mdi:flower
unit_of_measurement: 'Days'
you can set the start date under "configurations" "devices" "helpers".
if you want a reset button for the days, like me, you need to add this to your configurations.yaml also
YAML:
input_boolean:
reset_plant_blooming_counter:
name: Reset Plant Blooming Counter
initial: off
icon: mdi:restart
YAML:
- alias: "Reset Plant Blooming Days Counter"
trigger:
- platform: state
entity_id: input_boolean.reset_plant_blooming_counter
to: 'on'
action:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.plant_blooming_start
data:
date: "{{ now().strftime('%Y-%m-%d') }}"
- service: input_boolean.turn_off
target:
entity_id: input_boolean.reset_plant_blooming_counter
simple but usefull, hope it helps.
Last edited: