Is the washing machine done?

Moderator: leecollings

dheuts
Posts: 65
Joined: Monday 25 March 2019 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Brunssum, Netherlands
Contact:

Re: Is the washing machine done?

Post by dheuts »

I think I see the problem, the script is running every couple of seconds instead of only every 5 minutes.
How to get this fixed so it only runs once every 5 minutes?
Raspberry Pi 4 With Domoticz - RFXCom - Tuya Wifi LED lights - Chuango Alarm - Zwave+ - Zigbee2MQTT - Anna Thermostat - Broadlink IR, P1 - Eufy Robo Vacuum - Worx Robo Mower
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Is the washing machine done?

Post by waaren »

dheuts wrote: Wednesday 13 January 2021 11:57 I think I see the problem, the script is running every couple of seconds instead of only every 5 minutes.
How to get this fixed so it only runs once every 5 minutes?
Remove lines

Code: Select all

        devices = {								-- Make sure that the devices are the same as above
            'Garage Droger Verbruik',
            'Garage Wasmachine Verbruik',
 		},
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dheuts
Posts: 65
Joined: Monday 25 March 2019 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Brunssum, Netherlands
Contact:

Re: Is the washing machine done?

Post by dheuts »

waaren wrote: Wednesday 13 January 2021 12:16
dheuts wrote: Wednesday 13 January 2021 11:57 I think I see the problem, the script is running every couple of seconds instead of only every 5 minutes.
How to get this fixed so it only runs once every 5 minutes?
Remove lines

Code: Select all

        devices = {								-- Make sure that the devices are the same as above
            'Garage Droger Verbruik',
            'Garage Wasmachine Verbruik',
 		},
Thanks for your quick response Waaren!
When I remove this lines, it doesnt see the the device is using energy anymore, so the virtual switch is not popping to on.
Raspberry Pi 4 With Domoticz - RFXCom - Tuya Wifi LED lights - Chuango Alarm - Zwave+ - Zigbee2MQTT - Anna Thermostat - Broadlink IR, P1 - Eufy Robo Vacuum - Worx Robo Mower
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Is the washing machine done?

Post by waaren »

dheuts wrote: Wednesday 13 January 2021 12:46 When I remove this lines, it doesnt see the the device is using energy anymore, so the virtual switch is not popping to on.
It should see it but only after 5 minutes.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dheuts
Posts: 65
Joined: Monday 25 March 2019 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Brunssum, Netherlands
Contact:

Re: Is the washing machine done?

Post by dheuts »

Thanks a lot Waaren, It does when the 5 minutes are over, indeed. You are right.

But it still doesnt do anything with the 6 minute setting. When the 5 minute execution is running and it's only using less then 3 Watt for say 2,5 minutes, it still turns the dummy switch off.
waaren wrote: Wednesday 13 January 2021 13:24
dheuts wrote: Wednesday 13 January 2021 12:46 When I remove this lines, it doesnt see the the device is using energy anymore, so the virtual switch is not popping to on.
It should see it but only after 5 minutes.
Raspberry Pi 4 With Domoticz - RFXCom - Tuya Wifi LED lights - Chuango Alarm - Zwave+ - Zigbee2MQTT - Anna Thermostat - Broadlink IR, P1 - Eufy Robo Vacuum - Worx Robo Mower
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Is the washing machine done?

Post by waaren »

dheuts wrote: Wednesday 13 January 2021 14:19 But it still doesnt do anything with the 6 minute setting. When the 5 minute execution is running and it's only using less then 3 Watt for say 2,5 minutes, it still turns the dummy switch off.
True,
If you do not want the script to be executed every couple of seconds but do want to check if the machine(s) are stil consuming energy you would have to change the script to also collect the WhTotal if that's available or (if that attribute is not available ) the more complex change to use customEvents while the machine(s) are active.

Another way but a bit far fetched is to use dzVents native method rename()

The idea then is to name your device blabla_idle when the device is not active and when the 5 minute time triggered script evaluate the device to be active rename it to blabla. If the script also triggers on device = { 'blabla'} it will then catch every update of the device and once the device is finished you rename it back to blabla_idle causing it to be invisible for your dzVents script.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dheuts
Posts: 65
Joined: Monday 25 March 2019 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Brunssum, Netherlands
Contact:

Re: Is the washing machine done?

Post by dheuts »

Thanks again for your quick response.

