From 9d505288208b2b68a1a47982f515d9c3866f8af2 Mon Sep 17 00:00:00 2001 From: William Deren Date: Fri, 8 Mar 2024 08:49:02 +0100 Subject: [PATCH] Zigbee2mqtt: Add ikea somrig button (#2035) --- front/src/config/i18n/de.json | 7 ++++++- front/src/config/i18n/en.json | 7 ++++++- front/src/config/i18n/fr.json | 7 ++++++- server/services/zigbee2mqtt/exposes/enumType.js | 6 ++++++ .../services/zigbee2mqtt/utils/features/buildFeatures.js | 1 + server/utils/constants.js | 5 +++++ 6 files changed, 30 insertions(+), 3 deletions(-) diff --git a/front/src/config/i18n/de.json b/front/src/config/i18n/de.json index 30b8c82f6c..abf3912f32 100644 --- a/front/src/config/i18n/de.json +++ b/front/src/config/i18n/de.json @@ -2658,7 +2658,12 @@ "43": "Ab-Taste gedrückt", "44": "Ab-Taste gehalten", "45": "Aus-Taste gedrückt", - "46": "Aus-Taste gehalten" + "46": "Aus-Taste gehalten", + "47": "Einmaliges Drücken", + "48": "Langer Druck", + "49": "Kurzes Loslassen", + "50": "Langes Loslassen", + "51": "Doppeltes Drücken" } }, "opening-sensor": { diff --git a/front/src/config/i18n/en.json b/front/src/config/i18n/en.json index 1f7269c25a..aaf5b25bf0 100644 --- a/front/src/config/i18n/en.json +++ b/front/src/config/i18n/en.json @@ -2660,7 +2660,12 @@ "43": "Down press", "44": "Down hold", "45": "Off press", - "46": "Off hold" + "46": "Off hold", + "47": "Single press", + "48": "Long press", + "49": "Short release", + "50": "Long release", + "51": "Double press" } }, "opening-sensor": { diff --git a/front/src/config/i18n/fr.json b/front/src/config/i18n/fr.json index da77738350..858fc08486 100644 --- a/front/src/config/i18n/fr.json +++ b/front/src/config/i18n/fr.json @@ -2662,7 +2662,12 @@ "43": "Bouton Moins pressé", "44": "Bouton Moins maintenu", "45": "Bouton Off pressé", - "46": "Bouton Off maintenu" + "46": "Bouton Off maintenu", + "47": "Pression unique", + "48": "Pression longue", + "49": "Relâchement court", + "50": "Relâchement long", + "51": "Pression double" } }, "opening-sensor": { diff --git a/server/services/zigbee2mqtt/exposes/enumType.js b/server/services/zigbee2mqtt/exposes/enumType.js index b4b107dcb5..46e7280425 100644 --- a/server/services/zigbee2mqtt/exposes/enumType.js +++ b/server/services/zigbee2mqtt/exposes/enumType.js @@ -70,6 +70,12 @@ addMapping('action', BUTTON_STATUS.DOWN_HOLD, 'down-hold'); addMapping('action', BUTTON_STATUS.OFF_PRESS, 'off-press'); addMapping('action', BUTTON_STATUS.OFF_HOLD, 'off-hold'); +addMapping('action', BUTTON_STATUS.INITIAL_PRESS, 'initial_press'); +addMapping('action', BUTTON_STATUS.LONG_PRESS, 'long_press'); +addMapping('action', BUTTON_STATUS.SHORT_RELEASE, 'short_release'); +addMapping('action', BUTTON_STATUS.LONG_RELEASE, 'long_release'); +addMapping('action', BUTTON_STATUS.DOUBLE_PRESS, 'double_press'); + addMapping('state', COVER_STATE.OPEN, 'OPEN'); addMapping('state', COVER_STATE.CLOSE, 'CLOSE'); addMapping('state', COVER_STATE.STOP, 'STOP'); diff --git a/server/services/zigbee2mqtt/utils/features/buildFeatures.js b/server/services/zigbee2mqtt/utils/features/buildFeatures.js index 9a7356d409..8e1dbcf206 100644 --- a/server/services/zigbee2mqtt/utils/features/buildFeatures.js +++ b/server/services/zigbee2mqtt/utils/features/buildFeatures.js @@ -85,6 +85,7 @@ function buildFeatures(deviceName, expose, parentType) { // Add missing properties const typeFeaturesIndexes = getFeatureIndexes(values); const featureIndexes = typeFeaturesIndexes.length === 0 ? [0] : typeFeaturesIndexes; + return featureIndexes.map((suffixIndex) => completeFeature(deviceName, definedFeature, property, suffixIndex)); } diff --git a/server/utils/constants.js b/server/utils/constants.js index fdbeb2b4a4..908a28f72f 100644 --- a/server/utils/constants.js +++ b/server/utils/constants.js @@ -50,6 +50,11 @@ const BUTTON_STATUS = { DOWN_HOLD: 44, OFF_PRESS: 45, OFF_HOLD: 46, + INITIAL_PRESS: 47, + LONG_PRESS: 48, + SHORT_RELEASE: 49, + LONG_RELEASE: 50, + DOUBLE_PRESS: 51, }; const COVER_STATE = {