Hi. Hassio with conbee and deconz. Power plug innr sp120. Power plug has manual turn on / off button. Requirement is to turn on and off during specific time events. And if it is turned on manually then turn it of after two hours.
My approach:
- alias: TowelHeater ON
trigger:
- platform: time
at: '05:00:00'
condition:
condition: time
weekday: [mon, tue, wed, thu, fri]
action:
service: homeassistant.turn_on #switch.turn_on
entity_id:
- switch.TowelHeater
- input_boolean.TowelHeater_onbyautomation
- alias: TowelHeater OFF
trigger:
- platform: time
at: '06:50:00'
condition:
condition: time
weekday: [mon, tue, wed, thu, fri]
action:
service: homeassistant.turn_off #switch.turn_off
entity_id:
- switch.TowelHeater
- input_boolean.TowelHeater_onbyautomation
- alias: TowelHeater outlet on event
trigger:
- platform: state
entity_id: switch.TowelHeater
from: 'off'
to: 'on'
condition:
condition: state
entity_id: input_boolean.TowelHeater_onbyautomation
state: 'off'
action:
- service: notify.myHomenotify
data_template:
message: "Towel heater manual outlet event {{ trigger.to_state.state }} triggered for 2 hours" #trigger.to_state.state - only state (on / off) output
- delay: '02:00:00'
- service: homeassistant.turn_off #switch.turn_off
entity_id: switch.TowelHeater
Questions:
- Can I do it without input_boolean.TowelHeater_onbyautomation ?
- Any general logic comments. It also works quirky sometimes: when turning on it turns of within few seconds
- Can I make this part as separate method and call it with one line on other automations:
- service: notify.myHomenotify
data_template:
message: “Towel heater manual outlet event {{ trigger.to_state.state }} triggered for 2 hours” #trigger.to_state.state - only state (on / off) output