Pittini / iobroker-Fensterauswertung

Zählt geöffnete Fenster pro Raum und gesamt. Kann einmalig oder zyklisch an offene Fenster erinnern. Erzeugt Lüftungswarnung uvm.
MIT License
42 stars 15 forks source link

Add support for more Alexa-Devices #29

Closed ThomasDreamForce closed 3 years ago

ThomasDreamForce commented 3 years ago

I have enhanced this script for my personal use and needed more Alexa-Devices to speak announcements.

Sorry for not using diff and such, I'll have to learn it but for now I'll just add my changed code here:

const UseAlexa = true; // Sollen Nachrichten via Alexa ausgegeben werden?
const AlexaId = ""; // Die Alexa Seriennummer.
const AlexaId2 = ""; // Die Alexa Seriennummer.
const AlexaId3 = ""; // Die Alexa Seriennummer.
const AlexaId4 = ""; // Die Alexa Seriennummer.

and later on:

            if (UseAlexa) {
                if (AlexaId != "") setState("alexa2.0.Echo-Devices." + AlexaId + ".Commands.announcement"/*announcement*/, msg);
                if (AlexaId2 != "") setState("alexa2.0.Echo-Devices." + AlexaId2 + ".Commands.announcement"/*announcement*/, msg);
                if (AlexaId3 != "") setState("alexa2.0.Echo-Devices." + AlexaId3 + ".Commands.announcement"/*announcement*/, msg);
                if (AlexaId4 != "") setState("alexa2.0.Echo-Devices." + AlexaId4 + ".Commands.announcement"/*announcement*/, msg);
            };

This enhances the script to 4 Alexa devices. It's a quick hack and it would be more elegant to use an array for this, which would make it possible to use as many alexa devices as needed dynamically, but I'm lazy ;-)

Pittini commented 3 years ago

Sorry, but no. Surely you can use this if you need it, but i think thats too special for most usecases. For cases like that, you can define a global Funktion "Say", then activate UseSay in the Skript and pack all 1000 Alexacalls in your global Say Skript.

ThomasDreamForce commented 3 years ago

Sorry, but no. Surely you can use this if you need it, but i think thats too special for most usecases. For cases like that, you can define a global Funktion "Say", then activate UseSay in the Skript and pack all 1000 Alexacalls in your global Say Skript.

Good idea! This seems to be a better solution which I'll adopt :) Cheers :) Thomas