The wife wanted a way to switch on the slow cooker at a set time, our slow cooker doesnt have a timer built in so using a Sonoff switch i have created a really basic timer so we can switch the slow cooker on at an adjustable time.
The timer consists of an Input Select with a list of times, an input boolean for enabling the timer and the automation requires the time sensor (although i think you can do this without that sensor but it easier with it)
Input_Select:
switch_1_timer_select:
name: Timer Start Time
options:
- '08:00'
- '08:30'
- '09:00'
- '09:30'
- '10:00'
- '10:30'
- '11:00'
- '11:30'
- '12:00'
- '12:30'
- '13:00'
- '13:30'
- '14:00'
- '14:30'
- '15:00'
- '15:30'
icon: mdi:timer
Input_Boolean:
switch_1_timer_input:
name: Enable Timer
icon: mdi:clock-start
Automation:
- alias: 'Timer Switch 1 On'
initial_state: true
trigger:
- platform: time
minutes: '/1'
seconds: '0'
condition:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.switch_1_timer_input
state: 'on'
- condition: template
value_template: '{{ states.input_select.switch_1_timer_select.state == states.sensor.time.state }}'
action:
- service: switch.turn_on
entity_id: switch.sonoff_power_1
- service: notify.ios_iPhone
data:
message: 'Sonoff Switch 1 has been switched on based on the timer.'
- service: input_boolean.turn_off
data:
entity_id: input_boolean.switch_1_timer_input
The automation runs every minute and compares the current time against the time in the input select. If they match and the input_boolean has been enabled the automation triggers switching on the Sonoff, sending an alert to my phone and then switches off the input boolean so it doesnt run again.
Like i said, its basic but might be useful for someone else.