Openhabian Benachrichtung bei Waschmaschine / Spühlmaschine / Trockner fertig

6/30/2022 10:22:21 PM by Chris 782
Teile: Raspberry Pi 4 mit allen Teilen: https://amzn.to/3C7hNik Raspberry Pi 4 einzeln: https://amzn.to/3Anip2j Raspberry Pi 4 Netzteil: https://amzn.to/3Ppu4St Raspberry Pi 4 Gehäuse: https://amzn.to/3Qjjmhz M.2 fürs Argon Gehäuse: https://amzn.to/3JSvYdf Shelly Plug S für Strommessung: https://amzn.to/3phUrz1 Shelly Plus 1PM 2er Pack https://amzn.to/3Ct9EoT **Admin** -> **Einstellungen** -> **Rules** -> + Name eingeben No template Trigger: ShellyPlugSSpuehlmaschine_Leistung oder SP112_WaschmaschineENERGYPower und changed \ Then: Run Script -> Design with Blockly Regel wie gewünscht zusammenklicken. Ich hab ein if do else if in dem die leistung auf > 2 geprüft wird. dann wird eine variable auf 1 gesetzt. im else if wird auf leistung < 2 und variable == 1 geprüft. wenn das zutrifft wird variable wieder auf 0 gesetzt. dazwischen kann man die notifys machen. speichern und einmal als code anzeigen lassen, dann sollte alles als ECMA Skript zu sehen sein. bei mir war jetzt das problem das die leistung / power immer mit Watt / W am ende war. Das korrigieren wir jetzt im ECMA Skript / JavaScript. Am Ende sollte das so aussehen. FYI hier ist das Telegrambinding installiert. ``` js var status2; var things = Java.type('org.openhab.core.model.script.actions.Things'); var state = itemRegistry.getItem('ShellyPlugSSpuehlmaschine_Leistung').getState(); var watt = parseFloat(state);//.replace("W", ""); if (watt > 2) { things.getActions('telegram', 'telegram:telegramBot:189b9b4').sendTelegram('Spülmaschine ist an'); status2 = 1; } else if (watt < 2 && status2 == 1) { things.getActions('telegram', 'telegram:telegramBot:189b9b4').sendTelegram('Spülmaschine fertig'); status2 = 0; } things.getActions('telegram', 'telegram:telegramBot:189b9b4').sendTelegram(watt); ```


About author

Chris

Moin, hier sollte ein Text über mich stehen, ggf reiche ich den noch nach, ggf nicht. Manchmal ist es doch auch ganz schön keine Infos über einen Author zu haben :-)


Scroll to Top