I’m trying to integrate these Aqara switches and can’t seem to get them to show a state change in HA.
Below is my package for it. I’m trying to keep track of the last command sent to control the curtains with the input_boolean
. But I’ve also tried just having the excerpt from the component and it fails to register the click.
I have verified that HA is able to communicate with the gateway via the xiaomi_aqara.play_ringtone
service on the services tab but it does log Got error element in data {"error":"Invalid key"}
.
Any ideas where I can look?
# curtains package
input_boolean:
curtainssmartswitch:
initial: off
switch:
- platform: template
switches:
curtainssmartswitch:
friendly_name: Curtain Smart Switch
value_template: "{{ is_state('input_boolean.curtainssmartswitch', 'on') }}"
turn_on:
service: input_boolean.turn_on
data:
entity_id: input_boolean.curtainssmartswitch
turn_off:
service: input_boolean.turn_off
data:
entity_id: input_boolean.curtainssmartswitch
- platform: template
switches:
bedroomcurtains:
value_template: "{{ is_state('switch.bedroomcurtains', 'on') }}"
turn_on:
service: script.turn_on
data:
entity_id: script.curtains_open
turn_off:
service: script.turn_on
data:
entity_id: script.curtains_close
automation:
- alias: curtains_open
trigger:
- platform: state
entity_id: input_boolean.curtainssmartswitch
to: 'on'
action:
- service: script.curtains_open
- alias: curtains_close
trigger:
- platform: state
entity_id: input_boolean.curtainssmartswitch
to: 'off'
action:
- service: script.curtains_close
- alias: Curtains Smart Button Toggle
trigger:
platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d00019cd406
click_type: single
action:
service: switch.toggle
entity_id: switch.curtainssmartswitch
- alias: Curtains Smart Button Stop
trigger:
platform: event
event_type: click
event_data:
entity_id: binary_sensor.switch_158d00019cd406
click_type: double
action:
service: switch.on
entity_id: switch.curtains_stop