Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,


as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.


As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!



Smart Home Forum by FIBARO Team

Appliance monitoring scene 1.0.0

   (0 reviews)

About This File

Holidays are almost here! So here is one more gift for you! Just maybe you will find it useful and it looks like this in HC webGUI:

Appliance monitoring.jpg



This scene can monitor any appliance for power consumption and send push and/or popup notification when appliance start working and/or when it is finished. You can also select to switch it off when is done or leave it under power. There are more and more smart appliances on the market but still suffering from "baby" problems. We also buy Candy washing machine with WiFi and smart app but it just refuses to connect, or if I manage to connect it disconnects itself after one wash. No need to mention that manufacturers of such appliances like to hide API. Because of that we are still using benefits of smart plugs and relay modules to monitor our appliances. So this is how this scene works. It is triggered by power consumption from smart plug or relay module to which appliance is connected. It is possible to set minimum power in watt and duration for how long will scene run until recognizes that appliance is finished. There are only two global variables to be defined. One is already known "HomeTable" and another one with name up to you which is set while appliance is working and reset when is finished as explained bellow:



"HomeTable"       - predefined global variable table with device and scene IDs. Recommended to use since z-wave devices can change their ID with re-inclusion and then is necessary  to edit only scene which make this table and only device ID in scene headers. Much less time and effort is needed than without that option! But if you don't use this feature then you MUST delete following lines from scene:

-- get the table from global if not using then delete this line!!!
local jT  = json.decode(fibaro:getGlobalValue("HomeTable"))

"applianceStatus"   - you can use any name like "WashingMachine" or "DishWasher" depending on appliance you plan to monitor. There are two values "On" and "Off" that you can map with your values and then setup in scene code like this:

-- enter name of your global variable for monitoring state of appliance and
-- map your values for "On" and "Off"
local applianceStatus        = "WashingMachine";
local applianceStatusMapping = {On="On", Off="Off"};


After setting up global variables you still need to setup several things like deviceID (ID number of smart plug or relay module), deviceMinPower which defines under what power in watt device stopped working and is in standby, some text for push and popup notifications and you can start using this scene to monitor your appliance. See bellow setup example for washing machine:

-- APPLIANCE CONTROL DEVICE SETUP -------------------------------------------
-- enter device ID which is used to control appliance and measure power
-- consumption. Do not forget to put this ID in scene header under
-- %% properties
-- 100 power
local deviceID           = 100;
-- enter minimum power in Watt bellow which appliance is stopped or in
-- standby mode
local deviceMinPower     = 2;
-- enter time in minutes after which scene will send message that appliance
-- is done and stopped. This time delay is necessary for many modern washing
-- machines due to electronic drive controls
local deviceStopDuration = 3;
-- enter here "Yes" if you want to switch off appliance when is done and
-- stopped or "No" if you want to leave it on
local deviceTurnOff      = "No";

-- USERS, PUSH AND POPUP NOTIFICATION SETUP ---------------------------------
-- define users to send push messages
local userID   = {jT.ios.wife, jT.ios.mistress};
-- flag for each user; if 1 then send notifications else if 0 do not
-- send notifications. You can add code in function extraUserCodeFirst()
-- where you can change user flags depending on some global variable.
local userFlag = {1, 1};

-- PUSH MESSAGES SETUP ------------------------------------------------------
-- enter push message text for the appliance start and stop event
local pushMessage = {start = "Washing machine is started",
                     stop  = "Washing machine is stopped"};
-- enter "Yes" if you want to receive push notification that appliance
-- started working else put "No"
local pushStart = "No";
-- enter "Yes" if you want to receive push notification that appliance
-- finished working else put "No"
local pushStop  = "Yes";

-- POPUP MESSAGES SETUP -----------------------------------------------------
-- enter popup message text and button caption for the appliance start and 
-- stop
local popupMainTitle         = "WASHING MACHINE";
local popupTimeFormat        = "%H:%M:%S | %d.%m.%Y.";
local popupContentTitleStart = "Washing machine is started";
local popupContentTitleStop  = "Washing machine finished";
local popupContentBodyStart  = "Washing machine is working";
local popupContentBodyOn     = "Washing machine is not turned Off";
local popupContentBodyOff    = "Washing machine is turned Off";
local popupImgUrl            = "";
local popupButtonCaption     = "OK";
-- enter "Yes" if you want to receive popup notification that appliance
-- started working else put "No"
local popupStart = "No";
-- enter "Yes" if you want to receive popup notification that appliance
-- finished working else put "No"
local popupStop  = "No";

It seems a lot but it is actually more of my comments and explanations than real code to setup :-P . Just to mention that scene has two functions where you can add your own code to do something. Function extraUserCodeFirst() is executed before sending push/popup notification that appliance is started and function extraUserCodeLast() is executed just before sending push/popup notification that appliance is finished and stopping scene. I use them too :-)  For example I alway add code to change flags to whom push messages will be sent in function extraUserCodeFirst(). First I add two global variables under -- EXTRA GLOBAL VARIABLE SETUP --------- section of the code:

-- EXTRA GLOBAL VARIABLES ---------------------------------------------------
-- here you can add your extra global variables to enhance features of this
-- scene:
-- for all those daddies and momies who work away from home to lower number of 
-- notifications while at work possible values: "Yes", "No"
local dadAway             = "DadAway";
local dadAwayMapping      = {Yes="Yes", No="No"};
local momAway             = "MomAway";
local momAwayMapping      = {Yes="Yes", No="No"};

And then I add simple code to change userFlags in function extraUserCodeFirst() if we are at work and don't want to be disturbed by push messages from our Angelina:

-- EXTRA FUNCTION WHERE YOU CAN ADD YOUR CODE ----------------------------
-- use this function to add code that will be executed before loop is
-- started and push adn popup notifications are sent
function extraUserCodeFirst()
  -- your code goes here
  if dadAway ~= "" then
    if fibaro:getGlobalValue(dadAway) == dadAwayMapping.Yes then
      userFlag[1] = 0;
  if momAway ~= "" then
    if fibaro:getGlobalValue(momAway) == momAwayMapping.Yes then
      userFlag[2] = 0;
  if deBug then logbug("yellow", "User extra code before loop executed") end;


Please, also check video from @MarcoTorino71:




Edited by Sankotronic
Added video from @MarcoTorino71

User Feedback

You may only provide a review once you have downloaded the file.

There are no reviews to display.

  • Create New...