diff --git a/.homeycompose/capabilities/samsung_refrigerator_rapid_cool.json b/.homeycompose/capabilities/samsung_refrigerator_rapid_cool.json new file mode 100644 index 0000000..f4cdb2c --- /dev/null +++ b/.homeycompose/capabilities/samsung_refrigerator_rapid_cool.json @@ -0,0 +1,21 @@ +{ + "type": "boolean", + "title": { + "en": "Rapid Cool", + "nl": "Snel koelen", + "de": "Schnellkühlung", + "fr": "Refroidissement rapide", + "es": "Enfriamiento rápido", + "it": "Raffreddamento rapido", + "da": "Hurtigkøling", + "no": "Hurtigkjøling", + "sv": "Snabbkylning", + "pl": "Szybkie chłodzenie", + "ru": "Быстрое охлаждение", + "ko": "급속 냉각" + }, + "getable": true, + "setable": false, + "uiComponent": "sensor", + "icon": "/assets/capabilities/samsung_refrigerator_rapid_cool_mode.svg" +} diff --git a/.homeycompose/capabilities/samsung_refrigerator_rapid_freeze.json b/.homeycompose/capabilities/samsung_refrigerator_rapid_freeze.json new file mode 100644 index 0000000..7f8772b --- /dev/null +++ b/.homeycompose/capabilities/samsung_refrigerator_rapid_freeze.json @@ -0,0 +1,21 @@ +{ + "type": "boolean", + "title": { + "en": "Rapid Freeze", + "nl": "Snel vriezen", + "de": "Schnellgefrieren", + "fr": "Congélation rapide", + "es": "Congelación rápida", + "it": "Congelamento rapido", + "da": "Hurtigfrysning", + "no": "Hurtigfrysing", + "sv": "Snabbfrysning", + "pl": "Szybkie mrożenie", + "ru": "Быстрая заморозка", + "ko": "급속 냉동" + }, + "getable": true, + "setable": false, + "uiComponent": "sensor", + "icon": "/assets/capabilities/samsung_refrigerator_rapid_freeze_mode.svg" +} diff --git a/app.json b/app.json index fc502e1..e246995 100644 --- a/app.json +++ b/app.json @@ -950,6 +950,122 @@ } ] }, + { + "id": "set_rapid_freeze", + "title": { + "en": "Set rapid freeze to...", + "nl": "Zet snel vriezen op...", + "de": "Schnellgefrieren einstellen auf...", + "fr": "Définir la congélation rapide sur...", + "es": "Establecer congelación rápida en...", + "it": "Imposta congelamento rapido su...", + "da": "Indstil hurtigfrysning til...", + "no": "Sett hurtigfrysing til...", + "sv": "Ställ in snabbfrysning på...", + "pl": "Ustaw szybkie mrożenie na...", + "ru": "Установить быструю заморозку на...", + "ko": "급속 냉동을 ...로 설정" + }, + "titleFormatted": { + "en": "Set rapid freeze to [[state]]", + "nl": "Zet snel vriezen op [[state]]", + "de": "Schnellgefrieren einstellen auf [[state]]", + "fr": "Définir la congélation rapide sur [[state]]", + "es": "Establecer congelación rápida en [[state]]", + "it": "Imposta congelamento rapido su [[state]]", + "da": "Indstil hurtigfrysning til [[state]]", + "no": "Sett hurtigfrysing til [[state]]", + "sv": "Ställ in snabbfrysning på [[state]]", + "pl": "Ustaw szybkie mrożenie na [[state]]", + "ru": "Установить быструю заморозку на [[state]]", + "ko": "급속 냉동을 [[state]]로 설정" + }, + "args": [ + { + "type": "device", + "name": "device", + "filter": "driver_id=refrigerator" + }, + { + "name": "state", + "type": "dropdown", + "values": [ + { + "id": "on", + "title": { + "en": "On", + "nl": "Aan" + } + }, + { + "id": "off", + "title": { + "en": "Off", + "nl": "Uit" + } + } + ] + } + ] + }, + { + "id": "set_rapid_cool", + "title": { + "en": "Set rapid cool to...", + "nl": "Zet snel koelen op...", + "de": "Schnellkühlung einstellen auf...", + "fr": "Définir le refroidissement rapide sur...", + "es": "Establecer enfriamiento rápido en...", + "it": "Imposta raffreddamento rapido su...", + "da": "Indstil hurtigkøling til...", + "no": "Sett hurtigkjøling til...", + "sv": "Ställ in snabbkylning på...", + "pl": "Ustaw szybkie chłodzenie na...", + "ru": "Установить быстрое охлаждение на...", + "ko": "급속 냉각을 ...로 설정" + }, + "titleFormatted": { + "en": "Set rapid cool to [[state]]", + "nl": "Zet snel koelen op [[state]]", + "de": "Schnellkühlung einstellen auf [[state]]", + "fr": "Définir le refroidissement rapide sur [[state]]", + "es": "Establecer enfriamiento rápido en [[state]]", + "it": "Imposta raffreddamento rapido su [[state]]", + "da": "Indstil hurtigkøling til [[state]]", + "no": "Sett hurtigkjøling til [[state]]", + "sv": "Ställ in snabbkylning på [[state]]", + "pl": "Ustaw szybkie chłodzenie na [[state]]", + "ru": "Установить быстрое охлаждение на [[state]]", + "ko": "급속 냉각을 [[state]]로 설정" + }, + "args": [ + { + "type": "device", + "name": "device", + "filter": "driver_id=refrigerator" + }, + { + "name": "state", + "type": "dropdown", + "values": [ + { + "id": "on", + "title": { + "en": "On", + "nl": "Aan" + } + }, + { + "id": "off", + "title": { + "en": "Off", + "nl": "Uit" + } + } + ] + } + ] + }, { "id": "set_volume", "title": { @@ -1061,6 +1177,124 @@ } ] } + ], + "conditions": [ + { + "id": "rapid_freeze_state", + "title": { + "en": "Rapid freeze is...", + "nl": "Snel vriezen is...", + "de": "Schnellgefrieren ist...", + "fr": "La congélation rapide est...", + "es": "La congelación rápida está...", + "it": "Il congelamento rapido è...", + "da": "Hurtigfrysning er...", + "no": "Hurtigfrysing er...", + "sv": "Snabbfrysning är...", + "pl": "Szybkie mrożenie jest...", + "ru": "Быстрая заморозка...", + "ko": "급속 냉동 상태..." + }, + "titleFormatted": { + "en": "Rapid freeze is [[state]]", + "nl": "Snel vriezen is [[state]]", + "de": "Schnellgefrieren ist [[state]]", + "fr": "La congélation rapide est [[state]]", + "es": "La congelación rápida está [[state]]", + "it": "Il congelamento rapido è [[state]]", + "da": "Hurtigfrysning er [[state]]", + "no": "Hurtigfrysing er [[state]]", + "sv": "Snabbfrysning är [[state]]", + "pl": "Szybkie mrożenie jest [[state]]", + "ru": "Быстрая заморозка [[state]]", + "ko": "급속 냉동 상태 [[state]]" + }, + "args": [ + { + "type": "device", + "name": "device", + "filter": "driver_id=refrigerator" + }, + { + "name": "state", + "type": "dropdown", + "values": [ + { + "id": "on", + "title": { + "en": "On", + "nl": "Aan" + } + }, + { + "id": "off", + "title": { + "en": "Off", + "nl": "Uit" + } + } + ] + } + ] + }, + { + "id": "rapid_cool_state", + "title": { + "en": "Rapid cool is...", + "nl": "Snel koelen is...", + "de": "Schnellkühlung ist...", + "fr": "Le refroidissement rapide est...", + "es": "El enfriamiento rápido está...", + "it": "Il raffreddamento rapido è...", + "da": "Hurtigkøling er...", + "no": "Hurtigkjøling er...", + "sv": "Snabbkylning är...", + "pl": "Szybkie chłodzenie jest...", + "ru": "Быстрое охлаждение...", + "ko": "급속 냉각 상태..." + }, + "titleFormatted": { + "en": "Rapid cool is [[state]]", + "nl": "Snel koelen is [[state]]", + "de": "Schnellkühlung ist [[state]]", + "fr": "Le refroidissement rapide est [[state]]", + "es": "El enfriamiento rápido está [[state]]", + "it": "Il raffreddamento rapido è [[state]]", + "da": "Hurtigkøling er [[state]]", + "no": "Hurtigkjøling er [[state]]", + "sv": "Snabbkylning är [[state]]", + "pl": "Szybkie chłodzenie jest [[state]]", + "ru": "Быстрое охлаждение [[state]]", + "ko": "급속 냉각 상태 [[state]]" + }, + "args": [ + { + "type": "device", + "name": "device", + "filter": "driver_id=refrigerator" + }, + { + "name": "state", + "type": "dropdown", + "values": [ + { + "id": "on", + "title": { + "en": "On", + "nl": "Aan" + } + }, + { + "id": "off", + "title": { + "en": "Off", + "nl": "Uit" + } + } + ] + } + ] + } ] }, "drivers": [ @@ -1301,16 +1535,103 @@ "ko": "삼성 냉장고" }, "class": "fridge", - "capabilities": [], + "capabilities": [ + "measure_temperature.cooler", + "measure_temperature.freezer", + "alarm_contact", + "samsung_refrigerator_rapid_cool", + "samsung_refrigerator_rapid_freeze" + ], "capabilitiesOptions": { "measure_temperature.cooler": { - "title": "Cooler Temperature" + "title": { + "en": "Cooler Temperature", + "nl": "Koelkast temperatuur", + "da": "Køleskabstemperatur", + "de": "Kühlschranktemperatur", + "es": "Temperatura del frigorífico", + "fr": "Température du réfrigérateur", + "it": "Temperatura frigorifero", + "no": "Kjøleskapstemperatur", + "sv": "Kylskåpstemperatur", + "pl": "Temperatura lodówki", + "ru": "Температура холодильника", + "ko": "냉장고 온도" + } }, "measure_temperature.freezer": { - "title": "Freezer Temperature" + "title": { + "en": "Freezer Temperature", + "nl": "Vriezer temperatuur", + "da": "Frysertemperatur", + "de": "Gefriertemperatur", + "es": "Temperatura del congelador", + "fr": "Température du congélateur", + "it": "Temperatura congelatore", + "no": "Frysertemperatur", + "sv": "Frysrumstemperatur", + "pl": "Temperatura zamrażarki", + "ru": "Температура морозильника", + "ko": "냉동실 온도" + } }, "alarm_contact": { - "title": "Door Open" + "title": { + "en": "Door Open", + "nl": "Deur open", + "da": "Dør åben", + "de": "Tür offen", + "es": "Puerta abierta", + "fr": "Porte ouverte", + "it": "Porta aperta", + "no": "Dør åpen", + "sv": "Dörr öppen", + "pl": "Drzwi otwarte", + "ru": "Дверь открыта", + "ko": "문 열림" + } + }, + "samsung_refrigerator_rapid_cool": { + "type": "boolean", + "title": { + "en": "Rapid Cool", + "nl": "Snel koelen", + "de": "Schnellkühlung", + "fr": "Refroidissement rapide", + "es": "Enfriamiento rápido", + "it": "Raffreddamento rapido", + "da": "Hurtigkøling", + "no": "Hurtigkjøling", + "sv": "Snabbkylning", + "pl": "Szybkie chłodzenie", + "ru": "Быстрое охлаждение", + "ko": "급속 냉각" + }, + "getable": true, + "setable": false, + "uiComponent": "sensor", + "icon": "/assets/capabilities/samsung_refrigerator_rapid_cool_mode.svg" + }, + "samsung_refrigerator_rapid_freeze": { + "type": "boolean", + "title": { + "en": "Rapid Freeze", + "nl": "Snel vriezen", + "de": "Schnellgefrieren", + "fr": "Congélation rapide", + "es": "Congelación rápida", + "it": "Congelamento rapido", + "da": "Hurtigfrysning", + "no": "Hurtigfrysing", + "sv": "Snabbfrysning", + "pl": "Szybkie mrożenie", + "ru": "Быстрая заморозка", + "ko": "급속 냉동" + }, + "getable": true, + "setable": false, + "uiComponent": "sensor", + "icon": "/assets/capabilities/samsung_refrigerator_rapid_freeze_mode.svg" } }, "id": "refrigerator" @@ -1443,6 +1764,27 @@ } ], "widgets": { + "widget-dryer": { + "name": { + "en": "Dryer" + }, + "height": 140, + "settings": [], + "devices": { + "type": "app", + "singular": true, + "filter": { + "capabilities": "samsung_dryer_current_job_state" + } + }, + "api": { + "getDryerState": { + "method": "GET", + "path": "/" + } + }, + "id": "widget-dryer" + }, "widget-washer": { "name": { "en": "Washer" @@ -2287,6 +2629,48 @@ } ] }, + "samsung_refrigerator_rapid_cool": { + "type": "boolean", + "title": { + "en": "Rapid Cool", + "nl": "Snel koelen", + "de": "Schnellkühlung", + "fr": "Refroidissement rapide", + "es": "Enfriamiento rápido", + "it": "Raffreddamento rapido", + "da": "Hurtigkøling", + "no": "Hurtigkjøling", + "sv": "Snabbkylning", + "pl": "Szybkie chłodzenie", + "ru": "Быстрое охлаждение", + "ko": "급속 냉각" + }, + "getable": true, + "setable": false, + "uiComponent": "sensor", + "icon": "/assets/capabilities/samsung_refrigerator_rapid_cool_mode.svg" + }, + "samsung_refrigerator_rapid_freeze": { + "type": "boolean", + "title": { + "en": "Rapid Freeze", + "nl": "Snel vriezen", + "de": "Schnellgefrieren", + "fr": "Congélation rapide", + "es": "Congelación rápida", + "it": "Congelamento rapido", + "da": "Hurtigfrysning", + "no": "Hurtigfrysing", + "sv": "Snabbfrysning", + "pl": "Szybkie mrożenie", + "ru": "Быстрая заморозка", + "ko": "급속 냉동" + }, + "getable": true, + "setable": false, + "uiComponent": "sensor", + "icon": "/assets/capabilities/samsung_refrigerator_rapid_freeze_mode.svg" + }, "samsung_washer_current_job_state": { "type": "enum", "title": { diff --git a/assets/capabilities/samsung_refrigerator_rapid_cool_mode.svg b/assets/capabilities/samsung_refrigerator_rapid_cool_mode.svg new file mode 100644 index 0000000..d6d1a26 --- /dev/null +++ b/assets/capabilities/samsung_refrigerator_rapid_cool_mode.svg @@ -0,0 +1,26 @@ + + diff --git a/assets/capabilities/samsung_refrigerator_rapid_freeze_mode.svg b/assets/capabilities/samsung_refrigerator_rapid_freeze_mode.svg new file mode 100644 index 0000000..8f793b1 --- /dev/null +++ b/assets/capabilities/samsung_refrigerator_rapid_freeze_mode.svg @@ -0,0 +1,22 @@ + + diff --git a/drivers/refrigerator/device.js b/drivers/refrigerator/device.js index 7244009..c12268d 100644 --- a/drivers/refrigerator/device.js +++ b/drivers/refrigerator/device.js @@ -19,13 +19,102 @@ module.exports = class SmartThingsDeviceRefrigerator extends SmartThingsDevice { }, { homeyCapabilityId: 'alarm_contact', - smartThingsComponentId: 'cooler', + smartThingsComponentId: 'main', smartThingsCapabilityId: 'contactSensor', smartThingsAttributeId: 'contact', async onReport({ value }) { return value === 'open'; }, }, + { + homeyCapabilityId: 'samsung_refrigerator_rapid_cool', + smartThingsComponentId: 'main', + smartThingsCapabilityId: 'refrigeration', + smartThingsAttributeId: 'rapidCooling', + async onReport({ value }) { + return value === 'on'; + }, + }, + { + homeyCapabilityId: 'samsung_refrigerator_rapid_freeze', + smartThingsComponentId: 'main', + smartThingsCapabilityId: 'refrigeration', + smartThingsAttributeId: 'rapidFreezing', + async onReport({ value }) { + return value === 'on'; + }, + }, ]; + static FLOW = { + conditions: { + rapid_freeze_state: 'rapidFreezeState', + rapid_cool_state: 'rapidCoolState', + }, + actions: { + set_rapid_freeze: 'setRapidFreeze', + set_rapid_cool: 'setRapidCool', + }, + }; + + async rapidFreezeState({ state }) { + const value = this.getCapabilityValue('samsung_refrigerator_rapid_freeze'); + return (state === 'on') ? value : !value; + } + + async rapidCoolState({ state }) { + const value = this.getCapabilityValue('samsung_refrigerator_rapid_cool'); + return (state === 'on') ? value : !value; + } + + async setRapidFreeze({ state }) { + await this.executeCommand({ + component: 'main', + capability: 'refrigeration', + command: 'setRapidFreezing', + args: [state === 'on' ? 'on' : 'off'], + }); + await this.setCapabilityValue('samsung_refrigerator_rapid_freeze', state === 'on'); + } + + async setRapidCool({ state }) { + await this.executeCommand({ + component: 'main', + capability: 'refrigeration', + command: 'setRapidCooling', + args: [state === 'on' ? 'on' : 'off'], + }); + await this.setCapabilityValue('samsung_refrigerator_rapid_cool', state === 'on'); + } + + async onOAuth2Init() { + this.homey.flow.getConditionCard('rapid_freeze_state') + .registerRunListener(args => this.rapidFreezeState(args)); + this.homey.flow.getConditionCard('rapid_cool_state') + .registerRunListener(args => this.rapidCoolState(args)); + if (super.onOAuth2Init) await super.onOAuth2Init(); + } + + onInit() { + super.onInit?.(); + + // Zorg dat alle capabilities aanwezig zijn op het apparaat + for (const cap of this.constructor.CAPABILITIES) { + if (!this.hasCapability(cap.homeyCapabilityId)) { + this.addCapability(cap.homeyCapabilityId).catch(this.error); + } + } + + this.homey.flow.getActionCard('set_rapid_freeze') + .registerRunListener(async args => { + await this.setRapidFreeze(args); + return true; + }); + this.homey.flow.getActionCard('set_rapid_cool') + .registerRunListener(async args => { + await this.setRapidCool(args); + return true; + }); + } + }; diff --git a/drivers/refrigerator/driver.compose.json b/drivers/refrigerator/driver.compose.json index 6f172e8..dcda47d 100644 --- a/drivers/refrigerator/driver.compose.json +++ b/drivers/refrigerator/driver.compose.json @@ -15,16 +15,103 @@ "ko": "삼성 냉장고" }, "class": "fridge", - "capabilities": [], + "capabilities": [ + "measure_temperature.cooler", + "measure_temperature.freezer", + "alarm_contact", + "samsung_refrigerator_rapid_cool", + "samsung_refrigerator_rapid_freeze" + ], "capabilitiesOptions": { "measure_temperature.cooler": { - "title": "Cooler Temperature" + "title": { + "en": "Cooler Temperature", + "nl": "Koelkast temperatuur", + "da": "Køleskabstemperatur", + "de": "Kühlschranktemperatur", + "es": "Temperatura del frigorífico", + "fr": "Température du réfrigérateur", + "it": "Temperatura frigorifero", + "no": "Kjøleskapstemperatur", + "sv": "Kylskåpstemperatur", + "pl": "Temperatura lodówki", + "ru": "Температура холодильника", + "ko": "냉장고 온도" + } }, "measure_temperature.freezer": { - "title": "Freezer Temperature" + "title": { + "en": "Freezer Temperature", + "nl": "Vriezer temperatuur", + "da": "Frysertemperatur", + "de": "Gefriertemperatur", + "es": "Temperatura del congelador", + "fr": "Température du congélateur", + "it": "Temperatura congelatore", + "no": "Frysertemperatur", + "sv": "Frysrumstemperatur", + "pl": "Temperatura zamrażarki", + "ru": "Температура морозильника", + "ko": "냉동실 온도" + } }, "alarm_contact": { - "title": "Door Open" + "title": { + "en": "Door Open", + "nl": "Deur open", + "da": "Dør åben", + "de": "Tür offen", + "es": "Puerta abierta", + "fr": "Porte ouverte", + "it": "Porta aperta", + "no": "Dør åpen", + "sv": "Dörr öppen", + "pl": "Drzwi otwarte", + "ru": "Дверь открыта", + "ko": "문 열림" + } + }, + "samsung_refrigerator_rapid_cool": { + "type": "boolean", + "title": { + "en": "Rapid Cool", + "nl": "Snel koelen", + "de": "Schnellkühlung", + "fr": "Refroidissement rapide", + "es": "Enfriamiento rápido", + "it": "Raffreddamento rapido", + "da": "Hurtigkøling", + "no": "Hurtigkjøling", + "sv": "Snabbkylning", + "pl": "Szybkie chłodzenie", + "ru": "Быстрое охлаждение", + "ko": "급속 냉각" + }, + "getable": true, + "setable": false, + "uiComponent": "sensor", + "icon": "/assets/capabilities/samsung_refrigerator_rapid_cool_mode.svg" + }, + "samsung_refrigerator_rapid_freeze": { + "type": "boolean", + "title": { + "en": "Rapid Freeze", + "nl": "Snel vriezen", + "de": "Schnellgefrieren", + "fr": "Congélation rapide", + "es": "Congelación rápida", + "it": "Congelamento rapido", + "da": "Hurtigfrysning", + "no": "Hurtigfrysing", + "sv": "Snabbfrysning", + "pl": "Szybkie mrożenie", + "ru": "Быстрая заморозка", + "ko": "급속 냉동" + }, + "getable": true, + "setable": false, + "uiComponent": "sensor", + "icon": "/assets/capabilities/samsung_refrigerator_rapid_freeze_mode.svg" } } -} \ No newline at end of file +} diff --git a/drivers/refrigerator/driver.flow.compose.json b/drivers/refrigerator/driver.flow.compose.json index a5a1aca..7ee3388 100644 --- a/drivers/refrigerator/driver.flow.compose.json +++ b/drivers/refrigerator/driver.flow.compose.json @@ -1,3 +1,142 @@ { - "triggers": [] -} \ No newline at end of file + "conditions": [ + { + "id": "rapid_freeze_state", + "title": { + "en": "Rapid freeze is...", + "nl": "Snel vriezen is...", + "de": "Schnellgefrieren ist...", + "fr": "La congélation rapide est...", + "es": "La congelación rápida está...", + "it": "Il congelamento rapido è...", + "da": "Hurtigfrysning er...", + "no": "Hurtigfrysing er...", + "sv": "Snabbfrysning är...", + "pl": "Szybkie mrożenie jest...", + "ru": "Быстрая заморозка...", + "ko": "급속 냉동 상태..." + }, + "titleFormatted": { + "en": "Rapid freeze is [[state]]", + "nl": "Snel vriezen is [[state]]", + "de": "Schnellgefrieren ist [[state]]", + "fr": "La congélation rapide est [[state]]", + "es": "La congelación rápida está [[state]]", + "it": "Il congelamento rapido è [[state]]", + "da": "Hurtigfrysning er [[state]]", + "no": "Hurtigfrysing er [[state]]", + "sv": "Snabbfrysning är [[state]]", + "pl": "Szybkie mrożenie jest [[state]]", + "ru": "Быстрая заморозка [[state]]", + "ko": "급속 냉동 상태 [[state]]" + }, + "args": [ + { "name": "state", "type": "dropdown", "values": [ { "id": "on", "title": { "en": "On", "nl": "Aan" } }, { "id": "off", "title": { "en": "Off", "nl": "Uit" } } ] } + ] + }, + { + "id": "rapid_cool_state", + "title": { + "en": "Rapid cool is...", + "nl": "Snel koelen is...", + "de": "Schnellkühlung ist...", + "fr": "Le refroidissement rapide est...", + "es": "El enfriamiento rápido está...", + "it": "Il raffreddamento rapido è...", + "da": "Hurtigkøling er...", + "no": "Hurtigkjøling er...", + "sv": "Snabbkylning är...", + "pl": "Szybkie chłodzenie jest...", + "ru": "Быстрое охлаждение...", + "ko": "급속 냉각 상태..." + }, + "titleFormatted": { + "en": "Rapid cool is [[state]]", + "nl": "Snel koelen is [[state]]", + "de": "Schnellkühlung ist [[state]]", + "fr": "Le refroidissement rapide est [[state]]", + "es": "El enfriamiento rápido está [[state]]", + "it": "Il raffreddamento rapido è [[state]]", + "da": "Hurtigkøling er [[state]]", + "no": "Hurtigkjøling er [[state]]", + "sv": "Snabbkylning är [[state]]", + "pl": "Szybkie chłodzenie jest [[state]]", + "ru": "Быстрое охлаждение [[state]]", + "ko": "급속 냉각 상태 [[state]]" + }, + "args": [ + { "name": "state", "type": "dropdown", "values": [ { "id": "on", "title": { "en": "On", "nl": "Aan" } }, { "id": "off", "title": { "en": "Off", "nl": "Uit" } } ] } + ] + } + ], + "actions": [ + { + "id": "set_rapid_freeze", + "title": { + "en": "Set rapid freeze to...", + "nl": "Zet snel vriezen op...", + "de": "Schnellgefrieren einstellen auf...", + "fr": "Définir la congélation rapide sur...", + "es": "Establecer congelación rápida en...", + "it": "Imposta congelamento rapido su...", + "da": "Indstil hurtigfrysning til...", + "no": "Sett hurtigfrysing til...", + "sv": "Ställ in snabbfrysning på...", + "pl": "Ustaw szybkie mrożenie na...", + "ru": "Установить быструю заморозку на...", + "ko": "급속 냉동을 ...로 설정" + }, + "titleFormatted": { + "en": "Set rapid freeze to [[state]]", + "nl": "Zet snel vriezen op [[state]]", + "de": "Schnellgefrieren einstellen auf [[state]]", + "fr": "Définir la congélation rapide sur [[state]]", + "es": "Establecer congelación rápida en [[state]]", + "it": "Imposta congelamento rapido su [[state]]", + "da": "Indstil hurtigfrysning til [[state]]", + "no": "Sett hurtigfrysing til [[state]]", + "sv": "Ställ in snabbfrysning på [[state]]", + "pl": "Ustaw szybkie mrożenie na [[state]]", + "ru": "Установить быструю заморозку на [[state]]", + "ko": "급속 냉동을 [[state]]로 설정" + }, + "args": [ + { "name": "state", "type": "dropdown", "values": [ { "id": "on", "title": { "en": "On", "nl": "Aan" } }, { "id": "off", "title": { "en": "Off", "nl": "Uit" } } ] } + ] + }, + { + "id": "set_rapid_cool", + "title": { + "en": "Set rapid cool to...", + "nl": "Zet snel koelen op...", + "de": "Schnellkühlung einstellen auf...", + "fr": "Définir le refroidissement rapide sur...", + "es": "Establecer enfriamiento rápido en...", + "it": "Imposta raffreddamento rapido su...", + "da": "Indstil hurtigkøling til...", + "no": "Sett hurtigkjøling til...", + "sv": "Ställ in snabbkylning på...", + "pl": "Ustaw szybkie chłodzenie na...", + "ru": "Установить быстрое охлаждение на...", + "ko": "급속 냉각을 ...로 설정" + }, + "titleFormatted": { + "en": "Set rapid cool to [[state]]", + "nl": "Zet snel koelen op [[state]]", + "de": "Schnellkühlung einstellen auf [[state]]", + "fr": "Définir le refroidissement rapide sur [[state]]", + "es": "Establecer enfriamiento rápido en [[state]]", + "it": "Imposta raffreddamento rapido su [[state]]", + "da": "Indstil hurtigkøling til [[state]]", + "no": "Sett hurtigkjøling til [[state]]", + "sv": "Ställ in snabbkylning på [[state]]", + "pl": "Ustaw szybkie chłodzenie na [[state]]", + "ru": "Установить быстрое охлаждение на [[state]]", + "ko": "급속 냉각을 [[state]]로 설정" + }, + "args": [ + { "name": "state", "type": "dropdown", "values": [ { "id": "on", "title": { "en": "On", "nl": "Aan" } }, { "id": "off", "title": { "en": "Off", "nl": "Uit" } } ] } + ] + } + ] +} diff --git a/drivers/refrigerator/driver.js b/drivers/refrigerator/driver.js index ffaf756..243610d 100644 --- a/drivers/refrigerator/driver.js +++ b/drivers/refrigerator/driver.js @@ -2,7 +2,7 @@ const SmartThingsDriver = require('../../lib/SmartThingsDriver'); -module.exports = class SmartThingsDriverWasher extends SmartThingsDriver { +module.exports = class SmartThingsDriverRefrigerator extends SmartThingsDriver { onPairFilterDevice(device) { this.log('onPairFilterDevice', device.deviceTypeName); diff --git a/locales/da.json b/locales/da.json index c7379fd..ac75261 100644 --- a/locales/da.json +++ b/locales/da.json @@ -21,5 +21,15 @@ "spin": "Centrifugering", "idle": "Inaktiv", "off": "Slukket" + }, + "samsung_dryer_current_job_state": { + "none": "Ingen", + "idle": "Inaktiv", + "cooling": "Afkøling", + "drying": "Tørring", + "rinse": "Skylning", + "spin": "Centrifugering", + "finished": "Færdig", + "off": "Slukket" } -} \ No newline at end of file +} diff --git a/locales/de.json b/locales/de.json index 741966b..b257530 100644 --- a/locales/de.json +++ b/locales/de.json @@ -21,5 +21,15 @@ "spin": "Schleudern", "idle": "Leerlauf", "off": "Aus" + }, + "samsung_dryer_current_job_state": { + "none": "Keine", + "idle": "Leerlauf", + "cooling": "Abkühlen", + "drying": "Trocknen", + "rinse": "Spülen", + "spin": "Schleudern", + "finished": "Fertig", + "off": "Aus" } -} \ No newline at end of file +} diff --git a/locales/en.json b/locales/en.json index e80a167..9a6785b 100644 --- a/locales/en.json +++ b/locales/en.json @@ -21,5 +21,15 @@ "spin": "Spinning", "idle": "Idle", "off": "Off" + }, + "samsung_dryer_current_job_state": { + "none": "None", + "idle": "Idle", + "cooling": "Cooling", + "drying": "Drying", + "rinse": "Rinsing", + "spin": "Spinning", + "finished": "Finished", + "off": "Off" } } diff --git a/locales/es.json b/locales/es.json index 542a28b..49ca1c4 100644 --- a/locales/es.json +++ b/locales/es.json @@ -21,5 +21,15 @@ "spin": "Centrifugado", "idle": "Inactivo", "off": "Apagado" + }, + "samsung_dryer_current_job_state": { + "none": "Ninguno", + "idle": "Inactivo", + "cooling": "Enfriando", + "drying": "Secando", + "rinse": "Enjuagando", + "spin": "Centrifugado", + "finished": "Terminado", + "off": "Apagado" } -} \ No newline at end of file +} diff --git a/locales/fr.json b/locales/fr.json index c59a024..ec7eab9 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -21,5 +21,15 @@ "spin": "Essorage", "idle": "Inactif", "off": "Éteint" + }, + "samsung_dryer_current_job_state": { + "none": "Aucun", + "idle": "Inactif", + "cooling": "Refroidissement", + "drying": "Séchage", + "rinse": "Rinçage", + "spin": "Essorage", + "finished": "Terminé", + "off": "Éteint" } -} \ No newline at end of file +} diff --git a/locales/it.json b/locales/it.json index b60c969..f379903 100644 --- a/locales/it.json +++ b/locales/it.json @@ -21,5 +21,15 @@ "spin": "Centrifuga", "idle": "Inattivo", "off": "Spento" + }, + "samsung_dryer_current_job_state": { + "none": "Nessuno", + "idle": "Inattivo", + "cooling": "Raffreddamento", + "drying": "Asciugatura", + "rinse": "Risciacquo", + "spin": "Centrifuga", + "finished": "Finito", + "off": "Spento" } -} \ No newline at end of file +} diff --git a/locales/ko.json b/locales/ko.json index db4ecc2..6b7ba7b 100644 --- a/locales/ko.json +++ b/locales/ko.json @@ -21,5 +21,15 @@ "spin": "탈수", "idle": "대기", "off": "꺼짐" + }, + "samsung_dryer_current_job_state": { + "none": "없음", + "idle": "대기 중", + "cooling": "냉각 중", + "drying": "건조 중", + "rinse": "헹굼 중", + "spin": "회전 중", + "finished": "끝남", + "off": "꺼짐" } -} \ No newline at end of file +} diff --git a/locales/nl.json b/locales/nl.json index 6b49a3c..b44e7eb 100644 --- a/locales/nl.json +++ b/locales/nl.json @@ -21,5 +21,15 @@ "spin": "Zwieren", "idle": "Inactief", "off": "Uit" + }, + "samsung_dryer_current_job_state": { + "none": "Geen", + "idle": "Inactief", + "cooling": "Koelen", + "drying": "Drogen", + "rinse": "Spoelen", + "spin": "Centrifugeren", + "finished": "Klaar", + "off": "Uit" } -} \ No newline at end of file +} diff --git a/locales/no.json b/locales/no.json index 4f77d0b..e8f197d 100644 --- a/locales/no.json +++ b/locales/no.json @@ -21,5 +21,15 @@ "spin": "Sentrifugering", "idle": "Inaktiv", "off": "Av" + }, + "samsung_dryer_current_job_state": { + "none": "Ingen", + "idle": "Inaktiv", + "cooling": "Nedkjøling", + "drying": "Tørker", + "rinse": "Skyller", + "spin": "Sentrifugering", + "finished": "Ferdig", + "off": "Av" } -} \ No newline at end of file +} diff --git a/locales/pl.json b/locales/pl.json index 6f11411..5243b5a 100644 --- a/locales/pl.json +++ b/locales/pl.json @@ -21,5 +21,15 @@ "spin": "Wirowanie", "idle": "Bezczynny", "off": "Wyłączony" + }, + "samsung_dryer_current_job_state": { + "none": "Brak", + "idle": "Bezczynny", + "cooling": "Chłodzenie", + "drying": "Suszenie", + "rinse": "Płukanie", + "spin": "Wirowanie", + "finished": "Gotowe", + "off": "Wyłączony" } -} \ No newline at end of file +} diff --git a/locales/ru.json b/locales/ru.json index 7ac734f..1c7a8f0 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -21,5 +21,15 @@ "spin": "Отжим", "idle": "Ожидание", "off": "Выключено" + }, + "samsung_dryer_current_job_state": { + "none": "Нет", + "idle": "Бездействие", + "cooling": "Охлаждение", + "drying": "Сушка", + "rinse": "Полоскание", + "spin": "Отжим", + "finished": "Завершено", + "off": "Выключено" } -} \ No newline at end of file +} diff --git a/locales/sv.json b/locales/sv.json index 51727c1..64c4e09 100644 --- a/locales/sv.json +++ b/locales/sv.json @@ -21,5 +21,15 @@ "spin": "Centrifugering", "idle": "Inaktiv", "off": "Av" + }, + "samsung_dryer_current_job_state": { + "none": "Ingen", + "idle": "Inaktiv", + "cooling": "Nedkylning", + "drying": "Torkning", + "rinse": "Sköljning", + "spin": "Centrifugering", + "finished": "Klar", + "off": "Av" } -} \ No newline at end of file +} diff --git a/widgets/widget-dryer/api.js b/widgets/widget-dryer/api.js new file mode 100644 index 0000000..35aa8c5 --- /dev/null +++ b/widgets/widget-dryer/api.js @@ -0,0 +1,32 @@ +'use strict'; + +module.exports = { + async getDryerState({ homey, query }) { + + const selectedDeviceId = query.deviceId; + + const driver = await homey.drivers.getDriver('dryer'); + const devices = driver.getDevices(); + + console.log('Devices found:', devices.map(d => d.getName())); + + const selectedDevice = devices.find(device => device.getId() === selectedDeviceId); + + const name = await selectedDevice.getName(); + console.log(`Selected device: ${name}`); + let state = await selectedDevice.getCapabilityValue('samsung_dryer_current_job_state'); + let progress = await selectedDevice.getCapabilityValue('samsung_dryer_progress_percentage'); + let remainingTime = await selectedDevice.getCapabilityValue('samsung_dryer_progress_remaining_time'); + + if (state === 'none') state = 'off'; + if (state === 'off') remainingTime = '-'; + if (progress === 1) progress = 0; + + return { + name, + state, + progress, + remainingTime, + }; + }, +}; diff --git a/widgets/widget-dryer/preview-dark.png b/widgets/widget-dryer/preview-dark.png new file mode 100644 index 0000000..eee9ac2 Binary files /dev/null and b/widgets/widget-dryer/preview-dark.png differ diff --git a/widgets/widget-dryer/preview-light.png b/widgets/widget-dryer/preview-light.png new file mode 100644 index 0000000..f434967 Binary files /dev/null and b/widgets/widget-dryer/preview-light.png differ diff --git a/widgets/widget-dryer/public/dryer.png b/widgets/widget-dryer/public/dryer.png new file mode 100644 index 0000000..82ac306 Binary files /dev/null and b/widgets/widget-dryer/public/dryer.png differ diff --git a/widgets/widget-dryer/public/index.html b/widgets/widget-dryer/public/index.html new file mode 100644 index 0000000..412d782 --- /dev/null +++ b/widgets/widget-dryer/public/index.html @@ -0,0 +1,120 @@ + +
+ + + + +