I am trying to get this automation to work but have an error Message malformed: extra keys not allowed @ data[‘action’][0][‘then’]
Could someone tell me how to fix it?
alias: “Automation: Cheap Rate Charge”
description: “”
trigger:
- platform: time_pattern
minutes: /30 - platform: state
entity_id:- binary_sensor.cheap_electricity_rate
condition:
action:
- binary_sensor.cheap_electricity_rate
- if:
- condition: and
conditions:- condition: template
value_template: >
{{ ‘AGILE’ in
state_attr('sensor.octopus_energy_electricity_21e5284972_2000003857896_current_rate,
‘tariff’) }- condition: state
entity_id: binary_sensor.cheap_electricity_rate
state: “on”
then:
- condition: state
- condition: template
- device_id: 0d1fbc36970e9c9509798e8e3ce6e0a1
domain: number
entity_id: bacd900015a4b2b1c80c263c6dff18a2
type: set_value
value: 100 - service: switch.turn_on
data: {}
target:
entity_id: switch.givtcp_sa2244g426_enable_charge_schedule - service: notify.mobile_app_sm_s908b
data:
title: Battery Charging
message: Rate Below Target
else: - if:
- condition: state
entity_id: binary_sensor.octopus_energy_target_dynamic_import
state: “off” - condition: state
entity_id: switch.givtcp_****_enable_charge_schedule
state: “on”
then: - service: switch.turn_off
data: {}
target:
entity_id: switch.givtcp_sa2244g426_enable_charge_schedule
mode: single
- condition: state
- condition: and