Pushnotification when dishwasher/washing machine is ready?

Moderator: leecollings

plutonium
Posts: 18
Joined: Tuesday 06 August 2013 19:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7253
Location: Sweden
Contact:

Pushnotification when dishwasher/washing machine is ready?

Post by plutonium »

Hi..

I trying to figuer out how I'm gona get notification when the dishwasher is finish. I thought that you could create a Event like the picture. But I don't receive any notification, maybe the Event function don't work like I thought.

I have tried the Notification at the #Utility but it doesn't seems to work. It works first time, but when I put a load and then turn the load of it won't send any.
Then I want to customize the message, so I hope someone can help me to get this to work with Event instead or maybe a lua script.

Thanks for the help.

event.jpg
event.jpg (62.52 KiB) Viewed 12481 times
Last edited by plutonium on Thursday 15 August 2013 14:57, edited 1 time in total.
bistoury
Posts: 35
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: Create a Event or Lua to get push notification when..

Post by bistoury »

I would suggest to have a dummy virtual device (switch) that is ON or OFF dépending on the state of your dishwasher. Then you'll get notification when it is set to OFF.

Then you have to make a script to set this dummy device to ON or OFF depending on the load.
For that you can use the IF / ELSE IF block :
IF dummy_device = OFF and dishwasher_load >= 20 then
DO SET dummy_device = ON
ELSE IF dummy_device = ON and dishwasher_load < 20 then
DO SET dummy_device = OFF

You can either put notification in blocky or in the dummy switch itself (blocky is more flexible on the text message)

This should do the trick.

Regards,

Bistoury.
plutonium
Posts: 18
Joined: Tuesday 06 August 2013 19:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7253
Location: Sweden
Contact:

Re: Create a Event or Lua to get push notification when..

Post by plutonium »

Thanks!

It's look like that the value doesn't register some how.. I made a simple Event that when the consumption whent down it turn on my livingroom lights, but even that dosen't work.
IF device < value (watt)
do livingroom = on

What can be wrong here? If i look in the Show Current states I see that the value on my consumption changes..
bistoury
Posts: 35
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: Create a Event or Lua to get push notification when..

Post by bistoury »

I would suggest to try doing it in LUA.
if it does not work in lua, then it won't in blocky.

Have a look at simple exemples, should should be able to replicate with your own simple test.

cheers,

bistoury.
plutonium
Posts: 18
Joined: Tuesday 06 August 2013 19:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7253
Location: Sweden
Contact:

Re: Create a Event or Lua to get push notification when..

Post by plutonium »

Hi, I tried to make a lua script too see the consumption of my everspring stiwch/meter.. But it fails on me.

I have two Everspring meters one at the dishwasher and one at the washing machine. When I enable the line

Code: Select all

   for i, v in pairs(otherdevices_svalues) do print(i, v) end
in the demo script,
I can see the consumption on my washing machine meter in logs but not in for the dishwasher, it always give me the value 15..
Why does it to that? I can se the energy consumption under #Utility and everything looks fine therefor both meters.
plutonium
Posts: 18
Joined: Tuesday 06 August 2013 19:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7253
Location: Sweden
Contact:

Re: Create a Event or Lua to get push notification when..

Post by plutonium »

Got it to register the consumption, hade to reinclude the device.

How can I rewrite the script below so that I only get one notification instead of thousands :)

Code: Select all

commandArray = {}
if (otherdevices_svalues['Diskmaskin'] < '20.0') then
--   commandArray['SendNotification']='Dishwasher#Is done!'
end
return commandArray
bistoury
Posts: 35
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: Create a Event or Lua to get push notification when..

Post by bistoury »

you should test first that your dishwasher was running (and it has now finished, i.e. its load is <=20w).

That' why I suggested first to have a dummy light switch that would be used has a boolean variable.

regards,

bistoury.
plutonium
Posts: 18
Joined: Tuesday 06 August 2013 19:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7253
Location: Sweden
Contact:

Re: Create a Event or Lua to get push notification when..

Post by plutonium »

I have emprement back and forth with the lua but I get a notification sporadic, I can't see a pattern.

This i my code:

Code: Select all

commandArray = {}

if (otherdevices_svalues['Diskmaskin'] > "4.0" and otherdevices['Dummy_diskmaskin'] == 'On') then

        commandArray['Dummy_diskmaskin']='Off'
        commandArray['SendNotification']='Huset#Diskmaskinen är på!'
        print('Diskmaskinen are on')

