# Mehr Werte mit Xiaomi Zigbee-Tastern erfassen

**URL:** <https://community.gladysassistant.com/t/capturer-plus-de-valeurs-avec-les-boutons-zigbee-xiaomi/8236>\
**Category:** Demandes livrées\
**Created:** [30. Juni 2023 um 09:53 UTC](https://community.gladysassistant.com/t/capturer-plus-de-valeurs-avec-les-boutons-zigbee-xiaomi/8236 "2023-06-30T09:53:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hizo](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Hizo](https://community.gladysassistant.com/u/Hizo)\
**Post date:** [30. Juni 2023 um 09:53 UTC](https://community.gladysassistant.com/t/capturer-plus-de-valeurs-avec-les-boutons-zigbee-xiaomi/8236/1 "2023-06-30T09:53:55Z")

</div>

Hallo,

Der Xiaomi Zigbee-Knopf [WXKG01LM](https://www.zigbee2mqtt.io/devices/WXKG01LM.html#xiaomi-wxkg01lm) bietet mehr Aktionen an, als Gladys derzeit unterstützt.

Zigbee2MQTT erkennt die folgenden Zustände: `single`, `double`, `triple`, `quadruple`, `hold`, `release`, `many`

Gladys kennt nur die Werte: 1 (Klick), 2 (Doppelklick), 5 (Langdruck)

Könnten diese neuen Möglichkeiten bitte hinzugefügt werden?

Danke

* * *

Ich habe die Idee, dass die folgenden Dateien geändert werden müssten, bin mir aber nicht sicher:  
server/services/zigbee2mqtt/exposes/enumType.js

```auto
 addMapping('action', BUTTON_STATUS.CLICK, 'single');
 addMapping('action', BUTTON_STATUS.DOUBLE_CLICK, 'double');
 addMapping('action', BUTTON_STATUS.TRIPLE_CLICK, 'triple');
 addMapping('action', BUTTON_STATUS.QUADRUPLE_CLICK, 'quadruple');
 addMapping('action', BUTTON_STATUS.MANY_CLICK, 'many');
 addMapping('action', BUTTON_STATUS.HOLD_CLICK, 'hold');
 addMapping('action', BUTTON_STATUS.LONG_CLICK, 'long');

```

et die Datei server/test/services/zigbee2mqtt/exposes/actionEnumType.test.js

```auto
const { assert } = require('chai');

const enumType = require('../../../../services/zigbee2mqtt/exposes/enumType');
const { BUTTON_STATUS } = require('../../../../utils/constants');

describe('zigbee2mqtt action enumType', () => {
  const expose = {
    name: 'action',
    values: ['single', 'long', 'short', 'double', 'triple', 'quadruple', 'many', 'hold'],
  };

  [
    { enumValue: 'single', intValue: BUTTON_STATUS.CLICK },
    { enumValue: 'double', intValue: BUTTON_STATUS.DOUBLE_CLICK },
    { enumValue: 'triple', intValue: BUTTON_STATUS.TRIPLE_CLICK },
    { enumValue: 'quadruple', intValue: BUTTON_STATUS.QUADRUPLE_CLICK },
    { enumValue: 'many', intValue: BUTTON_STATUS.MANY_CLICK },
    { enumValue: 'hold', intValue: BUTTON_STATUS.HOLD_CLICK },
    { enumValue: 'long', intValue: BUTTON_STATUS.LONG_CLICK },
  ].forEach((mapping) => {
    const { enumValue, intValue } = mapping;

    it(`should write ${enumValue} value as ${intValue} value`, () => {
      const result = enumType.writeValue(expose, intValue);
      assert.equal(result, enumValue);
    });

    it(`should read ${intValue} value as ${enumValue}`, () => {
      const result = enumType.readValue(expose, enumValue);
      assert.equal(result, intValue);
    });
  });

  it('should write undefined value on missing enum', () => {
    const missingEnumExpose = {
      values: ['single', 'short', 'double', 'triple', 'quadruple', 'many'],
    };
    const result = enumType.writeValue(missingEnumExpose, BUTTON_STATUS.LONG_CLICK);
    assert.equal(result, undefined);
  });

  it('should write undefined value', () => {
    const result = enumType.writeValue(expose, 7);
    assert.equal(result, undefined);
  });

  it('should read enum value', () => {
    const result = enumType.readValue(expose, 'unknown');
    assert.equal(result, undefined);
  });

  it('should have multiple indexes', () => {
    const result = enumType.getFeatureIndexes(['1_single', '1_double', '2_single']);
    assert.deepEqual(result, [1, 2]);
  });

  it('should have no indexes', () => {
    const result = enumType.getFeatureIndexes(['single', 'double']);
    assert.deepEqual(result, []);
  });
});

```

Muss man auch **enumType.getFeatureIndexes([‹ single ›, ‹ double ›]);** anpassen?

---

<div class="post-metadata">

**Author:** ![Hizo](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Hizo](https://community.gladysassistant.com/u/Hizo)\
**Post date:** [25. August 2023 um 10:48 UTC](https://community.gladysassistant.com/t/capturer-plus-de-valeurs-avec-les-boutons-zigbee-xiaomi/8236/2 "2023-08-25T10:48:38Z")

</div>

@pierre-gilles  
Ich sehe, dass du an den Buttons arbeitest, also mache ich ein Up für diese Anfrage im gleichen Sinne 🙂

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [25. August 2023 um 11:27 UTC](https://community.gladysassistant.com/t/capturer-plus-de-valeurs-avec-les-boutons-zigbee-xiaomi/8236/3 "2023-08-25T11:27:39Z")

</div>

Ja, ich mache mich gleich daran.

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [25. August 2023 um 11:46 UTC](https://community.gladysassistant.com/t/capturer-plus-de-valeurs-avec-les-boutons-zigbee-xiaomi/8236/4 "2023-08-25T11:46:04Z")

</div>

Der Pull Request:

> <https://github.com/GladysAssistant/Gladys/pull/1853>
>
> \### Pull Request check-list
> 
> To ensure your Pull Request can be accepted as fa…st as possible, make sure to review and check all of these items:
> 
> \- \[x\] If your changes affects code, did your write the tests?
> \- \[x\] Are tests passing? (\`npm test\` on both front/server)
> \- \[x\] Is the linter passing? (\`npm run eslint\` on both front/server)
> \- \[x\] Did you run prettier? (\`npm run prettier\` on both front/server)
> \- \[x\] If you are adding a new features/services, did you run integration comparator? (\`npm run compare-translations\` on front)
> \- \[\] Did you test this pull request in real life? With real devices? If this development is a big feature or a new service, we recommend that you provide a Docker image to \[the community\](https://community.gladysassistant.com/) for testing before merging.
> 
> 
> \### Description of change
> 
> Close #1852 : Add Xiaomi button compatibility

---

<div class="post-metadata">

**Author:** ![Hizo](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/h/51bf81/32.png) [@Hizo](https://community.gladysassistant.com/u/Hizo)\
**Post date:** [11. September 2023 um 17:14 UTC](https://community.gladysassistant.com/t/capturer-plus-de-valeurs-avec-les-boutons-zigbee-xiaomi/8236/5 "2023-09-11T17:14:39Z")

</div>

Danke, ich mag den „Volltreffer“ 🙂

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [11. September 2023 um 17:53 UTC](https://community.gladysassistant.com/t/capturer-plus-de-valeurs-avec-les-boutons-zigbee-xiaomi/8236/6 "2023-09-11T17:53:45Z")

</div>

Ich nutze die Gelegenheit, um dieses Thema zu schließen, da es bereits entwickelt wurde!

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [11. September 2023 um 17:53 UTC](https://community.gladysassistant.com/t/capturer-plus-de-valeurs-avec-les-boutons-zigbee-xiaomi/8236/7 "2023-09-11T17:53:48Z")

</div>


