Fibaro Home Center & LUA: How to get a notification about your household appliances on your smartphone!
In this article we will show you how to get push notifications regarding the status of your household appliance on your smartphone or via audio response with Amazon Alexa.
In this tutorial you will learn how you can create a push notification on your smartphone of the household appliance status with your Fibaro Home Center and a LUA scene. Also we will show you how Alexa gives an audio response of the machines status or you can create a LED stripe notification. We will show you a step-by-step instruction using our dishwasher as example. Of course it’s also possible with other machines like a washing machine or dryer.
General information
For the hardware you’ll need a Fibaro Home Center and a Wall Plug. It’s important that you don’t use a switch only, but an adapter with current measurement, so that you can supervise the energy in your Home Center. Also the switch should be compatible with Z-Wave.
In this example we will integrate the dishwasher into our smart home system.Therefore, it will be possible to receive a push notification on your smartphone/device when the dishwasher finished his rinsing process. Also your Alexa will give an audio response in term of a text-to-speech message and additionally the LED stripe, which can for example be installed under the dishwasher, will give an announcement about the status of the machine. This could be a colour change into blue to show that the dishwasher is finished.
Scene for the Wall Plug
First of all we have to add the Fibaro Wall Plug to our Home Center. After this, we can create a new scene, which has to supervise the Wall Plug and informs us about the status of our dishwasher (or any other household appliance). Therefore, add a new LUA scene. You can allocate a name and a room to this scene. Then click on “Advanced” and insert the following script into this scene:
--[[ %% properties xxx power %% weather %% events --]] if (fibaro:countScenes()>1) then fibaro:abort(); end --[[ What is the script about? With this script you can check your household appliances like the washing mashine, dryer or the dish washer, when they finished their work process. Also you can observe when the mashines change into stand by and you can react according to that. The script was created by Nico Bode from https://www.intelligentes-haus.de/. You find the instruction and the video here: https://www.intelligentes-haus.de/2018/01/13/fibaro-home-center-lua-how-to-get-a-notification-about-your-household-appliances-on-your-smartphone/ Instructions: device_id = The ID of the machine which you want to check. For example: The ID of the Wall Plug of the washing mashine power_on = The number of watt when the washing mashine is active -> check the consumption in your Home Center (and choose the suitable device for it) power_standby = The number of watt when the mashine is not active (stand by) standby_secounds = How long the mashine should not be active (stand by) until it is finished global_var_name = Name of variables for saving the status: example: washingmashine_run or dryer_run -> 0 = washing mashine is not active; 1 = washing mashine is active Please add the ID of the Wall Plug into the code at the beginning (Properties). Change 157 with your ID. This is the trigger. Further down in this script (ca. till line 90) you can describe what should happen with the mashine/s. --]] local device_id = 157; local power_on = 50; -- From how many watts is the machine on example 100 local power_standby = 8; -- From how many watts is the machine finished example 10 local standby_secounds = 10; --how long has Stanby really had to be done with it? local global_var_name = 'dishwasher_run'; -- exampale waschmaschine_run oder trocker_run local debug_mode = true; -- zeig dann mehr infos im debug fenster an false /true if (fibaro:getGlobal(global_var_name) ~= nil) then if(debug_mode == true) then fibaro:debug('Variable ' ..global_var_name.. ' is created.'); end else fibaro:debug('Variable ' ..global_var_name.. ' isn`t created. Please Create it Panels -> Variables Panel'); end if(debug_mode == true) then fibaro:debug('Scene start '); end if (tonumber(fibaro:getValue(device_id, "power")) >= power_on and tonumber(fibaro:getGlobalValue(global_var_name)) == 1) then if(debug_mode == true) then fibaro:debug('The machine still seems to be running!'); end end if (tonumber(fibaro:getValue(device_id, "power")) >= power_on and tonumber(fibaro:getGlobalValue(global_var_name)) == 0) then fibaro:debug('Device was started'); fibaro:setGlobal(global_var_name, "1"); end local is_device_off_real = true; if (tonumber(fibaro:getValue(device_id, "power")) <= power_standby and tonumber(fibaro:getGlobalValue(global_var_name)) == 1) then fibaro:debug('Smaller then '..power_standby..' Watt check is really end!'); local i = 1; while(i <= standby_secounds) do if (tonumber(fibaro:getValue(device_id, "power")) <= power_standby and is_device_off_real == true) then if(debug_mode == true) then fibaro:debug(''..i..' Secound smaller then '..power_standby..' Watt'); end else if(debug_mode == true) then fibaro:debug(''..i..' over '..power_standby..' Watt maschine isnt finish'); end is_device_off_real = 0; i = standby_secounds; end if(is_device_off_real == true) then fibaro:sleep(1000); end i = i + 1 end if(is_device_off_real == true) then --[[ from here things should happen when the device is done! example: Send Push, TextTo Speech, Light on .. --]] fibaro:debug('Device is finish'); fibaro:setGlobal(global_var_name, 0); -- this do not change -- example send push: --fibaro:call('add here your iphone/android device id', "sendPush", "Waschmaschine ist fertig!"); -- example TTS Alexa see tutorial: http://www.intelligentes-haus.de/2018/06/26/alexa-text-to-speech-tts-uber-fibaro-zentrale-nutzen/ --fibaro:setGlobal('tts_alexa_device', 'office'); --fibaro:setGlobal('tts_alexa_text', 'Die Waschmaschine ist fertig'); --fibaro:startScene(117); -- example set rgbw on and after 10 secount to off 579 = your is from rgbw --fibaro:call(579, "setBrightness", "100"); --fibaro:call(579, "setColor", "0","255","255","255"); --fibaro:call(579, "turnOn"); --fibaro:sleep(10000); --fibaro:call(579, "turnOff"); --[[ end things add --]] else fibaro:debug('Device is not finish!'); end end if(debug_mode == true) then fibaro:debug('Scene end'); end
Then adapt the values in the scene with your values. For example, you have to insert at the beginning the ID of your Wall Plug. All the other values have to be changed too. For more information you can watch the video!
You can also define the rate of consumption of your Wall Plug. For more details about it, click in your Home Center on “consumption”. Now you can choose a device like the Wall Plug and you’ll find the power consumption of this device. You can also adapt these values to your scene.
Besides, you need a global variable. In our case we need a variable for our dishwasher, because we would like to monitor it. For adding this variable, click on “Panels” – “Variables Panels”.
Tip
At the end, the configuration ist completed. The scene works now, but to receive a status notification of your dishwasher you have to adapt more values inside the scene.
Create a push notification
Create a push notification For creating the different notifications you’ll find the part of the script down below. You have to adapt there a few things too.
Here you can change the texts which will be used for the notifications. Besides, you need two different global variables for the IDs of your smartphone/s, which you can register manually. You’ll need the Fibaro App for your iPhone or Android Smartphone to find out the ID of your phone. Then you have to call up this link: “IP address of your Home Center/api/devices/”. On the following site you can search for the ID of your mobile phone and register it in your scene, so you will get push notification on your phone.
It’s possible to install a text-to-speech function with Alexa as well. How this works, we will show you in new tutorials in near future here on our website and on our Youtube Channel. You will learn to install text-to-speech with your Bose Soundtouch System too
Notifications with a graphic scene
Notifications with a graphic scene If you don’t know LUA very well and it’s difficult for you to work with it, you can also create notifications with a graphic scene. For this step, add a new graphic scene in your Home Center and delete the part for the notifications in your LUA scene.
Then you have to add an if-condition with the variable of your dishwasher. Set the value to “0”. Now you can add the push notification with a text which you have to create first about “Panels” and “Notifications Panel”.
It’s also possible to add more things in your graphic scene. For example, you can switch on your LED stripes for a few seconds with different colours. Search for the suitable device and choose it. You can also choose a colour and adapt the values in one’s sole discretion. For configurate the colour you’ll find the menu “Devices” in your Home Center. Here you can search for the light you want to use and the suitable colour. The value of the colour is necessary for the graphic scene. For sure, you can turn on the light with the scene, but also don’t forget to turn it off with a final condition in the scene. You can define the time for turning on the light in the scene as well.
Ready to use!
After finishing all steps, you can now start your dishwasher and receive notifications for the status of the machine at the end cleaning process. When the dishwasher finished it’s rinsing process, you will get a push notification on your smartphine, an audio response via Alexa or your LED stripe will flash – depending on the parameters you’ve defined before.
Servus,
ich hab mir dein Video angeschaut, weil ich mir erhofft habe meine bisherige Szene optimieren zu können. Ich wollte bei meiner Push-Nachricht eine Überschrift darstellen, aber du machst das genau so wie ich bis jetzt.
Aber du könntest, wenn du erlaubst dass ich dich hier etwas verbessere, die Benachrichtigung eleganter lösen;
Erstelle ein Array mit so vielen IDs darin, wie du willst und lass nachher in der Routine alle Items des Arrays nacheinander benachrichtigen. Im Code sieht das so aus:
local phoneID = {111, 222, 333, 444} — Trage hier beliebig viele GeräteIDs ein
for i=1, #phoneID do
if phoneID[i] ~= nil then
–print(‘Versende Push an ID ‘ ..phoneID[I])
fibaro:call(phoneID[i],’sendPush’, (os.date(“%d.%m.%Y %H:%M:%S”, os.time()))..’ Spülmaschine ist fertig!’)
end
end
wie gesagt, wäre nur n Vorschlag – du kannst bequem oben die IDs ändern oder erweitern und hast unten in der Schleife nur Variablen 🙂
Grüße Andreas
Hallo,
kann man die scene so ändern, dass sie sagen wir mal alle 5minute erinnert ?