I’m trying to replace an app my wife and I use to log various activities for our dogs.
When you open the app, you have a number of buttons for different activities:
Bathroom trip
Walk
Food
Water
Medication
Treat
When you click on the activity, it asks you which dog did the activity:
Dog 1
Dog 2
Both
Once that’s done, it creates a log entry on the main page of the app with a timestamp, the dog’s name, and the activity.
I’m trying to figure out if it’s possible to do something like this within Home Assistant. I’ve seen the “Logbook” card, but it seems to be based on one or more entities, and I’m not certain if I can create “blank” entities, that I can use a button to update.
Definitely open to suggestions. I’ve tried searching, but I wasn’t able to find anything related to what I’m doing. Admittedly, it’s a bit of an odd request.
Simplest approach could be to create multiple helpers and use its data in a service call.
input_select for the activities
input_button for your doggies ( dog1, dog2, both)
Create a Grid Card with 3 Button Cards.
Every Button Card gets a tap action with a service call:
type: button
entity: input_button.dog1
name: Dog 1
icon: mdi:dog
icon_height: 42px
show_name: true
show_icon: true
tap_action:
action: call-service
service: logbook.log
service_data:
name: Dog Diary
message: |
{% set time = as_timestamp(states('input_button.dog1') |timestamp_custom('%d.%m.%Y, %R Uhr', now() ) %}
{% set dog = state_attr('input_button.dog1', 'friendly_name') %}
{% set activity = states('input_select.dog_activities') %}
{{ dog }}: {{ activity }} | {{ time }}
domain: input_button
entity_id: input_ button.dog1
Of course the above can also be done via automation.
Note that if you want to use the logbook function and you have configured the recorder integration, you have to include the entities above. And if you purge your database the logbook entries will be purged, too.
Thanks @pedolsky, that’s exactly what I was looking for. I’m going to play around with it this weekend. I have the recorder set up with an external database already, so I’m good to go there; but I’ll definitely look into the file option if I want to keep the history for longer than my standard retention.
With a little automation, you can also recreate the function of the app in principle. Instead of an input select 5 buttons and a State Filter Card /Conditional Card, which displays the Grid Card when one of the buttons is pressed.
And thanks for inspiration, I’ve been thinking about building something similar for our kitty cats for a while.