elseif (otherdevices_svalues['Diskmaskin'] < "4.0" and otherdevices['Dummy_diskmaskin'] == 'Off') then

        commandArray['SendNotification']='Huset#Diskmaskinen Ãr klar!'
        commandArray['Dummy_diskmaskin']='On'
        print('Disken are finish')

end

return commandArray

bistoury
Posts: 35
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: Create a Event or Lua to get push notification when..

Post by bistoury »

First, I would say the 1st IF should test IF the dummy_dishwasher is ON and IF the load is <4w ( not > !)

IF this does not work, try with nvalue instead of svalues (witht the double quote ")

Cheers
plutonium
Posts: 18
Joined: Tuesday 06 August 2013 19:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7253
Location: Sweden
Contact:

Re: Create a Event or Lua to get push notification when dish

Post by plutonium »

I figured it out!

It turns out that lua don't like decimals. So here is my solution that works very well :)
If the energy consumption is greater than 5watt then.....
Thansk bistoury for some input!


script_device_Energy.lua

Code: Select all

commandArray = {}

function removeDecimal(number)
        local num = number
        local num2 = tostring(num)
        local found = nil
        for i=1,100000 do
                if string.sub(num2,i,i) == "." then
                        found = i
                end
        end
        if type(found) == "number" then
                num2 = string.sub(num2,1,found-1)
        end
        num = tonumber(num2)
        return num
end


if (removeDecimal(otherdevices_svalues['Diskmaskin']) > 5 and otherdevices['Dummy_diskmaskin']=="Off") then

        commandArray['Dummy_diskmaskin']="On"
        commandArray['SendNotification']='Huset#Diskmaskinen är på!'

elseif (removeDecimal(otherdevices_svalues['Diskmaskin']) < 5 and otherdevices['Dummy_diskmaskin']=="On") then

        commandArray['Dummy_diskmaskin']="Off"
        commandArray['SendNotification']='Huset#Diskmaskinen är klar!'

end
return commandArray

User avatar
tommit01
Posts: 39
Joined: Friday 12 July 2013 14:08
Target OS: Raspberry Pi / ODroid
Domoticz version: multiple
Location: Germany / SL
Contact:

Re: Create a Event or Lua to get push notification when dish

Post by tommit01 »

Isn't there a build in truncate or round function in lua??

Br
Tommit
1 x RPi3
4 x RPI
3 x RPi2
1 x RPI2 + Win 10 IoT (experimental device)
2 x RPI2 Raspbian "Jessie" + Domoticz (for tenants)
2 x RPI OSMC @ 1GHz
1 RPi Zero W + Cam NOIR
1 RPi Zero W + Cam
RFXtrx 433 FW 1015
RFXtrx 433 E FW 1020
plutonium
Posts: 18
Joined: Tuesday 06 August 2013 19:06
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7253
Location: Sweden
Contact:

Re: Create a Event or Lua to get push notification when dish

Post by plutonium »

I have no idea. I just google it and found the function to manage it.
bistoury
Posts: 35
Joined: Friday 12 July 2013 14:14
Target OS: -
Domoticz version:
Contact:

Re: Create a Event or Lua to get push notification when dish

Post by bistoury »

As I am quite far away from home, I can't test LUA scripts.

I've seen somewhere that people use a tonumber(x) fonction. maybe this would work ?

I think such a loop is a basic function is a bit overkill, isn't it ?

bistoury.
asjmcguire
Posts: 71
Joined: Saturday 13 July 2013 2:45
Target OS: Linux
Domoticz version: 3.5877
Location: Scotland
Contact:

Re: Create a Event or Lua to get push notification when dish

Post by asjmcguire »

It's worth knowing that in pretty much every programming language under the sun - putting "" around text (numbers or letters) is telling the language that the content is to be treated as a string not a number.

In any case yes use tonumber will work properly.
val = tonumber(otherdevices_svalues['Diskmaskin'])
AEOTEC ZStick, 11 ZWave Nodes, RFXCOMM, 50ish Byron Sockets.. HE851 (PIR), 2x HE852 (DoorContact)
WS2300, CM180, CC128, 2xTHGR122NX, 2xPiZeroW w/DS18B20, 8Ch 1W Relay Board.
8 Panasonic IP Cams, 1 16ch CCTV DVR + 15 CCTV Cams
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Create a Event or Lua to get push notification when dish

Post by ThinkPad »

Is this script still working? I would like to get a pushnotification when my washing machine is ready. Receiving 2x Everspring plugs with power measurement tomorrow.

I found this script (for OpenHAB) which looks very nice: http://gathering.tweakers.net/forum/lis ... 3#43345963
It works like this:
If usage is higher then 10W, script becomes active.
If the usage stays below 5W for a period of 2 minutes, it will send a push notification.
I think that works a bit more sophisticated than only checking if device is lower than XX Watt. Otherwise if the washing machine stops for a few seconds (it does that when switching rotation direction) you would get a message immediately.

But unfortunately i am not a coder, so i think i can't get that script translated to Lua.
Actually the script from this topic and the topic i mentioned look quite the same (look if consumption > xx Watt & switch on virtual device)... But the timer part is too hard for me to implement.
Anybody willing to help?
I am not active on this forum anymore.
ropske
Posts: 483
Joined: Tuesday 12 August 2014 5:37
Target OS: Raspberry Pi / ODroid
Domoticz version: V3_8394
Location: Rumbeke,Belgium
Contact:

Re: Create a Event or Lua to get push notification when dish

Post by ropske »

@thinkpad:

I made a script for my washing machine:
When power consumption is higher than 1w and lower than 5w for a period of 3minutes it will send one notification to my prowl account

I will send the code
ropske
Posts: 483
Joined: Tuesday 12 August 2014 5:37
Target OS: Raspberry Pi / ODroid
Domoticz version: V3_8394
Location: Rumbeke,Belgium
Contact:

Re: Create a Event or Lua to get push notification when dish

Post by ropske »

Code: Select all

-- Script made by Stijn Verbrugghe 16/04/2015
-- I'm a Belgium dude :-)
-- Some information in english
-- Make a new user variable in domoticz with the name:	wasmachine_dummyCounter and its type is an integer
-- When my washmachine has completed its cycle it is using +- 1.9W
-- When we switch the washmachine off then, its using +- 0.3W
-- When its running normally its using more then 1.9W (normal it is :-)   )
-- So, when my washmachine has completed its cycle and using 1.9W, script will check this and if its still in standby for 180 seconds, you will get a notification!
-- If washmachine is back running or you have switched it off, then it will reset the dummy variable, because you don't want to have more than 1000 notifications :-) 


