diff --git a/drivers/4AK1SZ-0EU0/device.js b/drivers/4AK1SZ-0EU0/device.js index d559f0b..d37a461 100755 --- a/drivers/4AK1SZ-0EU0/device.js +++ b/drivers/4AK1SZ-0EU0/device.js @@ -427,7 +427,35 @@ class RingDevice extends ZwaveDevice { let INDICATOR_CHIME = { id: CHIME_ID,property: PROPERTY_ID_VOLUME,value: VOLUME, } this.setIndicator(INDICATOR_CHIME); } - + + async setKeypadMode(mode, customValue = null) { + await new Promise(resolve => setTimeout(resolve, 500)); + + const commands = { + 'disarmed': { id: 2, property: 1, value: 1 }, + 'alarm': { id: 12, property: 1, value: 1 }, + 'fire_alarm': { id: 14, property: 1, value: 1 }, + 'gas_alarm': { id: 15, property: 1, value: 1 }, + 'medical_alarm': { id: 19, property: 1, value: 1 }, + 'code_not_accepted': { id: 9, property: 1, value: 1 }, + 'armed_stay': { id: 10, property: 1, value: 1 }, + 'armed_away': { id: 11, property: 1, value: 1 }, + 'bypass_challenge': { id: 16, property: 1, value: 1 }, + 'entry_delay': { id: 17, property: 7, value: 15 }, + 'exit_delay': { id: 17, property: 2, value: 15 }, + 'armed': { id: 10, property: 1, value: 1 } + }; + + const targetCmd = commands[mode]; + + if (!targetCmd) return; + + if ((mode === 'entry_delay' || mode === 'exit_delay') && customValue !== null) { + targetCmd.value = customValue; + } + + this.setIndicator(targetCmd); + } async setIndicator(value) { this.log("Value received to send to indicator: ", value); @@ -471,4 +499,4 @@ class RingDevice extends ZwaveDevice { } -module.exports = RingDevice; \ No newline at end of file +module.exports = RingDevice; diff --git a/drivers/4AK1SZ-0EU0/driver.flow.compose.json b/drivers/4AK1SZ-0EU0/driver.flow.compose.json index 053aa65..1028340 100755 --- a/drivers/4AK1SZ-0EU0/driver.flow.compose.json +++ b/drivers/4AK1SZ-0EU0/driver.flow.compose.json @@ -235,6 +235,198 @@ ] } ] - } + }, + { + "id": "4AK1SZ-0EU0-setKeypadMode", + "title": { + "en": "Set Keypad Mode with Value", + "de": "Keypad-Modus mit Wert setzen" + }, + "args": [ + { + "name": "mode", + "type": "dropdown", + "values": [ + [ + { + "id": "disarmed", + "label": { + "en": "Disarmed", + "de": "Inaktiv", + "nl": "Uitgeschakeld", + "fr": "Désarmé", + "it": "Disattivato", + "no": "Deaktivert", + "sv": "Avaktiverad", + "da": "Fravalgt / Deaktiveret", + "es": "Desarmado" + } + }, + { + "id": "armed_stay", + "label": { + "en": "Armed Stay", + "de": "Zuhause und aktiv", + "nl": "Thuis ingeschakeld", + "fr": "Armé partiel", + "it": "Parziale attivo", + "no": "Devis aktivert / Hjemmemodus", + "sv": "Hemmaläge aktiverat", + "da": "Tilkoblet hjemme", + "es": "Armado parcial" + } + }, + { + "id": "armed_away", + "label": { + "en": "Armed Away", + "de": "Abwesend gesichert", + "nl": "Inschakelen bij afwezigheid", + "fr": "Armé total", + "it": "Totale attivo", + "no": "Fullt aktivert / Borte", + "sv": "Bortatillstånd aktiverat", + "da": "Tilkoblet ude", + "es": "Armado total" + } + }, + { + "id": "armed", + "label": { + "en": "Armed (General)", + "de": "Aktiviert (Allgemein)", + "nl": "Ingeschakeld (Algemeen)", + "fr": "Armé (Général)", + "it": "Attivato (Generale)", + "no": "Aktivert (Generell)", + "sv": "Aktiverad (Allmänt)", + "da": "Tilkoblet (Generelt)", + "es": "Armado (General)" + } + }, + { + "id": "entry_delay", + "label": { + "en": "Entry Delay / Countdown", + "de": "Eingangsverzögerung (Countdown)", + "nl": "Inloopvertraging (Aftellen)", + "fr": "Délai d'entrée (Compte à rebours)", + "it": "Ritardo d'ingresso (Conto alla rovescia)", + "no": "Inngangsforsinkelse (Nedtelling)", + "sv": "Inpasseringsfördröjning (Nedräkning)", + "da": "Indgangsforsinkelse (Nedtælling)", + "es": "Retardo de entrada (Cuenta atrás)" + } + }, + { + "id": "alarm", + "label": { + "en": "Burglar Alarm", + "de": "Einbruch-Alarm (Sirene)", + "nl": "Inbraakalarm (Sirene)", + "fr": "Alarme anti-intrusion (Sirène)", + "it": "Allarme antifurto (Sirena)", + "no": "Innbruddsalarm (Sirene)", + "sv": "Inbrottslarm (Sirén)", + "da": "Tyverialarm (Sirene)", + "es": "Alarme de intrusión (Sirena)" + } + }, + { + "id": "fire_alarm", + "label": { + "en": "Fire Alarm", + "de": "Feuer-Alarm", + "nl": "Brandalarm", + "fr": "Alarme incendie", + "it": "Allarme incendio", + "no": "Brannalarm", + "sv": "Brandlarm", + "da": "Brandalarm", + "es": "Alarma de incendio" + } + }, + { + "id": "gas_alarm", + "label": { + "en": "Gas Alarm", + "de": "Gas-Alarm", + "nl": "Gasalarm", + "fr": "Alarme gaz", + "it": "Allarme gas", + "no": "Gassalarm", + "sv": "Gaslarm", + "da": "Gasalarm", + "es": "Alarma de gas" + } + }, + { + "id": "medical_alarm", + "label": { + "en": "Medical Emergency", + "de": "Medizinischer Notruf", + "nl": "Medisch noodgeval", + "fr": "Urgence médicale", + "it": "Emergenza medica", + "no": "Medisinsk nødsituasjon", + "sv": "Medicinskt nödläge", + "da": "Medicinsk nødstilfælde", + "es": "Emergencia médica" + } + }, + { + "id": "code_not_accepted", + "label": { + "en": "Code Wrong", + "de": "Code falsch / Nicht akzeptiert", + "nl": "Code onjuist / Geweigerd", + "fr": "Code erroné / Refusé", + "it": "Codice errato / Non accettato", + "no": "Feil kode / Ikke akseptert", + "sv": "Felaktig kod / Nekad", + "da": "Forkert kode / Ikke accepteret", + "es": "Código incorrecto / Rechazado" + } + }, + { + "id": "bypass_challenge", + "label": { + "en": "Bypass Sensor Challenge", + "de": "Sensormeldung ignorieren", + "nl": "Sensormelding negeren (Bypass)", + "fr": "Ignorer l'alerte capteur (Bypass)", + "it": "Ignora avviso sensore (Esclusione)", + "no": "Ignorer sensorvarsel (Forbikobling)", + "sv": "Imonitera sensorvarning (Bypass)", + "da": "Ignorer sensorfejl (Bypass)", + "es": "Ignorar aviso de sensor (Anulación)" + } + }, + { + "id": "exit_delay", + "label": { + "en": "Exit Delay / Countdown", + "de": "Ausgangsverzögerung (Countdown)", + "nl": "Uitloopvertraging (Aftellen)", + "fr": "Délai de sortie (Compte à rebours)", + "it": "Ritardo d'uscita (Conto alla rovescia)", + "no": "Utgangsforsinkelse (Nedtelling)", + "sv": "Utpasseringsfördröjning (Nedräkning)", + "da": "Udgangsforsinkelse (Nedtælling)", + "es": "Retardo de salida (Cuenta atrás)" + } + } +] + ] + }, + { + "name": "custom_value", + "type": "number", + "min": 1, + "max": 255, + "placeholder": "1" + } + ] +} ] -} \ No newline at end of file +} diff --git a/drivers/4AK1SZ-0EU0/driver.js b/drivers/4AK1SZ-0EU0/driver.js index 17d8200..cea8a6b 100644 --- a/drivers/4AK1SZ-0EU0/driver.js +++ b/drivers/4AK1SZ-0EU0/driver.js @@ -22,9 +22,16 @@ class RingDriver extends Homey.Driver { .registerRunListener( async (args, state) => { args.device.soundChime(args.chime,args.volume); return Promise.resolve( true ); - }); + }); + + this.homey.flow.getActionCard('4AK1SZ-0EU0-setKeypadMode') + .registerRunListener(async (args, state) => { + await args.device.setKeypadMode(args.mode, args.custom_value); + + return Promise.resolve(true); + }); } } -module.exports = RingDriver; \ No newline at end of file +module.exports = RingDriver;