Boolean Toggle On Attribute

The Aqara button’s clicks are listed as attributes when you click them; single and double.

Can someone show me what an attribute toggling a boolean would look like? Or how wrong this is?

- alias: Pashovksi Button Boolean
  trigger:
    platform: attribute
    entity_id: sensor.pashovski_button_action
    to: 'single'
  action:
    service: input_boolean.toggle
    entity_id: input_boolean.washer_clean

The problem with the above automation could be that you should have used the trigger type state and in attributes select the particular attribute of the sensor which shows single or double clicks.

Actually instead of using an automation and input_boolean for this, you can use a single template sensor which can combine both these functions together. Please try this.

binary_sensor:
  - platform: template
    sensors:
      aqara_single:
        friendly_name: Aqara Single Click
        value_template: "{{ is_state_attr('sensor.pashovski_button_action', 'click_type', single) }}"

Please note that the attribute I have set in this template is click_type, if this is different for your sensor please change it accordingly.

There is no “attribute” trigger platform.

If you do only want to toggle the boolean then you need to use a template trigger since the attributes aren’t available (as far as I know) for use in the state trigger. but I believe they are in the UI created automations. But I don’t use those so I just use a template trigger to get the same functionality.

Here is how that would look:

trigger:
  platform: template
  value_template: "{{ state_attr('sensor.pashovski_button_action', 'click_action') == 'single' }}"

or you can use the “is_state_attr” form of the template from above directly in the trigger template.