print('Wasmachine Script loopt')
commandArray = {}

-- Reset user variable
if (otherdevices_svalues['verbruik wasmachine'] >= '5' or otherdevices_svalues['verbruik wasmachine'] <= '1' and uservariables['wasmachine_dummyCounter'] ~= 0) then
	print('Teller wasmaschine terug op 0 gezet')
	commandArray['Variable:wasmachine_dummyCounter']='0' 
end	


-- Calculate difference between last update and current time 
t1 = os.time()
s = otherdevices_lastupdate['verbruik wasmachine']
-- returns a date time like 2013-07-11 17:23:12

year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)

t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = (os.difftime (t1, t2))


-- Check if washmachine has completed its cycle => power consumption is between 1W and 5W for 180seconds (3minutes) and dummyvariable 'wasmachine_dummyCounter'=0
if (otherdevices_svalues['verbruik wasmachine'] >= '1' and otherdevices_svalues['verbruik wasmachine'] <= '5' and uservariables['wasmachine_dummyCounter'] == 0 and difference > 180) then
	commandArray['Variable:wasmachine_dummyCounter']='1' 
	print('Wasmachine staat in standby, legt ze keer af!!')
	commandArray['SendNotification']='Wasmachine#Wasmachine is gedaan met draaien!#1'
end 

return commandArray
ropske
Posts: 483
Joined: Tuesday 12 August 2014 5:37
Target OS: Raspberry Pi / ODroid
Domoticz version: V3_8394
Location: Rumbeke,Belgium
Contact:

Re: Create a Event or Lua to get push notification when dish

Post by ropske »

Forgot to mention: file name of this script is: Script_time_wasmachine.lua
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Create a Event or Lua to get push notification when dish

Post by ThinkPad »

Great! Thank you very much. Will try it soon.
I am not active on this forum anymore.
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Create a Event or Lua to get push notification when dish

Post by ThinkPad »

I now have time to try it. I first want to try it with a lightbulb (that i turn on/off by hand) so i can see if the notification part works, and optimize the message of the notification etc.
But so far nothing happens. I think it probably has to do with the fact that a washing machine still usages a bit of power when done, where my lightbulb is 0W when turned off.

What do i have to change to try it on my desk with a lightbulb and receive a notification if power usage = 0W for 3 minutes?
I am not active on this forum anymore.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest