I’m setting up something similar to BabyBuddy for my snakes. One of the things is a “quick input” keypad to set the dates for items (feeding, substrate changes, shedding). I currently have a six button keypad setup with ESPHome. I’ve got one button setup that is working, but I’m wondering if there’s a simpler way.
I have an automation when I hit button 1 to set an input_text sensor to the current date (MM/DD/YYYY).
alias: Blaidd Ate Date/Time
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.blaidd_keypad_bt_button_1
to: "on"
from: "off"
condition: []
action:
- service: input_text.set_value
metadata: {}
data:
value: "{{ as_timestamp(now())|timestamp_custom(\"%m/%d/%y\") }}"
target:
entity_id: input_text.blaidd_last_ate_date
mode: single
I then have a template sensor to keep track of how many days since the last feeding.
{% set delta = as_timestamp(now()) - as_timestamp(strptime(states("input_text.blaidd_last_ate_date"),"%m/%d/%y")) %}
{% set deltaRound = (delta/86400)|round(0,"floor") %}
{{ deltaRound }}
In addition to double-checking things. I’m trying to make sure nothing causes issues down the road. The plan will be to have automations setup to push a notification the day before the next feeding is due to thaw out their prey. I would like to be able to do statistics in the long run, but I have logs offloading to Splunk and should be able to just handle that in there.