NEWS
Script Hilfe
-
Servus Gemeinde, ich habe ein script für meine Klingel was soweit aus funktioniert nur was mich stört, ich bekomme (sendTo) immer 3-5 nachrichten obwohl ich nur ein benötige und was mich auch stört, eh die Alexa sagt "Jemand steht vor der Tür dauert es ja ewig da ist die Person schon wieder weg, woran könnte das liegen?
danke grüße
const idtaster = 'hm-rpc.0.MEQ0485030.1.STATE' const ALEXA = []; ALEXA[0] = /*AZ*/ ['alexa2.0.Echo-Devices.G0911M07940632RE.Commands.speak', 'alexa2.0.Echo-Devices.G0911M07940632RE.Commands.speak-volume']; ALEXA[1] = /*SZ*/ ['alexa2.0.Echo-Devices.G0911M0894370XXL.Commands.speak', 'alexa2.0.Echo-Devices.G0911M0894370XXL.Commands.speak-volume']; ALEXA[2] = /*WZ*/ ['alexa2.0.Echo-Devices.G090LF0964340WK2.Commands.speak', 'alexa2.0.Echo-Devices.G090LF0964340WK2.Commands.speak-volume']; function klingel() { for (let i = 0; i < ALEXA.length; i++) { if(idtaster) { setState(ALEXA[i][1], 40); setState(ALEXA[i][0], "Jemand steht vor der Tür"); sendTo('telegram.0', { text: 'Jemand steht vor der Tür' }); setTimeout(function(){ setState(idtaster,false); },500); }; } }; on(idtaster, function(dp) { if(dp.state.val) { klingel(); } }); -
Servus Gemeinde, ich habe ein script für meine Klingel was soweit aus funktioniert nur was mich stört, ich bekomme (sendTo) immer 3-5 nachrichten obwohl ich nur ein benötige und was mich auch stört, eh die Alexa sagt "Jemand steht vor der Tür dauert es ja ewig da ist die Person schon wieder weg, woran könnte das liegen?
danke grüße
const idtaster = 'hm-rpc.0.MEQ0485030.1.STATE' const ALEXA = []; ALEXA[0] = /*AZ*/ ['alexa2.0.Echo-Devices.G0911M07940632RE.Commands.speak', 'alexa2.0.Echo-Devices.G0911M07940632RE.Commands.speak-volume']; ALEXA[1] = /*SZ*/ ['alexa2.0.Echo-Devices.G0911M0894370XXL.Commands.speak', 'alexa2.0.Echo-Devices.G0911M0894370XXL.Commands.speak-volume']; ALEXA[2] = /*WZ*/ ['alexa2.0.Echo-Devices.G090LF0964340WK2.Commands.speak', 'alexa2.0.Echo-Devices.G090LF0964340WK2.Commands.speak-volume']; function klingel() { for (let i = 0; i < ALEXA.length; i++) { if(idtaster) { setState(ALEXA[i][1], 40); setState(ALEXA[i][0], "Jemand steht vor der Tür"); sendTo('telegram.0', { text: 'Jemand steht vor der Tür' }); setTimeout(function(){ setState(idtaster,false); },500); }; } }; on(idtaster, function(dp) { if(dp.state.val) { klingel(); } }); -
@fischi87
Anstelle der for-Schleife verwende ein Intervall für Alexa. sendTo() muss außerhalb der Schleife (des Intervalls) aufgerufen werden. -
@fischi87
Anmerkung: Mit Alexa kenne ich mich überhaupt nicht aus.var timer = 0; function klingel() { let i = 0; timer = setInterval(function() { setState(ALEXA[i][1], 40); setState(ALEXA[i][0], "Jemand steht vor der Tür"); i++; if(i >= ALEXA.length) clearInterval(timer); }, 200); sendTo('telegram.0', { text: 'Jemand steht vor der Tür' }); setTimeout(function(){ setState(idtaster,false); }, 600); } -
@fischi87
Anmerkung: Mit Alexa kenne ich mich überhaupt nicht aus.var timer = 0; function klingel() { let i = 0; timer = setInterval(function() { setState(ALEXA[i][1], 40); setState(ALEXA[i][0], "Jemand steht vor der Tür"); i++; if(i >= ALEXA.length) clearInterval(timer); }, 200); sendTo('telegram.0', { text: 'Jemand steht vor der Tür' }); setTimeout(function(){ setState(idtaster,false); }, 600); } -
@paul53 ist der Interval dafür da wie schnell Alexa spricht? dauert nämlich immer noch etwas bis Alexa was sagt.
-
@fischi87 sagte:
dauert nämlich immer noch etwas bis Alexa was sagt.
Was ist etwas ? Die erste Verzögerung ist 200 ms.
-
@paul53
ich habe es jetzt nicht gestoppt aber ich schätze mindestens 2-6 sek. mal 2 mal 4 mal 6 sek. -
hallo paul, ich habe das jetzt so integriert. der Timer in Zeile 13 und 17 wird rot unterlegt, ist dies relevant?
const idtaster = 'hm-rpc.0.MEQ0485030.1.STATE' const ALEXA = []; ALEXA[0] = /*AZ*/ ['alexa2.0.Echo-Devices.G0911M07940632RE.Commands.speak', 'alexa2.0.Echo-Devices.G0911M07940632RE.Commands.speak-volume']; ALEXA[1] = /*SZ*/ ['alexa2.0.Echo-Devices.G0911M0894370XXL.Commands.speak', 'alexa2.0.Echo-Devices.G0911M0894370XXL.Commands.speak-volume']; ALEXA[2] = /*WZ*/ ['alexa2.0.Echo-Devices.G090LF0964340WK2.Commands.speak', 'alexa2.0.Echo-Devices.G090LF0964340WK2.Commands.speak-volume']; var timer = 0; function klingel() { let i = 0; timer = setInterval(function() { setState(ALEXA[i][1], 40); setState(ALEXA[i][0], "Jemand steht vor der Tür"); i++; if(i >= ALEXA.length) clearInterval(timer); }, 200); sendTo('telegram.0', { text: 'Jemand steht vor der Tür' }); setTimeout(function(){ setState(idtaster,false); }, 600); } on(idtaster, function(dp) { if(dp.state.val) { klingel(); } }); -
hallo paul, ich habe das jetzt so integriert. der Timer in Zeile 13 und 17 wird rot unterlegt, ist dies relevant?
const idtaster = 'hm-rpc.0.MEQ0485030.1.STATE' const ALEXA = []; ALEXA[0] = /*AZ*/ ['alexa2.0.Echo-Devices.G0911M07940632RE.Commands.speak', 'alexa2.0.Echo-Devices.G0911M07940632RE.Commands.speak-volume']; ALEXA[1] = /*SZ*/ ['alexa2.0.Echo-Devices.G0911M0894370XXL.Commands.speak', 'alexa2.0.Echo-Devices.G0911M0894370XXL.Commands.speak-volume']; ALEXA[2] = /*WZ*/ ['alexa2.0.Echo-Devices.G090LF0964340WK2.Commands.speak', 'alexa2.0.Echo-Devices.G090LF0964340WK2.Commands.speak-volume']; var timer = 0; function klingel() { let i = 0; timer = setInterval(function() { setState(ALEXA[i][1], 40); setState(ALEXA[i][0], "Jemand steht vor der Tür"); i++; if(i >= ALEXA.length) clearInterval(timer); }, 200); sendTo('telegram.0', { text: 'Jemand steht vor der Tür' }); setTimeout(function(){ setState(idtaster,false); }, 600); } on(idtaster, function(dp) { if(dp.state.val) { klingel(); } });