ZHA - Aqara Switch Module T1 - MQTT Switch Type

Some of the switch modules have a setting to set the type of analogue wall switch you can use to trigger the switch module. The options are either toggle or momentary. In ZigbeetoMQTT it’s implemented by the “Switch_Type” command.

That looks like this in the Herdsman Adapter:

xiaomi_switch_type: {
key: [‘switch_type’],
convertSet: async (entity, key, value, meta) => {
const lookup = {‘toggle’: 1, ‘momentary’: 2};
value = value.toLowerCase();
utils.validateValue(value, Object.keys(lookup));
await entity.write(‘aqaraOpple’, {0x000A: {value: lookup[value], type: 0x20}}, manufacturerOptions.xiaomi);
return {state: {switch_type: value}};
},
convertGet: async (entity, key, meta) => {
await entity.read(‘aqaraOpple’, [0x000A], manufacturerOptions.xiaomi);
},
},

What would be the zigbee cluster setting for this attribute?

For example:

service: zha.set_zigbee_cluster_attribute
service data:
ieee: ‘84:2e:14:aa:bb:cc:eb:c0’
endpoint_id: 1
cluster_id: 513
attribute: 16387
cluster_type: out
value: 1
manufacturer: ‘4678’

It’s xiaomi specific and I don’t find it anywhere mentioned in any of the specifications…

From the code I would expect this data:

service: zha.set_zigbee_cluster_attribute
data:
ieee: 54:ef:44:10:00:20:06:9e
endpoint_id: 1
cluster_id: 64704
cluster_type: in
attribute: 10
value: 2

But it does not have any effect…

Did you solve this?

No, I installed a toggle switch :man_shrugging:

FYI, see this related “switch_type” development discussion for ZHA and zigpy here:

https://github.com/zigpy/zigpy/discussions/934

Summery is that ZHA developers are working on adding configuration to ZHA but you will probably still need a ZHA quirk in ZHA Device Handlers library/repository for the devices as well so submit request:

https://github.com/zigpy/zha-device-handlers/issues/1231

https://github.com/zigpy/zha-device-handlers/blob/b802c1fb2cf2682f9a4722bfb57a1958cad9dad7/README.md

https://www.home-assistant.io/integrations/zha#zha-exception-and-deviation-handling

This is also discussed here:

https://community.home-assistant.io/t/aqara-switch-module-t1-rebound-switch/345580/