Aqara knob H1 (wireless) automations

LOL. No worries. I don’t think this can actually be Blueprinted, as you need to create the Helpers.

@fir3drag0n @Majly @ZFamil @Sauerkrautauflauf @matt2468 Maybe my automation will work for you?

nope. I think its glitch on my firmware for usb stick (sonoff P .zstack 3.version 20210708)
when I receive a new sonoff-p, Im upgrade firmware and test it again

well. I make it.


alias: Столовая. Регулятор яркости люстры
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.0x54ef44100065408f_action_rotation_percent
    from: unknown
condition: []
action:
  - service: light.turn_on
    data_template:
      brightness: >-
        {{((state_attr('light.yeelight_ceiling10_0x179c3344','brightness')|int(1))+((trigger.to_state.state|float(2))/2.55)|round(2)*3)|int(1)}}
    target:
      entity_id: light.yeelight_ceiling10_0x179c3344
    enabled: true
mode: single
4 Likes

This works soooo well, @ZFamil! Thank you so much for sharing. You made my day, you cannot imagine.
I have been struggling with that knob for 2 months now, and I regretted every penny I spent to buy it. Now it works perfectly, thanks to you and @robertwigley. I owe you both lunch! :slight_smile:

Someone should share this code with zigbee2mqtt, this should be included in the instructions for the device, because so far, I haven’t seen anything else that works.

Thanks again!!

2 Likes

Thanks for the tag ill give it a try over the weekend!

So I’ve given this a shot however I seem to be getting this error at the bottom part

Error: Error rendering data template: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'action_rotation_angle_speed'

this is the automation ive got

alias: Matt - Dim lamps test
description: ""
trigger:
  - platform: state
    entity_id: sensor.xxx_switch_action
    to:
      - start_rotating
      - rotation
action:
  - service: light.turn_on
    target:
      entity_id: light.xxx_lamps
    data:
      brightness_step_pct: >-
        {%- if ((trigger.to_state.attributes.action_rotation_angle_speed | int /
        24) | abs) < 1 -%}
          {{ trigger.to_state.attributes.action_rotation_angle | int / 12 }}
        {%- else -%}
          {{ (trigger.to_state.attributes.action_rotation_angle | int / 12) * ((trigger.to_state.attributes.action_rotation_angle_speed | int / 24) | abs) }}
        {%- endif -%}
mode: single
max_exceeded: silent

And then when I look in the states area I see this

Are you using ZHA rather than Zigbee2MQTT? It looks like the attributes are not exposed on sensor.xxx_switch_action.

While you are in Deveoper Tools and States, turn the knob and see if anything else populates for it. If not, the automation will need to be modified to use sensor.xxx_switch_action_rotation_angle and sensor.xxx_switch_action_rotation_angle_speed rather than using trigger.to_state.attributes.action_rotation_angle and trigger.to_state.attributes.action_rotation_angle_speed.

I am not able to test or check this as I am not using ZHA. I am assuming you are as I can’t think why else the attributes are not being exposed.

Nah I’m on z2m but I added the device quite some time ago maybe they’ve changed it since because I’ve always had the attributes separated out :open_mouth: ill give it a repair and see if there is any change otherwise ill go with hard coding them in

I think its glitch on z2m, because its not show correctly current percent rotation WITHOUT CLICK.
but if you press to button and continue rotate, then you see a digits
change your trigger to

trigger:
  - platform: state
    entity_id:
      - sensor.0x54ef44100065408f_action_rotation_percent
    from: unknown

and it’s work

That’s strange. I don’t see that behaviour. I wonder if it’s related to the Zigbee coordinator. I’m using a Conbee II.

I’ve made two blueprints for this device:

1 Like

Don’t work in my system (
Select is empty
Aqara H1 Rotary Dial
Select the rotary dial you wish to use

But I have a couple of this dimmers (
What I doing wrong ?

Ah, are you using Z2M? This blueprint is for ZHA, sorry.

Ah, realy ?
Yes, I using Z2M )
I was inattentive ) Thanks !

Thank you, that’s awesome !
I would like to adapt it to my needs but I got this error message before modifying anything (after replacing entities, id’s and scenes also) :

Message malformed: extra keys not allowed @ data['0']

Do you know why? I’m beginning with YAML…

Thanks

hi @ robertwigley

when i use your code, the light turn on an off but the brightness not change.

thanx a lot @robertwigley !
I was looking for this for ages. Finaly found this Aqara H1 and with your automation it feels really intuitive!

grtz
Bart

Do you solve you problem with attributes ?

Thanks to everyone that has contributed to this post! I was able to get things working pretty intuitively for my H1 knob. Is there any chance anybody has solved how to change color temperature in place of brightness? When I try with the following it doesn’t work, but with brightness it works just fine.

service: light.turn_on
data:
  color_temp: >-
    {{ ((state_attr('light.living_room_normal','color_temp')|int(1)) + ((trigger.to_state.state|float(2))/2.55)|round(2)*3)|int(1) }}
target:
  entity_id: light.living_room_normal
enabled: true