cburbs
(cburbs)
March 14, 2024, 7:49pm
1
So I think this is the best way to do this but when I click on the button to reset filter it should do the following:
Reset filter date to today
Write info to file (current date, AC Filter changed)
In my config.yaml file I have:
script: !include_dir_merge_list scripts/
for the script I was trying just to get the first part work.
ac_filter_changed:
alias: AC_Filter_Changed
sequence:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.air_filter_installed
data:
date: '{{ as_timestamp(now())|timestamp_custom(''%Y-%m-%d'') }}'
Then my Automation file would be:
- alias: AC - Set change date to today
description: ''
action:
- service: script.ac_filter_changed
But the script part isn’t working yet.
why are you doing this through raw yaml file manipulation? you could do all of it except 1 line via the ui.
simple way to set to today’s date.
alias: AC_Filter_Changed
sequence:
service: input_datetime.set_datetime
data:
date: "{{ now().date() }}"
target:
entity_id: input_datetime.test_date
the automation can be this… not sure why you have it separate in the script. you could just put the contents of the script in the automation and not have a separate script.
description: ""
mode: single
trigger: []
condition: []
action:
- service: script.ac_filter_changed
metadata: {}
data: {}
cburbs
(cburbs)
March 14, 2024, 8:11pm
3
Didn’t realize you could do multiple actions in a Automation but yep it can be done.
Just overlooked that for some reason.
Makes it easier to manage then as well. Thanks!
Can you clarify what you are trying to do…?
Are you talking about a button entity or a Dashboard button?
Did you leave out the trigger for expediency or because you aren’t using one? If you don’t have a trigger, you don’t need an automation.
cburbs
(cburbs)
March 14, 2024, 8:18pm
5
Was playing around with a setup similiar to this - Tracking water softener, water and air filters in Home Assistant » Deadlypenguin
But I want the reset filter button to do two things -
reset the date to current when changed and write to a file.
Got it working in the automation again didn’t realize more than one action could be done.