But if I read the posts and the script, it seems to me it already had to work out of the box so it check's if the energy usage is below 3 Watt for more than 6 minutes?
Raspberry Pi 4 With Domoticz - RFXCom - Tuya Wifi LED lights - Chuango Alarm - Zwave+ - Zigbee2MQTT - Anna Thermostat - Broadlink IR, P1 - Eufy Robo Vacuum - Worx Robo Mower
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Is the washing machine done?

Post by waaren »

dheuts wrote: Wednesday 13 January 2021 14:49 But if I read the posts and the script, it seems to me it already had to work out of the box so it check's if the energy usage is below 3 Watt for more than 6 minutes?
Yes but that was before you removed the lines that cause the frequent activation of the script. The script in its current state works like that. Every time one of your devices named in the devices section of the script sends an update to domoticz, the script gets triggered.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

Re: Is the washing machine done?

Post by felix63 »

dheuts wrote: Wednesday 13 January 2021 11:57 I think I see the problem, the script is running every couple of seconds instead of only every 5 minutes.
How to get this fixed so it only runs once every 5 minutes?
The script is triggered every five minutes and when one of the monitored power measurements get updated. So apparently the device you use to monitor energy usage is updating every couple of seconds. My first thought would be to see if you can lower the reporting frequency of the device. For instance my washing machine is plugged into a ZWave Qubino Smart Plug 16A+. This device has a number of parameters that influence the frequency with which the device will report its usage. See the example below. Perhaps your device has similar options? This is by far the most simple solution to your problem!

Code: Select all

40. Power reporting in Watts on power change:  (%) (actual: 20)

Choose by how much power consumption needs to increase or decrease to be reported. Values correspond to percentages so if 20 is set (by default), the device will report any power consumption changes of 20% or more compared to the last reading. Set value from 0 - 100 (0% - 100%). 0 - Reporting Disabled. 1 - 100 = 1% - 100% Reporting enabled. Power report is send (push) only when actual power in Watts in real time change for more than set percentage comparing to previous actual power in Watts, step is 1%. Default value 20.

42. Power reporting in Watts by time interval:  (seconds) (actual: 300)

Set value refers to the time interval with which power consumption in Watts is reported (0 - 32535 seconds). If 300 is entered (by default), energy consumption reports will be sent to the gateway (hub) every 300 seconds (or 5 minutes). Set value means time interval (0 - 32767) in seconds, when power report is send. 0 - Reporting Disabled. 1 second to 32767 seconds reporting enabled. Power report is send with time interval set by entered value. Default value 300 (power report in Watts is send each 300s).
dheuts
Posts: 65
Joined: Monday 25 March 2019 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Brunssum, Netherlands
Contact:

Re: Is the washing machine done?

Post by dheuts »

felix63 wrote: Wednesday 13 January 2021 16:22
dheuts wrote: Wednesday 13 January 2021 11:57 I think I see the problem, the script is running every couple of seconds instead of only every 5 minutes.
How to get this fixed so it only runs once every 5 minutes?
The script is triggered every five minutes and when one of the monitored power measurements get updated. So apparently the device you use to monitor energy usage is updating every couple of seconds. My first thought would be to see if you can lower the reporting frequency of the device. For instance my washing machine is plugged into a ZWave Qubino Smart Plug 16A+. This device has a number of parameters that influence the frequency with which the device will report its usage. See the example below. Perhaps your device has similar options? This is by far the most simple solution to your problem!

Code: Select all

40. Power reporting in Watts on power change:  (%) (actual: 20)

Choose by how much power consumption needs to increase or decrease to be reported. Values correspond to percentages so if 20 is set (by default), the device will report any power consumption changes of 20% or more compared to the last reading. Set value from 0 - 100 (0% - 100%). 0 - Reporting Disabled. 1 - 100 = 1% - 100% Reporting enabled. Power report is send (push) only when actual power in Watts in real time change for more than set percentage comparing to previous actual power in Watts, step is 1%. Default value 20.

42. Power reporting in Watts by time interval:  (seconds) (actual: 300)

