Hi
I have a towel heater and I want it to be on and off let say from 6am to 9am on and off let say every 15 minutes or on 15 minutes off 10 minutes is there an easy way to do that?
I assume that the rail either gets too hot or its just hot enough if it is switched with a mark - space ?
It would be easier still if it were switched on every 15 minutes and off either 5, 7, 10 etc (you choose) later.
This could also be 20 mins (instead of 15, again you choose)
But only between 06:00 and 09:00
yes
use a “repeat until” in an automation.
set the trigger for 6 am and set the “until” for 9am
set the action turn on & off the heater in whatever sequence you want.
Perhaps something like this:
- alias: Example 1
trigger:
- platform: time
at:
- '06:00:00'
- '09:00:00'
action:
- choose:
- conditions: "{{ trigger.now.hour == 6 }}"
sequence:
- repeat:
while: "{{ now().hour < 9 }}"
sequence:
- service: switch.turn_on
entity_id: switch.towel_heater
- delay: '00:15:00'
- service: switch.turn_off
entity_id: switch.towel_heater
- delay: '00:10:00'
default:
- service: switch.turn_off
entity_id: switch.towel_heater
thank you but I do not see this options in my interface?
Do you mean you don’t see this in the Automation Editor? This is from version 0.118 but should be available in at least the last two versions.
So i added it to my script but it shows me error
bad indentation of a mapping entry at line 3, column 10:
trigger:
^
towel_morning:
alias: Towel_Morning
trigger:
- platform: time
at:
- '06:00:00'
- '09:00:00'
action:
- choose:
- conditions: "{{ trigger.now.hour == 6 }}"
sequence:
- repeat:
while: "{{ now().hour < 9 }}"
sequence:
- service: switch.turn_on
device_id: 7c8ececa46fe60108acf74b0b39ebb5c
entity_id: switch.towel_warmer_switch_83
- delay: '00:15:00'
- service: switch.turn_off
device_id: 7c8ececa46fe60108acf74b0b39ebb5c
entity_id: switch.towel_warmer_switch_83
- delay: '00:10:00'
default:
- service: switch.turn_off
entity_id: switch.towel_warmer_switch_83
You added it incorrectly. Your version isn’t the same as the one I posted.
Compare the first line of my example to the first two lines of your example. See the difference?
Yes i do see the difference but how can i make it compatible with the version i have got?
Where did this line come from (it’s not in the example I posted)?
towel_morning:
Did Home Assistant add it?
Or did you add it because all of your existing automations start with their name as the first line?
Last question: are you using a text editor to add the automation or the Automation Editor?
What I posted is an automation, not a script. That’s why you have received this error message because a script doesn’t contain a trigger:
bad indentation of a mapping entry at line 3, column 10:
trigger:
^
Your first post says:
I want it to be on and off let say from 6am to 9am on and off let say every 15 minutes or on 15 minutes off 10 minutes
Scripts cannot activate themselves at specific times of the day. That would require a Time Trigger and only automations support triggers.
The example I posted must be entered in the same place where you currently have all of your other automations.
So to add up I put it now in automations.yaml but than it does not show in automation lists?
Please see this is the last automation
- id: '1605522529347'
alias: Front door open too long
description: ''
trigger:
- platform: state
entity_id: binary_sensor.front_door_contact_sensor
from: 'off'
to: 'on'
for: '120'
condition:
- condition: state
entity_id: binary_sensor.ground_entry_motion_sensor
state: 'off'
action:
- type: turn_on
device_id: 5633174037c6788d22447da0a5ebab2b
entity_id: light.entrance_light_level_16
domain: light
brightness_pct: 100
- type: turn_on
device_id: 9117d5e1aa403dac392e5ececeb9a6bd
entity_id: switch.ground_floor_stairs_switch_68
domain: switch
- type: turn_on
device_id: 63ce054727c77b21c2f192b3cb2f95be
entity_id: switch.reception_stairs_switch_72
domain: switch
- type: turn_on
device_id: 2479ad6ef6c78741460efbc6e09f04fd
entity_id: switch.1st_floor_stairs_switch_60
domain: switch
mode: single
- id: '1605736195823'
alias: 'Wc lights on '
description: ''
trigger:
- platform: state
entity_id: binary_sensor.ground_toilet_motion_sensor
to: 'on'
from: 'off'
condition:
- condition: device
type: is_off
device_id: adb946916530fb987e90ed1a3fd6226b
entity_id: switch.ground_floor_toilet_light_switch_69
domain: switch
action:
- type: turn_on
device_id: 7298b583049cdb83486d352164ea31d0
entity_id: switch.ground_floor_toilet_mirror_switch_70
domain: switch
mode: single
- id: '1605736380964'
alias: WC Lights off
description: ''
trigger:
- platform: state
entity_id: binary_sensor.ground_toilet_motion_sensor
from: 'on'
to: 'off'
for: '90'
condition: []
action:
- type: turn_off
device_id: adb946916530fb987e90ed1a3fd6226b
entity_id: switch.ground_floor_toilet_light_switch_69
domain: switch
- type: turn_off
device_id: 7298b583049cdb83486d352164ea31d0
entity_id: switch.ground_floor_toilet_mirror_switch_70
domain: switch
mode: single
- id: '1605953015846'
alias: Utility room lights on
description: ''
trigger:
- platform: state
entity_id: binary_sensor.utility_pir_motion_sensor
from: 'off'
to: 'on'
condition:
- condition: device
type: is_off
device_id: 3917cc9c69a9818125b086a9837cd9ce
entity_id: switch.utility_room_light_switch_43
domain: switch
action:
- type: turn_on
device_id: 3917cc9c69a9818125b086a9837cd9ce
entity_id: switch.utility_room_light_switch_43
domain: switch
mode: single
- id: '1605953154001'
alias: Utility room lights off
description: ''
trigger:
- platform: state
entity_id: binary_sensor.utility_pir_motion_sensor
from: 'on'
to: 'off'
for: '180'
condition: []
action:
- type: turn_off
device_id: 3917cc9c69a9818125b086a9837cd9ce
entity_id: switch.utility_room_light_switch_43
domain: switch
mode: single
- id: '1605953388019'
alias: Lift on
description: ''
trigger:
- platform: time
at: '6:00'
condition: []
action:
- type: turn_on
device_id: 16e2c5581de736a64362eb8359c51c99
entity_id: switch.lift_switch_81
domain: switch
mode: single
- id: '1605953509626'
alias: Lift off
description: ''
trigger:
- platform: time
at: '23:30'
condition: []
action:
- type: turn_off
device_id: 16e2c5581de736a64362eb8359c51c99
entity_id: switch.lift_switch_81
domain: switch
mode: single
- id: '1605956999110'
alias: Patio lights on
description: ''
trigger:
- platform: state
entity_id: binary_sensor.kitchen_patio
from: 'off'
to: 'on'
condition:
- condition: sun
before: sunrise
after: sunset
- condition: device
type: is_off
device_id: 4775957bfffb85610aa6ae1812162970
entity_id: switch.patio_entrance_light_switch_75
domain: switch
- condition: device
type: is_off
device_id: 21a98da426583c28d788872757f9250a
entity_id: switch.patio_entrance_step_switch_76
domain: switch
- condition: device
type: is_off
device_id: 52cf69a90b6d4165ddd351884af92dd5
entity_id: switch.patio_wall_left_switch_73
domain: switch
- condition: device
type: is_off
device_id: fbd8c54af7b892db6d73643d1c16e6bd
entity_id: switch.patio_wall_right_switch_74
domain: switch
action:
- type: turn_on
device_id: 4775957bfffb85610aa6ae1812162970
entity_id: switch.patio_entrance_light_switch_75
domain: switch
- type: turn_on
device_id: 21a98da426583c28d788872757f9250a
entity_id: switch.patio_entrance_step_switch_76
domain: switch
mode: single
- id: '1605957232648'
alias: Patio lights off
description: ''
trigger:
- platform: state
entity_id: binary_sensor.kitchen_patio
from: 'on'
to: 'off'
for: '6000'
- platform: state
entity_id: binary_sensor.kitchen_rear_motion_sensor
from: 'on'
to: 'off'
for: '3000'
condition: []
action:
- type: turn_off
device_id: 4775957bfffb85610aa6ae1812162970
entity_id: switch.patio_entrance_light_switch_75
domain: switch
- type: turn_off
device_id: 21a98da426583c28d788872757f9250a
entity_id: switch.patio_entrance_step_switch_76
domain: switch
- type: turn_off
device_id: 52cf69a90b6d4165ddd351884af92dd5
entity_id: switch.patio_wall_left_switch_73
domain: switch
- type: turn_off
device_id: fbd8c54af7b892db6d73643d1c16e6bd
entity_id: switch.patio_wall_right_switch_74
domain: switch
mode: single
- id: '1605987924934'
alias: Entry in the dark
description: Front door opened when dark and no motion
trigger:
- platform: state
entity_id: binary_sensor.front_door_contact_sensor
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: binary_sensor.ground_entry_motion_sensor
state: 'off'
action:
- type: turn_on
device_id: 5633174037c6788d22447da0a5ebab2b
entity_id: light.entrance_light_level_16
domain: light
brightness_pct: 33
- type: turn_on
device_id: 9117d5e1aa403dac392e5ececeb9a6bd
entity_id: switch.ground_floor_stairs_switch_68
domain: switch
- type: turn_on
device_id: 63ce054727c77b21c2f192b3cb2f95be
entity_id: switch.reception_stairs_switch_72
domain: switch
mode: single
- id: '1606244255024'
alias: Patio lights on when Dinner
description: ''
trigger:
- platform: state
entity_id: binary_sensor.kitchen_rear_motion_sensor
from: of
to: 'on'
condition:
- condition: sun
before: sunrise
after: sunset
action:
- type: turn_off
device_id: 52cf69a90b6d4165ddd351884af92dd5
entity_id: switch.patio_wall_left_switch_73
domain: switch
mode: single
- id: '1606769630857'
alias: Towel_warmer_morning
description: ''
trigger:
- platform: time
at:
- '06:00:00'
- '09:00:00'
action:
- choose:
- conditions: "{{ trigger.now.hour == 6 }}"
sequence:
- repeat:
while: "{{ now().hour < 9 }}"
sequence:
- service: switch.turn_on
device_id: 7c8ececa46fe60108acf74b0b39ebb5c
entity_id: switch.towel_warmer_switch_83
- delay: '00:15:00'
- service: switch.turn_off
device_id: 7c8ececa46fe60108acf74b0b39ebb5c
entity_id: switch.towel_warmer_switch_83
- delay: '00:10:00'
default:
- service: switch.turn_off
entity_id: switch.towel_warmer_switch_83
domain: switch
mode: single
Probably because you added the automation but did not execute Reload Automations.
Go to Configuration > Server Controls and click Check Configuration. If it doesn’t report any errors, on the same page click Reload Automations. Now the new automation you added should appear in Configuration > Automations.
I did reload and it did not helped
I restared HA and it showed it in automation but not active and greyed out
What I believe you did not do is execute Check Configuration like I suggested. In addition, the automation you are using is not identical to my example (again).
When I paste your version into my system and execute Check Configuration, it fails.
Invalid config for [automation]: extra keys not allowed @ data[‘action’][0][‘domain’]. Got None
required key not provided @ data[‘action’][0][‘choose’][0][‘sequence’][0][‘repeat’][‘sequence’][0][‘domain’]. Got None. (See /config/configuration.yaml, line 16).
Here’s what I suggested to use:
while: "{{ now().hour < 9 }}"
sequence:
- service: switch.turn_on
entity_id: switch.towel_heater
- delay: '00:15:00'
- service: switch.turn_off
entity_id: switch.towel_heater
- delay: '00:10:00'
Here’s what you are using:
while: "{{ now().hour < 9 }}"
sequence:
- service: switch.turn_on
device_id: 7c8ececa46fe60108acf74b0b39ebb5c
entity_id: switch.towel_warmer_switch_83
- delay: '00:15:00'
- service: switch.turn_off
device_id: 7c8ececa46fe60108acf74b0b39ebb5c
entity_id: switch.towel_warmer_switch_83
- delay: '00:10:00'
See the difference? Your version contains device_id
which is not what I suggested to use. What you are trying to do is completely different. It also happens to be incomplete and that’s why Check Configuration indicated it is expecting the domain
option but “Got None” (and that’s not the only missing option).
If you would like my continued assistance, please follow the instructions I have provided and use the example without modifications.
How can buy you a beer?