So I upgraded to .19 and started getting the following error. homeassistant.components.automation: Please switch your condition configuration to use ‘condition’ instead of ‘platform’.
The blog on the new release is not very clear. Doing a search/replace of platform: with condition: doesn’t make sense and also generates new errors.
It would also lead to condition being used recursively.
# Turns on lights at sunset
- alias: 'Rule 3 Welcome Home light in kitchen'
trigger:
platform: state
entity_id: binary_sensor.stairwell_motion_sensor_4
from: 'off'
to: 'on'
condition:
- platform: state
entity_id: binary_sensor.basement_motion_sensor_5
state: 'on'
- platform: sun
after: sunset
action:
service: light.turn_on
entity_id: light.kitchen_dimmer_level_9
#Turns on lights at sunset
alias: 'Rule 3 Welcome Home light in kitchen'
trigger:
platform: state
entity_id: binary_sensor.stairwell_motion_sensor_4
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: binary_sensor.basement_motion_sensor_5
state: 'on'
- condition: sun
after: sunset
action:
service: light.turn_on
entity_id: light.kitchen_dimmer_level_9
just replacing platform when nested under condition generates lots of errors.
Here is my new automation.yaml file.
### Automation ###
#automation:
# Turns on lights at sunset
- alias: 'Rule 1 Light on in the evening'
trigger:
# Prefix the first line of each trigger configuration
# with a '-' to enter multiple
- platform: sun
event: sunset
offset: '-00:10:00'
action:
service: homeassistant.turn_on
entity_id: switch.front_step_light_switch_3
- alias: 'Rule 2 Light off in the morning'
trigger:
- platform: sun
event: sunrise
offset: '-00:19:00'
action:
service: homeassistant.turn_off
entity_id: switch.front_step_light_switch_3
# Turns on lights at sunset
- alias: 'Rule 3 Welcome Home light in kitchen'
trigger:
platform: state
entity_id: binary_sensor.stairwell_motion_sensor_4
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: binary_sensor.basement_motion_sensor_5
state: 'on'
- condition: sun
after: sunset
action:
service: light.turn_on
entity_id: light.kitchen_dimmer_level_9
#automation 2:
# Vacation mode for Kitchen light
- alias: 'Rule 4 Vacation Mode for Kitchen ON'
trigger:
platform: sun
event: sunset
offset: "-00:30:00"
condition:
condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
action:
service: light.turn_on
entity_id: light.kitchen_dimmer_level_9
# Vacation mode for Kitchen light
- alias: 'Rule 5 Vacation Mode for Kitchen OFF'
trigger:
platform: sun
event: sunset
offset: "+02:35:00"
condition:
condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
action:
service: light.turn_off
entity_id: light.kitchen_dimmer_level_9
# Vacation mode for Living Room light
- alias: 'Rule 6 Vacation Mode for Living Room ON'
trigger:
platform: sun
event: sunset
offset: "-00:38:00"
condition:
condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
action:
service: switch.turn_on
entity_id: switch.living_room_switch_7
# Vacation mode for Living Room light
- alias: 'Rule 7 Vacation Mode for Living Room OFF'
trigger:
platform: sun
event: sunset
offset: "+01:25:00"
condition:
condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
action:
service: switch.turn_off
entity_id: switch.living_room_switch_7
# Vacation mode for Great Room light
- alias: 'Rule 8 Vacation Mode for Great Room ON'
trigger:
platform: sun
event: sunset
offset: "+00:20:00"
condition:
condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
action:
service: switch.turn_on
entity_id: switch.great_room_lights_switch_6
# Vacation mode for Great Room light
- alias: 'Rule 9 Vacation Mode for Great Room OFF'
trigger:
platform: sun
event: sunset
offset: "+03:07:00"
condition:
condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
action:
service: switch.turn_off
entity_id: switch.great_room_lights_switch_6
# Vacation mode for Bedroom Room light
- alias: 'Rule 8 Vacation Mode for Bed Room ON'
trigger:
platform: sun
event: sunset
offset: "+02:35:00"
condition:
condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
action:
service: switch.turn_on
entity_id: switch.master_bedroom_switch_8
# Vacation mode for Great Room light
- alias: 'Rule 9 Vacation Mode for Great Room OFF'
trigger:
platform: sun
event: sunset
offset: "+03:50:00"
condition:
condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
action:
service: switch.turn_off
entity_id: switch.master_bedroom_switch_8
=======================
Error log
Home Assistant
0.19
Developed by a bunch of awesome people.
Published under the MIT license
Source: server — frontend-ui — frontend-core
Built using Python 3, Polymer 1.4.0, NuclearJS 1.3.0
Icons by Google and MaterialDesignIcons.com.
The following errors have been logged this session:
16-05-07 22:04:50 homeassistant.components.automation: Please switch your condition configuration to use 'condition' instead of 'platform'.
16-05-07 22:04:50 homeassistant.components.automation: Please switch your condition configuration to use 'condition' instead of 'platform'.
16-05-07 22:04:50 homeassistant.components.automation: Please switch your condition configuration to use 'condition' instead of 'platform'.
16-05-07 22:04:50 homeassistant.components.automation: Please switch your condition configuration to use 'condition' instead of 'platform'.
16-05-07 22:04:50 homeassistant.components.automation: Please switch your condition configuration to use 'condition' instead of 'platform'.
16-05-07 22:04:50 homeassistant.components.automation: Please switch your condition configuration to use 'condition' instead of 'platform'.
16-05-07 22:04:50 homeassistant.components.automation: Please switch your condition configuration to use 'condition' instead of 'platform'.
16-05-07 22:04:50 homeassistant.components.automation: Please switch your condition configuration to use 'condition' instead of 'platform'.
16-05-07 22:04:50 homeassistant.components.automation: Please switch your condition configuration to use 'condition' instead of 'platform'.
16-05-07 22:04:50 homeassistant.components.automation: Please switch your condition configuration to use 'condition' instead of 'platform'.
16-05-07 22:05:13 netdisco.ssdp: Found malformed XML at http://10.0.1.211:9080: status=ok
16-05-07 22:16:51 homeassistant.core: BusHandler:Exception doing job
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 801, in job_handler
func(arg)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/discovery.py", line 55, in discovery_event_listener
if event.data[ATTR_SERVICE] in service:
KeyError: 'service'
16-05-07 22:16:51 homeassistant.core: BusHandler:Exception doing job
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 801, in job_handler
func(arg)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/discovery.py", line 55, in discovery_event_listener
if event.data[ATTR_SERVICE] in service:
KeyError: 'service'
16-05-07 22:16:51 homeassistant.core: BusHandler:Exception doing job
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 801, in job_handler
func(arg)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/discovery.py", line 55, in discovery_event_listener
if event.data[ATTR_SERVICE] in service:
KeyError: 'service'
16-05-07 22:16:51 homeassistant.core: BusHandler:Exception doing job
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 801, in job_handler
func(arg)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/discovery.py", line 55, in discovery_event_listener
if event.data[ATTR_SERVICE] in service:
KeyError: 'service'
16-05-07 22:16:51 homeassistant.core: BusHandler:Exception doing job
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 801, in job_handler
func(arg)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/discovery.py", line 55, in discovery_event_listener
if event.data[ATTR_SERVICE] in service:
KeyError: 'service'
16-05-07 22:16:51 homeassistant.core: BusHandler:Exception doing job
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 801, in job_handler
func(arg)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/discovery.py", line 55, in discovery_event_listener
if event.data[ATTR_SERVICE] in service:
KeyError: 'service'
Thanks! Here is my automation.yaml file which generates the slew of errors. The only change from version 0.18.2 was to change the nested platform statements to condition after upgrading to version 0.19.
Looks to me like you have got your formatting wrong on the first few automations
the ‘-’ prefix should line up with ‘trigger’ on the next line (not 2 spaces in). Also the ‘-’ prefix is necessary only for multiples
I usually like to split each automation into a separate yaml file so I know exactly which one is causing issues. Also google ‘yaml parser’ & test any code before uploading to HA
Thanks. They all passed the yaml parser, but apparently the 0.19 release is a bit more finicky. So clearing out the extra spaces (once again) did the trick and also allowed me to replace the appropriate ‘platform:’ statements with ‘condition:’
I thought you couldn’t break up the sections into multiple include files.
So do you set this up like this?:
I also got stuck on this one, notably with “or” conditions. In case it helps, a lot messing about using good ol’ guessing and the trial and error method (based on an example) led me to the following which I finally got HA to accept. (I haven’t seen if it actually works yet!)
automation 2:
alias: Turn on lights when arriving
condition: or
conditions:
- condition: time
before: 06:00
- condition: time
after: 22:00
trigger:
platform: template
value_template: "{% if is_state('device_tracker.1000180', 'home') %}true{% endif %}"
action:
service: homeassistant.turn_on
entity_id: group.Arrival
Actually, @danichispa, I started with quotes and removed them thinking that the single-quote might be posing a problem. There is no difference in behavior based on the quotes.
I have to confirm the same situation as @sfiorini… The warnings tell you that condition_type is deprecated and to change platform to condition. When doing so using the syntax above, HA accepts it in the configuration file, but the automation does not run. The log then contains the following error, and the automation block is apparently not loaded.
ERROR:homeassistant.bootstrap:Invalid config for [automation]: invalid list value @ data[‘condition’][0] (See /Users/myname/.homeassistant/configuration.yaml:82)
The only way to make it work is to go back to condition_type and platform and to live with the warnings. (It seems that the code for the configuration parser and for the actual loading or execution are out of sync in this update.)