Set value refers to the time interval with which power consumption in Watts is reported (0 - 32535 seconds). If 300 is entered (by default), energy consumption reports will be sent to the gateway (hub) every 300 seconds (or 5 minutes). Set value means time interval (0 - 32767) in seconds, when power report is send. 0 - Reporting Disabled. 1 second to 32767 seconds reporting enabled. Power report is send with time interval set by entered value. Default value 300 (power report in Watts is send each 300s).
Thanks for your input! I use a Zigbee device and it's possible to set it up: https://www.zigbee2mqtt.io/devices/TS0121_plug.html
I have edited the setting in the configuration file to 120 seconds, but still it doesn't do anything with the configured 6 minutes.
I will try to set it to update only every 300 seconds.
Raspberry Pi 4 With Domoticz - RFXCom - Tuya Wifi LED lights - Chuango Alarm - Zwave+ - Zigbee2MQTT - Anna Thermostat - Broadlink IR, P1 - Eufy Robo Vacuum - Worx Robo Mower
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Is the washing machine done?

Post by EdwinK »

A little thread-hijacking, but thanks to this topic I finally found out why I couldn't get my smart-plugs to work with domoticz.

Was trying to get this script working, but found out that the plugs I have are Zwave, and not Zigbee... :shock: .

End of hijack.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
poweredge
Posts: 21
Joined: Thursday 05 July 2018 13:54
Target OS: Linux
Domoticz version:
Contact:

Re: Is the washing machine done?

Post by poweredge »

hi all - im using this script also successfully but i have 1 glitch i would like to solve. for the washing machine i notice the system switches off the virtual switch/washing machine 2 times, which means 2 notifications via telegram instead of 1. Im not quite sure how to debug this - could this be somewhere hidden in the code that it does this twice instead of once?

ps i linked the script to alexa routines - so when the dryer or washing machine is done alexa will announce this on the speakers, but the washing machine notification i sent out twice... :-)
DM2021.1 (pri+sec) VM/RPI4. Dashticz @touchscreen. IT: Dell ESXi cluster, UPS, fiber+4g WAN. Smart: Aeotec/Neo/Qubino/Eurotronic zwave, Philips Hue, P1, rfxom433, OTGW, ITHO WiFi, Shelly shutter/water sens, NEST v3, 9x Alexa
jellewho
Posts: 2
Joined: Wednesday 17 March 2021 12:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Is the washing machine done?

Post by jellewho »

I've modified the script to a V3. This fixes duplicate notifications, it turning off after manual on, and the init copy/paste hell, and logs the reasons, and more.
I do not use a dummy switch, but I tried to keep that option in (but it has not been proven yet)

This version can be found on my GihHub here https://github.com/jellewie/Domoticz-Is ... ine-done--
poweredge
Posts: 21
Joined: Thursday 05 July 2018 13:54
Target OS: Linux
Domoticz version:
Contact:

Re: Is the washing machine done?

Post by poweredge »

let me check if this works better :-) thanks ... im using virtual switches btw - i dont want the plugs to turn off (request of the missus) - i only want to have the notification/switchoff part but ill adjust that in the code.
DM2021.1 (pri+sec) VM/RPI4. Dashticz @touchscreen. IT: Dell ESXi cluster, UPS, fiber+4g WAN. Smart: Aeotec/Neo/Qubino/Eurotronic zwave, Philips Hue, P1, rfxom433, OTGW, ITHO WiFi, Shelly shutter/water sens, NEST v3, 9x Alexa
poweredge
Posts: 21
Joined: Thursday 05 July 2018 13:54
Target OS: Linux
Domoticz version:
Contact:

Re: Is the washing machine done?

Post by poweredge »

update: implemented this script - it works - thanks! - also with virtual switches, and i linked alexa routines with voice to the OFF section of the virtual switch. my goal is to have the audio announcement rather then actually switching off the plug, but virtual switches could be replaced with the actual plugs as well.
DM2021.1 (pri+sec) VM/RPI4. Dashticz @touchscreen. IT: Dell ESXi cluster, UPS, fiber+4g WAN. Smart: Aeotec/Neo/Qubino/Eurotronic zwave, Philips Hue, P1, rfxom433, OTGW, ITHO WiFi, Shelly shutter/water sens, NEST v3, 9x Alexa
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Is the washing machine done?

Post by EddyG »

I implemented a adapted version of this script. My problem is with this plug: https://www.zigbee2mqtt.io/devices/TS01 ... s0121_plug
This plug has to be queried every minute for the kWh, it does not send the value my it self.
As soon as I switch on the plug the script is taken it off again, probably because the value is still zero.
How can I circumvent this?
dheuts
Posts: 65
Joined: Monday 25 March 2019 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Brunssum, Netherlands
Contact:

Re: Is the washing machine done?

Post by dheuts »

Hi Felix,

Even with the reporting interval on 600 seconds, the virtual switch keeps switching off 2 or 3 times when still washing.

