Aqara H1 rotary dimmer?

Posted on
Wed May 31, 2023 5:23 pm
LSpad offline
Posts: 30
Joined: Oct 01, 2018

Aqara H1 rotary dimmer?

Hi there,

I’ve recently added an Aqara H1 rotary dimmer to my setup and I was wondering if there is any simple way to add a couple of parameters from its MQTT payload to the device state? At the moment the primary UI is the button press, but I need to access rotation_percent. How easy would it be to modify the dimmer remote device type to include the additional parameter?

Alternatively, is there any way to directly trigger actions from the MQTT payload using a python script?

Many thanks
Luke

Posted on
Thu Jun 01, 2023 2:00 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara H1 rotary dimmer?

Hi Luke,

LSpad wrote:
.... How easy would it be to modify the dimmer remote device type to include the additional parameter? ...

It should be fairly easy. If you can do a screen capture from MQTT Explorer showing the rotation_percent topic and post it here that would help.
I'll get onto it shortly. :)

EDIT: Can you confirm that this is the device: Aqara knob H1 (wireless) ?

Posted on
Thu Jun 01, 2023 2:08 am
FlyingDiver offline
User avatar
Posts: 7210
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Aqara H1 rotary dimmer?

I actually find it easier to enable debug logging on the Connector plugin and copy/paste the message info from the log. YMMV.


Sent from my iPhone using Tapatalk

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Jun 01, 2023 2:55 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara H1 rotary dimmer?

FlyingDiver wrote:
I actually find it easier to enable debug logging on the Connector plugin and copy/paste the message info from the log. YMMV.


Good point :)

Iit is also possible to do that from the Zigbee2mqtt plugin by turning on MQTT Topic Logging in the plugin config i.e.:
zigbee2mqtt_plugin_config.png
Zigbee2MQTT Plugin Config
zigbee2mqtt_plugin_config.png (54.56 KiB) Viewed 1657 times

Then edit the device settings for the Zigbee2MQTT Coordiantor device, select the Filter Zigbee Device Loggingsection, if not already selected. Then choose the device(s) to log e.g.
zigbee2mqtt_coordinator.png
Zigbee2MQTT Coordinator Filter
zigbee2mqtt_coordinator.png (89.3 KiB) Viewed 1657 times

Note: To select multiple devices, just use CMD-Click.

The output will be shown in the log which can then be copied and pasted here. :)

Posted on
Thu Jun 01, 2023 7:56 am
LSpad offline
Posts: 30
Joined: Oct 01, 2018

Re: Aqara H1 rotary dimmer?

Many thanks both,

The MQTT message is as follows:
Code: Select all
 Zigbee2mqtt Bridge Debug        MQTT logging for '0x54ef4410007f501c': Topic='zigbee2mqtt/0x54ef4410007f501c'
          Payload='{"action":"start_rotating","action_rotation_angle":24,"action_rotation_angle_speed":24,"action_rotation_percent":6.666666507720947,"action_rotation_percent_speed":6.666666507720947,"action_rotation_time":200,"device":{"applicationVersion":20,"friendlyName":"0x54ef4410007f501c","ieeeAddr":"0x54ef4410007f501c","manufacturerID":4151,"manufacturerName":"LUMI","model":"ZNXNKG02LM","networkAddress":49828,"powerSource":"Battery","type":"EndDevice"},"linkquality":255}'


Posted on
Thu Jun 01, 2023 8:01 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara H1 rotary dimmer?

Hi Luke,
Presumably the rotation goes from 0 to 100 and you can't go less than 0 or more than 100?
Have you got it currently defined as a dimmer device?

Posted on
Thu Jun 01, 2023 12:12 pm
LSpad offline
Posts: 30
Joined: Oct 01, 2018

Re: Aqara H1 rotary dimmer?

Hi Jon,
The percentage rotation goes from -100 to 100 (so it reports direction and percentage change in a single parameter)

So the effective control parameters are
action: single, double, hold, release, start_rotating, rotation, stop_rotating
action_rotation_percent: floating point number in the range -100 to 100

Thanks again for your help
Luke

Posted on
Thu Jun 01, 2023 2:50 pm
LSpad offline
Posts: 30
Joined: Oct 01, 2018

Re: Aqara H1 rotary dimmer?

Sorry - forgot to mention - yes it is currently defined as a remote (dimmer)

Posted on
Wed Jun 14, 2023 6:59 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara H1 rotary dimmer?

I have just pushed a pre-release update (Version 2023.0.67) to Github: Add Support For Aqara knob H1 (wireless)

This took longer than I hoped for due to being side-tracked by work on the Sonos plugin. ;)

I have tested it as best I can with the sample MQTT message you provided.

There is a new device type to use: Scene (Rotary)
You can select the Action [Scene Rotary] and Rotations properties when setting up the device.

When you press the knob etc, this will be shown in the action state for 1 second before reverting to a value of idle. The last button press type is recorded in the lastAction state. All the rotation states are avaiable in custom states e.g. rotation_angle etc.

This pre-release update requires that you do an update of cryptography to at least version 41.0.1 using the command:
Code: Select all
pip3.10 install --upgrade cryptography
Let me know how you get on it with it. :)

Posted on
Thu Jun 15, 2023 10:06 am
LSpad offline
Posts: 30
Joined: Oct 01, 2018

Re: Aqara H1 rotary dimmer?

Amazing - this works perfectly! Many thanks

Posted on
Thu Jun 15, 2023 10:58 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Aqara H1 rotary dimmer?

LSpad wrote:
Amazing - this works perfectly! Many thanks

Thanks for the update :)

Posted on
Thu Jun 15, 2023 1:42 pm
LSpad offline
Posts: 30
Joined: Oct 01, 2018

Re: Aqara H1 rotary dimmer?

Just to round off - for anyone else who want to use the Aqara dimmer (it's nice) then this code might be useful

Trigger type: Device state changed (set for 'device has any change')
Condition: Dimmer action contains 'rotat' [This isn't strictly necessary but may reduce overheads]
Actions: Execute Script

Code: Select all
current = indigo.variables[XXXX] #You'll need to create a current_dim_level variable and use it's ID here
target = indigo.variables[XXXX] #You'll need to create a target_dim_level variable and use it's ID here
knob = indigo.devices[XXXX] #This is the device ID of the Aqara dimmer
lamp = indigo.devices[XXXX] #This is the device ID of the dimmer module you want to control

if knob.states['action'] == 'start_rotating':
   indigo.variable.updateValue(current,value=str(lamp.brightness))

if 'rotati' in knob.states['action']:
   new = int(current.value) + round(knob.states['rotation_percent'])

   if(new>100):
      new = 100
   elif(new<0):
      new = 0

   indigo.variable.updateValue(target, value=str(new))
   indigo.dimmer.setBrightness(lamp, value=new)

if knob.states['action'] == 'stop_rotating':
   indigo.variable.updateValue(current, value=str(new))

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests

cron