Hi, many thanks for your reply, yes I did indeed sort it and I’ve been meaning to post my solution for some time. I used a timer as you mentioned.
- I created an input select helper for choosing the duration:
- I created a timer helper which I can set and reset using an automation:
- Created an automation which triggers when a certain input is selected. This in turn sets a timer to the desired time and once counted down it turns off. I also included a few notifications.
alias: Maiden Options
description: ""
trigger:
- platform: state
entity_id:
- input_select.maiden
id: "Off"
to: "Off"
- platform: state
entity_id:
- input_select.maiden
id: 1 Hour
to: 1 Hour
- platform: state
entity_id:
- input_select.maiden
id: 2 Hours
to: 2 Hours
- platform: state
entity_id:
- input_select.maiden
id: 3 Hours
to: 3 Hours
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.timer_maiden
id: Timer Finish
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- "Off"
sequence:
- service: timer.finish
data: {}
target:
entity_id: timer.timer_maiden
- type: turn_off
device_id: x
entity_id: x
domain: switch
- device_id: x
domain: mobile_app
type: notify
message: "Off"
title: "Maiden:"
- device_id: x
domain: mobile_app
type: notify
title: "Maiden:"
message: "Off"
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
enabled: false
- type: turn_off
device_id: x
entity_id: x
domain: switch
enabled: false
- conditions:
- condition: trigger
id: 1 Hour
sequence:
- service: timer.start
data:
duration: "3600"
target:
entity_id: timer.timer_maiden
- type: turn_on
device_id: x
entity_id: x
domain: switch
- device_id: x
domain: mobile_app
type: notify
message: 1 hour started
title: "Maiden:"
- device_id: x
domain: mobile_app
type: notify
message: 1 hour started
title: "Maiden:"
enabled: true
- conditions:
- condition: trigger
id: 2 Hours
sequence:
- service: timer.start
data:
duration: "7200"
target:
entity_id: timer.timer_maiden
- type: turn_on
device_id: x
entity_id: x
domain: switch
- device_id: x
domain: mobile_app
type: notify
message: 2 hours started
title: "Maiden:"
- device_id: x
domain: mobile_app
type: notify
message: 2 hours started
title: "Maiden:"
enabled: true
- conditions:
- condition: trigger
id: 3 Hours
sequence:
- service: timer.start
data:
duration: "10800"
target:
entity_id: timer.timer_maiden
- type: turn_on
device_id: x
entity_id: x
domain: switch
- device_id: x
domain: mobile_app
type: notify
message: 3 hours started
title: "Maiden:"
- device_id: x
domain: mobile_app
type: notify
message: 3 hours started
title: "Maiden:"
enabled: true
- conditions:
- condition: trigger
id:
- Timer Finish
sequence:
- service: input_select.select_option
data:
option: "Off"
target:
entity_id: input_select.maiden
- type: turn_off
device_id: x
entity_id: x
domain: switch
- device_id: x
domain: mobile_app
type: notify
message: FINISHED
title: "Maiden:"
- device_id: x
domain: mobile_app
type: notify
message: FINISHED
title: "Maiden:"
mode: single
Added this to a dashboard and hey presto, all good! The wife is now happy the maiden is not burning electricity for hours until she remembers to turn it off.