I have a number of appliances I want to do this for, but at the moment I want to start with my 3D printer. I want to setup something like a car’s maintenance schedule where I would get a “10 hour” alert and “100 hour” alert to do different types of maintenance. Once I have completed the appropriate tasks I would then call a service that would mark the maintenance repeat and restart the periods.
I’m currently able to monitor the printer status via MQTT and one of the possible state values is “printing”. Using history_stats I can determine how many total hours it has been in the printing status. I then setup a number helper that will store the “last_maintenance” value. My idea is that I will set this to the current total hours each time I do maintenance. I also have a template helper that returns (total_hours - last_maintenance_hours). This works and I can view the number of hours since the value stored in the last_maintenance_hours number helper.
From the developer tools I can call a service:
service: input_number.set_value
data:
value: "{{ states('sensor.bambu_printing_total') }}"
target:
entity_id: input_number.last_bambu_maintenance
This works from developer tools and sets the helper to the current value for total hours. However, when I try to add that to the tap action of a button it creates the button. When I tap the button I get the following error:
Failed to call service input_number/set_value. expected float for dictionary value @ data['value']
The button config:
show_name: true
show_icon: true
type: button
tap_action:
action: call-service
service: input_number.set_value
data:
value: '{{ states(''sensor.bambu_printing_total'') }}'
target:
entity_id: input_number.last_bambu_maintenance
name: Bambu Maintenance
icon: mdi:alert-circle-check-outline
entity: sensor.bambu_time_remaining
show_state: true
Any ideas on where I’m going wrong or how I can get around this? Am I going to have issues with this method in the long run as I reach the end of the recorder history?
Thanks