Im getting the “Message malformed: extra keys not allowed @ data[‘0’]” error when trying to save my code for a new automation and I was wondering if any one knew how to fix this ill submit a picture of my code Thanks
Code:
-
alias: ‘Turn on lights when entering room’
trigger:
platform: state
entity_id: binary_sensor.door_window_sensor_window_door_is_open
to: ‘on’
condition:
condition: and
conditions:
- condition: state
entity_id: switch.smart_plug_socket_1
state: ‘off’
- condition: state
entity_id: binary_sensor.door_window_sensor_window_door_is_open
state: ‘on’
for: ‘00:00:05’
action:
service: light.turn_on
entity_id: switch.smart_plug_socket_1 -
alias: ‘Start timer when leaving room’
trigger:
platform: state
entity_id: binary_sensor.door_window_sensor_window_door_is_open
to: ‘off’
condition:
condition: state
entity_id: switch.smart_plug_socket_1
state: ‘on’
action:- service: timer.start
data:
entity_id: timer.time
duration: ‘00:10:00’
- service: timer.start
-
alias: ‘Stop timer when re-entering room’
trigger:
platform: state
entity_id: binary_sensor.door_window_sensor_window_door_is_open
to: ‘on’
condition:
condition: state
entity_id: timer.time
state: ‘active’
action:- service: timer.cancel
data:
entity_id: timer.time
- service: timer.cancel
-
alias: ‘Turn off lights when timer ends’
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.time
action:
service: light.turn_off
entity_id: switch.smart_plug_socket_1