Whether or not you should create a template sensor boils done to whether you are going to be using this specific time in a variety of automations. If it’s a one-off, don’t bother with the template sensor but if you think you’ll need to use it in multiple automations it makes sense to set up a sensor.
Is there a reason you aren’t using an Input Datetime helper instead of two Input Numbers?
Unless there is a reason to do it that way I would use a datetime instead… However, if I needed to do it with your current setup the sensor, in the current format, would look like:
template:
- sensor:
- name: "Wake Time 1"
state: >
{{'{:02d}:{:02d}'.format(states('input_number.wakehour_1') | int, states('input_number.wakeminute_1') | int(0)) }}
availability: "{{ states('input_number.wakehour_1') | int('none') is number }}"
The set up of the second sensor depends on how you want to use it… do you want it to return the datetime of Wake Time 1 - 60 minutes or do you want a binary sensor that switches ‘on’ when it is reaches 60 minutes before Wake Time 1?
- sensor:
- name: "Wake Time 1 minus 60"
device_class: timestamp
state: >
{{ today_at(states('sensor.wake_time_1')) - timedelta(minutes=60) }}
availability: "{{ states('sensor.wake_time_1') not in ['unavailable','unknown'] }}"
- binary_sensor:
- name: "Wake Time 1 minus 60"
state: >
{{ now >= today_at(states('sensor.wake_time_1')) - timedelta(minutes=60) }}
availability: "{{ states('sensor.wake_time_1') not in ['unavailable','unknown'] }}"
Still getting an Template variable error: 'today_at' is undefined when rendering error and not sure how/where/why to use your availability lines. But am guessing that would solve it?
As Taras comment today_at() is a kind of recent addition. It was added in version 2021.11
The availability configuration variable is used when setting up sensors to avoid some types of errors as well as abnormal sensor states. This isn’t fully implemented yet, so the state template is still rendered (but not shown as the state). Because of this, some errors will still be posted to the log. As far as I know, you can not use it in automations.
Also, while not completely necessary in all cases, it can be a good practice to use >= instead of == when comparing datetimes. That way you do not have to have an exact match down to the microsecond.
Triggering only happens on the change of the rendered value, so when it changes from False to True. When now() updates at the start of every minute and the template renders as True, but it was already True it will not retrigger the automation.