Any ideas how to fix this?
felix63 wrote: Wednesday 13 January 2021 16:22
dheuts wrote: Wednesday 13 January 2021 11:57 I think I see the problem, the script is running every couple of seconds instead of only every 5 minutes.
How to get this fixed so it only runs once every 5 minutes?
The script is triggered every five minutes and when one of the monitored power measurements get updated. So apparently the device you use to monitor energy usage is updating every couple of seconds. My first thought would be to see if you can lower the reporting frequency of the device. For instance my washing machine is plugged into a ZWave Qubino Smart Plug 16A+. This device has a number of parameters that influence the frequency with which the device will report its usage. See the example below. Perhaps your device has similar options? This is by far the most simple solution to your problem!

Code: Select all

40. Power reporting in Watts on power change:  (%) (actual: 20)

Choose by how much power consumption needs to increase or decrease to be reported. Values correspond to percentages so if 20 is set (by default), the device will report any power consumption changes of 20% or more compared to the last reading. Set value from 0 - 100 (0% - 100%). 0 - Reporting Disabled. 1 - 100 = 1% - 100% Reporting enabled. Power report is send (push) only when actual power in Watts in real time change for more than set percentage comparing to previous actual power in Watts, step is 1%. Default value 20.

42. Power reporting in Watts by time interval:  (seconds) (actual: 300)

Set value refers to the time interval with which power consumption in Watts is reported (0 - 32535 seconds). If 300 is entered (by default), energy consumption reports will be sent to the gateway (hub) every 300 seconds (or 5 minutes). Set value means time interval (0 - 32767) in seconds, when power report is send. 0 - Reporting Disabled. 1 second to 32767 seconds reporting enabled. Power report is send with time interval set by entered value. Default value 300 (power report in Watts is send each 300s).
Raspberry Pi 4 With Domoticz - RFXCom - Tuya Wifi LED lights - Chuango Alarm - Zwave+ - Zigbee2MQTT - Anna Thermostat - Broadlink IR, P1 - Eufy Robo Vacuum - Worx Robo Mower
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

Re: Is the washing machine done?

Post by felix63 »

Hi,

Every washing machine will go through a cycle that has intervals during which the power consumption will drop to or close to the standby consumption value. For this purpose the script has a 'local USAGE_TimeOut' variable for each machine that you want to monitor. This means that the machine will only report to have been switched off if the power consumption has been below 'USAGE_MaxWatt' for longer than the number of minutes specified in 'local USAGE_TimeOut'.

So observe the power consumption during a normal cycle and see how often these dips occur and set the ''local USAGE_TimeOut'' to be 1-2 minutes longer. That might solve your problem. See the attached graphic of the power consumption on my washing machine that shows 6 periods of low consumption during a full cycle. These periods never last longer than 10 minutes. So I've set 'local USAGE_TimeOut' to 10. That works for me.
Image
Attachments
chart.png
chart.png (81.95 KiB) Viewed 1974 times
dheuts
Posts: 65
Joined: Monday 25 March 2019 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Brunssum, Netherlands
Contact:

Re: Is the washing machine done?

Post by dheuts »

Thanks for your reply Felix, I already have set the USAGE_TimOut of the washing machine to 15 minutes, and as far as I can see the dips are only 5-10 minutes. But it still shuts the virtual device to off, it seems it doesn't do anything with the TimeOut time I set up.

As I wrote in my post of 13 january: "The virtual switch doesn't wait 6 minutes, but pops off within seconds. Here is a part of my logfile. Does anyone know why this happens?"

On the same date, you (Felix) mentioned to lower the reporting frequency. Now I changed the reporting interval of the power plug to 600 seconds, but it still doesn't work the way it would have to work. Any idea what to do to fix this? For my dryer the script works just fine..

Thanks a lot!
Raspberry Pi 4 With Domoticz - RFXCom - Tuya Wifi LED lights - Chuango Alarm - Zwave+ - Zigbee2MQTT - Anna Thermostat - Broadlink IR, P1 - Eufy Robo Vacuum - Worx Robo Mower
User avatar
felix63
Posts: 244
Joined: Monday 07 December 2015 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Gouda
Contact:

Re: Is the washing machine done?

Post by felix63 »

@dheuts if you DM me the full script as you are running it as well as the image of a full cycle of the washing machine similar to the graph in my previous post and a screenshot of the settings of the power meter device then I can have a look.

Cheers,
Lex
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest