iobroker.alexa-timer-vis
Advanced tools
Comparing version 0.1.6 to 0.1.7
{ | ||
"common": { | ||
"name": "alexa-timer-vis", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"news": { | ||
"0.1.7":{ | ||
"en":"New state,'Input Device'" | ||
}, | ||
"0.1.6":{ | ||
@@ -7,0 +10,0 @@ "en": "numbers from 1-9 are always displayed as two digits, 1 => 01" |
57
main.js
@@ -12,2 +12,3 @@ "use strict"; | ||
const utils = require("@iobroker/adapter-core"); | ||
// const { TIMEOUT } = require("dns"); | ||
@@ -61,3 +62,4 @@ // const { exists } = require("fs"); | ||
"time_start":"", | ||
"time_end":"" | ||
"time_end":"", | ||
"inputDevice":"", | ||
}, | ||
@@ -165,2 +167,3 @@ }, | ||
// Datenpunkte erzeugen (Anzahl) | ||
@@ -333,3 +336,3 @@ createState(4); | ||
const startTimer = (sec, name)=> { | ||
const startTimer = async (sec, name)=> { | ||
const startTimer = new Date().getTime(); // Startzeit Timer | ||
@@ -354,2 +357,3 @@ const start_Time = time(startTimer); | ||
} | ||
getInputDevice(timerObject.timer[index]); | ||
@@ -397,2 +401,3 @@ // Intervall erzeugen | ||
// Falls der Timername nicht definiert ist soll er einfach nur "Timer" heissen | ||
@@ -421,2 +426,3 @@ if(name == ""|| name == null || name == undefined){ | ||
timer.time_end = "00:00:00"; | ||
timer.inputDevice =""; | ||
@@ -465,3 +471,3 @@ clearInterval(timerObject.interval[index.slice(5)]); | ||
name: "Hours", | ||
type: "number", | ||
type: "string", | ||
role: "value", | ||
@@ -478,3 +484,3 @@ read: true, | ||
name: "Minutes", | ||
type: "number", | ||
type: "string", | ||
role: "value", | ||
@@ -491,3 +497,3 @@ read: true, | ||
name: "Seconds", | ||
type: "number", | ||
type: "string", | ||
role: "value", | ||
@@ -548,2 +554,14 @@ read: true, | ||
}); | ||
this.setObjectNotExistsAsync("timer" + i + ".InputDeviceName", { | ||
type: "state", | ||
common: { | ||
name: "Input of Device", | ||
type: "string", | ||
role: "value", | ||
read: true, | ||
write: true, | ||
def: "", | ||
}, | ||
native: {}, | ||
}); | ||
} | ||
@@ -557,2 +575,23 @@ } catch (e) { | ||
/** | ||
* Eingabegerät ermitteln | ||
* | ||
* | ||
*/ | ||
const getInputDevice = (a)=>{ | ||
this.getForeignObject("alexa2.0.History.name", async (err, obj) => { | ||
if (err || obj == null) { | ||
// Error | ||
this.log.error(`The State "name" of Alexa was not found!`); | ||
a.inputDevice = "-"; | ||
} else { | ||
const obj = await this.getForeignStateAsync("alexa2.0.History.name"); | ||
// @ts-ignore | ||
a.inputDevice = obj.val; | ||
} | ||
}); | ||
}; | ||
/** | ||
* Funktion der Erfassung der gewünschten Zeit und des Namen | ||
@@ -655,3 +694,3 @@ * Erstellt einen String in einem Array [0], um Sekunden berechnen zu können | ||
writeState(false); | ||
//this.log.info(JSON.stringify(timerObject.timerActiv.timer)); | ||
// this.log.info(JSON.stringify(timerObject.timer.timer1)); | ||
//this.log.info(JSON.stringify(timerObject.timerActiv.timerCount)); | ||
@@ -693,2 +732,3 @@ // Aktualisierungs Intervall stoppen | ||
timer.name = "Timer"; | ||
timer.inputDevice =""; | ||
alive = false; // all_Timer.alive | ||
@@ -707,2 +747,3 @@ }else { | ||
this.setStateChanged(element + ".TimeEnd", timer.time_end, true); | ||
this.setStateChanged(element + ".InputDeviceName", timer.inputDevice, true); | ||
this.setStateChanged("all_Timer.alive", alive, true); | ||
@@ -737,6 +778,8 @@ // Wenn der Name des Timers nicht definiert ist soll einfach nur Timer ausgegeben werden | ||
// You can also add a subscription for multiple states. The following line watches all states starting with "lights." | ||
// this.subscribeStates("lights.*"); | ||
// Or, if you really must, you can also watch all states. Don't do this if you don't need to. Otherwise this will cause a lot of unnecessary load on the system: | ||
// this.subscribeStates("*"); | ||
//this.subscribeStates("*"); | ||
@@ -743,0 +786,0 @@ /* |
{ | ||
"name": "iobroker.alexa-timer-vis", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Alexa Timer ausgeben um in der Vis anzuzeigen", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -96,2 +96,4 @@ ![Logo](admin/alexa-timer-vis.png) | ||
## Changelog | ||
### 0.1.7 (22.06.2022) | ||
* New State, "Input Device" | ||
### 0.1.6 (17.01.2022) | ||
@@ -98,0 +100,0 @@ * numbers from 1-9 are always displayed as two digits, 1 => 01 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
205368
992
146