Pushnotification when dishwasher/washing machine is ready?

maomanna
Posts: 108
Joined: Monday 30 November 2015 17:21
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by maomanna » Wednesday 31 May 2017 15:20

anyone?

Nautilus
Posts: 751
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by Nautilus » Wednesday 31 May 2017 23:10

maomanna wrote:anyone?
Hard to say anything just based on this info. I suggest adding more debug lines ( = print more stuff to log) on the script to see where it goes wrong. With just a quick look I noticed something that might play a role:

Code: Select all

local energy_consumption      = 'verbruik wasmachine'         --Name of Z-Wave plug that contains actual consumption of washingmachine (in 
-- sWatt, sTotalkWh              = otherdevices_svalues['Clothes Washer Power Usage']:match("([^;]+);([^;]+)")
-- washer_usage                  = tonumber(sWatt)
washer_usage                  = tonumber(otherdevices_svalues[energy_consumption])
Is your device "verbruik wasmachine" such it only reports Watts? If it reports energy (W & kWh) then you need the split which you have now commented out (and use correct device name there.

Hesmink
Posts: 178
Joined: Monday 22 June 2015 10:48
Target OS: Raspberry Pi
Domoticz version:
Location: The Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by Hesmink » Thursday 01 June 2017 0:38

gordonb3 wrote:Considering the various operating modes of the targeted devices that I own, I doubt that measuring power consumption and issuing an alarm/notification after X seconds of ample usage is very reliable. And of course this requires acquiring hardware that can measure the power usage of such devices and this will need to be quality hardware as the targeted devices will typically have a peak power rating (far) above 2000 Watts. Which doesn't seem like a very good investment as I can already deduce the power usage of these devices from my P1 reports. I'd guess it would be far cheaper and exact to get yourself a light monitoring device to detect whether the control light on the dishwasher/washing machine is on. Or to stay with the subject: signal when it turns off.
You're free to do it however you like.
I use a Tp-link hs110, rated for 3500w, and the script works flawlesly for my washing machine.

With P1 you will only know the total power usage, so that won't work.

maomanna
Posts: 108
Joined: Monday 30 November 2015 17:21
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by maomanna » Thursday 01 June 2017 12:40

Nautilus wrote:
maomanna wrote:anyone?
Hard to say anything just based on this info. I suggest adding more debug lines ( = print more stuff to log) on the script to see where it goes wrong. With just a quick look I noticed something that might play a role:

Code: Select all

local energy_consumption      = 'verbruik wasmachine'         --Name of Z-Wave plug that contains actual consumption of washingmachine (in 
-- sWatt, sTotalkWh              = otherdevices_svalues['Clothes Washer Power Usage']:match("([^;]+);([^;]+)")
-- washer_usage                  = tonumber(sWatt)
washer_usage                  = tonumber(otherdevices_svalues[energy_consumption])
Is your device "verbruik wasmachine" such it only reports Watts? If it reports energy (W & kWh) then you need the split which you have now commented out (and use correct device name there.
this is my device:
Image

and this is the editted script:

Code: Select all

--script_time_washingmachine.lua

--Change the values below to reflect to your own setup
local washer_status_uservar   = 'washingmachine_status'
local energy_consumption      = 'wasmachine'            --Name of Z-Wave plug that contains actual consumption of washingmachine (in Watts)
local washer_counter_uservar  = 'washingmachine_counter'        --Name of the uservariable that will contain the counter that is needed
local idle_minutes            = 5                               --The amount of minutes the consumption has to stay below the 'consumption_lower' value
local consumption_upper       = 20                              --If usage is higher than this value (Watts), the washingmachine has started
local consumption_lower       = 4.3                             --If usage is lower than this value (Watts), the washingmachine is idle for a moment/done washing

-- sWatt, sTotalkWh              = otherdevices_svalues['wasmachine']:match("([^;]+);([^;]+)")
-- washer_usage                  = tonumber(sWatt)
washer_usage                     = tonumber(otherdevices_svalues[energy_consumption])

commandArray = {}

--Virtual switch is off, but consumption is higher than configured level, so washing has started
if (washer_usage > consumption_upper) and uservariables[washer_status_uservar] == 0 then
  commandArray['Variable:' .. washer_status_uservar]='1'
  print('Current power usage (' ..washer_usage.. 'W) is above upper boundary (' ..consumption_upper.. 'W), so washing has started!')
  commandArray['SendNotification']='Wasmachine is gestart!'                                         
  commandArray['Variable:' .. washer_counter_uservar]=tostring(idle_minutes)
end

--Washing machine is not using a lot of energy, check the counter
if (washer_usage < consumption_lower) and uservariables[washer_status_uservar] == 1 then 
  commandArray['Variable:' .. washer_counter_uservar]=tostring(math.max(tonumber(uservariables[washer_counter_uservar]) - 1, 0))
  print('Current power usage (' ..washer_usage.. 'W) is below lower boundary (' ..consumption_lower.. 'W), washer is idle or almost ready')
  print('Subtracting counter, old value: ' ..uservariables[washer_counter_uservar].. ' minutes')
elseif ((uservariables[washer_counter_uservar] ~= idle_minutes) and uservariables[washer_status_uservar] == 1) then
  commandArray['Variable:' .. washer_counter_uservar]=tostring(idle_minutes)
  print('Resetting Washing Machine Timer')
end

--Washingmachine is done
if ((uservariables[washer_status_uservar] == 1) and uservariables[washer_counter_uservar] == 0) then
  print('Washingmachine is DONE')
  print('Current power usage washingmachine ' ..washer_usage.. 'W')
  print('Washingmachine is done, please go empty it!')
  commandArray['SendNotification']='Cycle Ended: Washing Machine#The load in the washing machine has finsihed, please move it to the dryer!#0'                                         
  commandArray['Variable:' .. washer_status_uservar]='0'
end

return commandArray
Yesterday the Watt's were like 0, but the script said

Code: Select all

2017-05-31 22:46:00.230 LUA: Resetting Washing Machine Timer
2017-05-31 22:46:00.230 EventSystem: Script event triggered: Wasmachine
2017-05-31 22:47:00.247 LUA: Resetting Washing Machine Timer
2017-05-31 22:47:00.247 EventSystem: Script event triggered: Wasmachine
2017-05-31 22:48:00.264 LUA: Resetting Washing Machine Timer
2017-05-31 22:48:00.265 EventSystem: Script event triggered: Wasmachine
2017-05-31 22:49:00.280 LUA: Resetting Washing Machine Timer
2017-05-31 22:49:00.280 EventSystem: Script event triggered: Wasmachine
so it went to step 2 and there it gets looped.

maomanna
Posts: 108
Joined: Monday 30 November 2015 17:21
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by maomanna » Thursday 08 June 2017 22:23

anyone?

Nautilus
Posts: 751
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by Nautilus » Friday 09 June 2017 0:05

So based on your screenshot the device shows both W and kWh so you need to change these lines:

Code: Select all

-- sWatt, sTotalkWh              = otherdevices_svalues['wasmachine']:match("([^;]+);([^;]+)")
-- washer_usage                  = tonumber(sWatt)
washer_usage                     = tonumber(otherdevices_svalues[energy_consumption])
to

Code: Select all

sWatt, sTotalkWh              = otherdevices_svalues['wasmachine']:match("([^;]+);([^;]+)")
washer_usage                  = tonumber(sWatt)
That is, uncomment first two and remove third. If it does not work, please try to add more debug lines as suggested. Start with something as simple as:

Code: Select all

sWatt, sTotalkWh              = otherdevices_svalues['wasmachine']:match("([^;]+);([^;]+)")
washer_usage                  = tonumber(sWatt)
print('Current washer usage is '..washer_usage..'W')

maomanna
Posts: 108
Joined: Monday 30 November 2015 17:21
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by maomanna » Wednesday 14 June 2017 20:40

Nautilus wrote:So based on your screenshot the device shows both W and kWh so you need to change these lines:

Code: Select all

-- sWatt, sTotalkWh              = otherdevices_svalues['wasmachine']:match("([^;]+);([^;]+)")
-- washer_usage                  = tonumber(sWatt)
washer_usage                     = tonumber(otherdevices_svalues[energy_consumption])
to

Code: Select all

sWatt, sTotalkWh              = otherdevices_svalues['wasmachine']:match("([^;]+);([^;]+)")
washer_usage                  = tonumber(sWatt)
That is, uncomment first two and remove third. If it does not work, please try to add more debug lines as suggested. Start with something as simple as:

Code: Select all

sWatt, sTotalkWh              = otherdevices_svalues['wasmachine']:match("([^;]+);([^;]+)")
washer_usage                  = tonumber(sWatt)
print('Current washer usage is '..washer_usage..'W')
i get this error:

Code: Select all

2017-06-14 20:39:00.208 Error: EventSystem: in Wasmachine: [string "--script_time_washingmachine.lua ..."]:13: attempt to concatenate global 'washer_usage' (a nil value)

Nautilus
Posts: 751
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by Nautilus » Wednesday 14 June 2017 21:46

Means the variable is nil, i.e. it does not get any value. What do you get if you put

Code: Select all

print(otherdevices_svalues['wasmachine'])
in the beginning of the script?

maomanna
Posts: 108
Joined: Monday 30 November 2015 17:21
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by maomanna » Thursday 15 June 2017 11:54

Nautilus wrote:Means the variable is nil, i.e. it does not get any value. What do you get if you put

Code: Select all

print(otherdevices_svalues['wasmachine'])
in the beginning of the script?

Code: Select all

--script_time_washingmachine.lua



--Change the values below to reflect to your own setup
local washer_status_uservar   = 'washingmachine_status'
local energy_consumption      = 'wasmachine'            --Name of Z-Wave plug that contains actual consumption of washingmachine (in Watts)
local washer_counter_uservar  = 'washingmachine_counter'        --Name of the uservariable that will contain the counter that is needed
local idle_minutes            = 5                               --The amount of minutes the consumption has to stay below the 'consumption_lower' value
local consumption_upper       = 20                              --If usage is higher than this value (Watts), the washingmachine has started
local consumption_lower       = 4.3                             --If usage is lower than this value (Watts), the washingmachine is idle for a moment/done washing

sWatt, sTotalkWh              = otherdevices_svalues['wasmachine']:match("([^;]+);([^;]+)")
washer_usage                  = tonumber(sWatt)
print('Current washer usage is '..washer_usage..'W')
print(otherdevices_svalues['wasmachine'])

commandArray = {}

--Virtual switch is off, but consumption is higher than configured level, so washing has started
if (washer_usage > consumption_upper) and uservariables[washer_status_uservar] == 0 then
  commandArray['Variable:' .. washer_status_uservar]='1'
  print('Current power usage (' ..washer_usage.. 'W) is above upper boundary (' ..consumption_upper.. 'W), so washing has started!')
  commandArray['SendNotification']='Wasmachine is gestart!'                                         
  commandArray['Variable:' .. washer_counter_uservar]=tostring(idle_minutes)
end

--Washing machine is not using a lot of energy, check the counter
if (washer_usage < consumption_lower) and uservariables[washer_status_uservar] == 1 then 
  commandArray['Variable:' .. washer_counter_uservar]=tostring(math.max(tonumber(uservariables[washer_counter_uservar]) - 1, 0))
  print('Current power usage (' ..washer_usage.. 'W) is below lower boundary (' ..consumption_lower.. 'W), washer is idle or almost ready')
  print('Subtracting counter, old value: ' ..uservariables[washer_counter_uservar].. ' minutes')
elseif ((uservariables[washer_counter_uservar] ~= idle_minutes) and uservariables[washer_status_uservar] == 1) then
  commandArray['Variable:' .. washer_counter_uservar]=tostring(idle_minutes)
  print('Resetting Washing Machine Timer')
end

--Washingmachine is done
if ((uservariables[washer_status_uservar] == 1) and uservariables[washer_counter_uservar] == 0) then
  print('Washingmachine is DONE')
  print('Current power usage washingmachine ' ..washer_usage.. 'W')
  print('Washingmachine is done, please go empty it!')
  commandArray['SendNotification']='Cycle Ended: Washing Machine#The load in the washing machine has finsihed, please move it to the dryer!#0'                                         
  commandArray['Variable:' .. washer_status_uservar]='0'
end

return commandArray
Doesn't print anything in the log. only
2017-06-15 11:53:00.198 Error: EventSystem: in Wasmachine: [string "--script_time_washingmachine.lua ..."]:15: attempt to concatenate global 'washer_usage' (a nil value)

Nautilus
Posts: 751
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by Nautilus » Thursday 15 June 2017 13:16

As mentioned, please put it in the beginning of the script, it does not continue after the error anymore and you have it now after the error line (13).

maomanna
Posts: 108
Joined: Monday 30 November 2015 17:21
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by maomanna » Thursday 15 June 2017 14:33

Nautilus wrote:As mentioned, please put it in the beginning of the script, it does not continue after the error anymore and you have it now after the error line (13).
it look liked i had 2 devices names "wasmachine" 1 the switch and 1 the power usage.

now i get this output

Code: Select all

2017-06-15 14:31:00.459 LUA: 0.000;14571.000
2017-06-15 14:31:00.459 LUA: Current washer usage is 0W
2017-06-15 14:31:00.459 LUA: 50
Tonight i will test if the script works :)

Thanks so far!
Last edited by maomanna on Thursday 15 June 2017 14:59, edited 2 times in total.

Nautilus
Posts: 751
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by Nautilus » Thursday 15 June 2017 14:58

Yes, two devices with the same name will lead to trouble in this kinds of situations :)

In any case, seems the script now reads correctly the current usage (0W) so I think you have good changes to get it working this evening! :D

maomanna
Posts: 108
Joined: Monday 30 November 2015 17:21
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by maomanna » Thursday 15 June 2017 14:59

cause the powerusage was below the minimum, the timer counted.
When the counter ended, i recieved a notification over telegram!

thanks for your help!

Nautilus
Posts: 751
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by Nautilus » Thursday 15 June 2017 15:01

Great! :D

Luigi87
Posts: 79
Joined: Thursday 17 March 2016 15:58
Target OS: Linux
Domoticz version:
Location: Pijnacker, the Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by Luigi87 » Sunday 17 September 2017 12:21

Hi guys, i tried the script as posted here in this topic
(changed some names in the script, as seen below)

Code: Select all

--script_time_washingmachine.lua



--Change the values below to reflect to your own setup
local washer_status_uservar   = 'washingmachine_status'
local energy_consumption      = 'WattWasmachine'            --Name of Z-Wave plug that contains actual consumption of washingmachine (in Watts)
local washer_counter_uservar  = 'washingmachine_counter'        --Name of the uservariable that will contain the counter that is needed
local idle_minutes            = 5                               --The amount of minutes the consumption has to stay below the 'consumption_lower' value
local consumption_upper       = 20                              --If usage is higher than this value (Watts), the washingmachine has started
local consumption_lower       = 4.3                             --If usage is lower than this value (Watts), the washingmachine is idle for a moment/done washing

sWatt, sTotalkWh              = otherdevices_svalues['WattWasmachine']:match("([^;]+);([^;]+)")
washer_usage                  = tonumber(sWatt)
print('Current washer usage is '..washer_usage..'W')
print(otherdevices_svalues['WattWasmachine'])

commandArray = {}

--Virtual switch is off, but consumption is higher than configured level, so washing has started
if (washer_usage > consumption_upper) and uservariables[washer_status_uservar] == 0 then
  commandArray['Variable:' .. washer_status_uservar]='1'
  print('Current power usage (' ..washer_usage.. 'W) is above upper boundary (' ..consumption_upper.. 'W), so washing has started!')
  commandArray['SendNotification']='Wasmachine is gestart!'                                         
  commandArray['Variable:' .. washer_counter_uservar]=tostring(idle_minutes)
end

--Washing machine is not using a lot of energy, check the counter
if (washer_usage < consumption_lower) and uservariables[washer_status_uservar] == 1 then 
  commandArray['Variable:' .. washer_counter_uservar]=tostring(math.max(tonumber(uservariables[washer_counter_uservar]) - 1, 0))
  print('Current power usage (' ..washer_usage.. 'W) is below lower boundary (' ..consumption_lower.. 'W), washer is idle or almost ready')
  print('Subtracting counter, old value: ' ..uservariables[washer_counter_uservar].. ' minutes')
elseif ((uservariables[washer_counter_uservar] ~= idle_minutes) and uservariables[washer_status_uservar] == 1) then
  commandArray['Variable:' .. washer_counter_uservar]=tostring(idle_minutes)
  print('Resetting Washing Machine Timer')
end

--Washingmachine is done
if ((uservariables[washer_status_uservar] == 1) and uservariables[washer_counter_uservar] == 0) then
  print('Washingmachine is DONE')
  print('Current power usage washingmachine ' ..washer_usage.. 'W')
  print('Washingmachine is done, please go empty it!')
  commandArray['SendNotification']='Cycle Ended: Washing Machine#The load in the washing machine has finsihed, please move it to the dryer!#0'                                         
  commandArray['Variable:' .. washer_status_uservar]='0'
end

return commandArray
I have added the two uservars (“washingmachine_status” and “washingmachine_counter”) , as a integer and with the value 0.
I also changed the name of the “wasmachine” to “WattWasmachine” because the watt counter has this name in my system.

But I get the error below.

Code: Select all

2017-09-17 12:19:00.302 Error: EventSystem: in Wasmachine melding: [string "--script_time_washingmachine.lua..."]:15: attempt to concatenate global 'washer_usage' (a nil value)

What is going wrong?

User avatar
jvdz
Posts: 1338
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by jvdz » Sunday 17 September 2017 13:05

Looks like the device WattWasmachine doesn't contain the right values. What is the exact content shown in the devices tab for it?
EDIT: This statement expect the svalue to contain "Current usage;Total kWh usage":

Code: Select all

sWatt, sTotalkWh              = otherdevices_svalues['WattWasmachine']:match("([^;]+);([^;]+)")
Likely your device only has the current usage?
If so just modify the script to:

Code: Select all

--sWatt, sTotalkWh              = otherdevices_svalues['WattWasmachine']:match("([^;]+);([^;]+)")
--washer_usage                  = tonumber(sWatt)
washer_usage                  = tonumber(otherdevices_svalues['WattWasmachine'])
Jos

Luigi87
Posts: 79
Joined: Thursday 17 March 2016 15:58
Target OS: Linux
Domoticz version:
Location: Pijnacker, the Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by Luigi87 » Sunday 17 September 2017 21:04

I wilbtry this tomorrow. I think you are right. The wattwasmachine is only current usage. No total count. I am using the coolcam neo powerplugs.
Hope this will work

Goldwing1973
Posts: 111
Joined: Monday 08 August 2016 22:55
Target OS: Linux
Domoticz version: Stable
Location: Netherlands, Alphen aan den Rijn
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by Goldwing1973 » Sunday 17 September 2017 21:49

I've had the same idea a little while ago, and this is how i solved it.
I'm using a Fibaro Wall Plug to measure its power consumption, when it uses 300watt or more a variable sets to on and writes it to the log.
Next it's waiting until the power consumption becomes 1.3 watt (ready, but the display on the washing machine still lid, 15 minutes later the display will turn off and power consumption will be 1 watt)
Then send a message, and turn on the most left light above the dining table.

Works like a charm and has a huge WAF (Wife Acceptance Factor)
Domoticz Wasmachine.png
Domoticz Wasmachine.png (43.14 KiB) Viewed 1582 times
Over 50 Z-Wave Devices (Fibaro and Neo), 4xLogitech Hub, 2xPhilips Hue Bridge+55 Lights, 1x Nest Thermostat, 2xNetatmo Weather Station, 1xSkybell v1 Doorbell, 3 Kwikset KEVO Doorlocks and Domoticz running on a Intel NUC

Luigi87
Posts: 79
Joined: Thursday 17 March 2016 15:58
Target OS: Linux
Domoticz version:
Location: Pijnacker, the Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by Luigi87 » Monday 18 September 2017 10:28

Goldwing1973 wrote:
Sunday 17 September 2017 21:49
I've had the same idea a little while ago, and this is how i solved it.
I'm using a Fibaro Wall Plug to measure its power consumption, when it uses 300watt or more a variable sets to on and writes it to the log.
Next it's waiting until the power consumption becomes 1.3 watt (ready, but the display on the washing machine still lid, 15 minutes later the display will turn off and power consumption will be 1 watt)
Then send a message, and turn on the most left light above the dining table.

Works like a charm and has a huge WAF (Wife Acceptance Factor)

Domoticz Wasmachine.png
Thanks for sharring.
If the script doesn't work for me I can always try your Blocky. Blocky is more my language then LUA :oops:

Luigi87
Posts: 79
Joined: Thursday 17 March 2016 15:58
Target OS: Linux
Domoticz version:
Location: Pijnacker, the Netherlands
Contact:

Re: Pushnotification when dishwasher/washing machine is ready?

Post by Luigi87 » Monday 18 September 2017 18:50

jvdz wrote:
Sunday 17 September 2017 13:05
Looks like the device WattWasmachine doesn't contain the right values. What is the exact content shown in the devices tab for it?
EDIT: This statement expect the svalue to contain "Current usage;Total kWh usage":

Code: Select all

sWatt, sTotalkWh              = otherdevices_svalues['WattWasmachine']:match("([^;]+);([^;]+)")
Likely your device only has the current usage?
If so just modify the script to:

Code: Select all

--sWatt, sTotalkWh              = otherdevices_svalues['WattWasmachine']:match("([^;]+);([^;]+)")
--washer_usage                  = tonumber(sWatt)
washer_usage                  = tonumber(otherdevices_svalues['WattWasmachine'])
Jos
This did the trick :D it works now.
Now only to tweek it to the right value's

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests