Washing machine Status - looking for reliable values

Hi there,

I’m trying to get the rule below working smoothly. Unfortunately, I’m struggling with the correct values.

var Timer tWash = null
var Boolean bWash = false

rule "Waschmaschine fertig"

when
  Item EG_bad_x_gs1_Power changed
then
    val Number valWamaPwr = (EG_bad_x_gs1_Power.state as Number).floatValue  // Messwert als Zahl ohne Einheit
    logInfo("WASCHMASCHINE", "Waschmaschine Rule triggert ! Wert : {} ", valWamaPwr)

  if(!bWash)
  {
    if(valWamaPwr > 10) // Erkennung die Maschine wurde gestartet
      
    bWash = true
    VxWaschma.sendCommand(ON)
  }

  else
  { // bWash ist true -> Maschine aktiv
    if(valWamaPwr < 2)
	{ // Erkennung die Maschine ist vielleicht fertig
      if(tWash === null)
      tWash = createTimer(now.plusMinutes(3), [|    
            tWash = null
            bWash = false
                logInfo("WASCHMASCHINE", "Waschmaschine fertig ! Wert : {} ", valWamaPwr)
                	val actions = getActions("pushover", "pushover:pushover-account:soundBike")
                    actions.sendHtmlMessage("Waschmaschine ist fertig", "openHAB3")

                    VxWaschma.sendCommand(OFF)

      ])
    }
	else if(valWamaPwr >= 2.5)
	{ // notwendig, falls Stromaufnahme zwischendurch sehr niedrig
      tWash?.cancel
      tWash = null
        logInfo("WASCHMASCHINE", "Waschmaschine Stromaufnahme zwischendurch sehr niedrig - Wert : {} ", valWamaPwr)
    }
  }
end

This is the power consumption chart:

Ahh… Your machine drops the wattage quite a lot… My tests never showed my Samsung going as low as that… You might need to have a timer, where "if no energy consumption above 10watts for 2 minutes " for example, in order to overcome that…

Here’s how I alert on Washing Machine done via WeMo Insight plug.

rule "Clothes Washer Cycle Done changed"
	when
		Item InSight_ClothesWasher_CurrentPower changed
	then

		if (systemStarted.state != ON && Echo_Laundry_Switch.state != ON) { Thread::sleep(3500) }		// false bursts on InSight_ClothesWasher_CurrentPower 

		if (systemStarted.state != ON && InSight_ClothesWasher_CurrentPower.state < 2 ) { return; }	

		if (systemStarted.state != ON && ClothesWasher_tAlive === null && Echo_Laundry_Switch.state != ON && OH_Uptime_HumanReadable.state != NULL && OH_Uptime_HumanReadable.state !== null && OH_Uptime_HumanReadable.state.toString() != 'UNDEF') {
		
			logInfo("tAlive","ClothesWasher_tAlive is null --> CREATING Timer!")
			ClothesWasher_tAlive = createTimer(now().plusMinutes(25), [ |
				logInfo("tAlive","ClothesWasher_tAlive timer ran out --> nulling timer.")
			
				try {			
						Washer            = InSight_ClothesWasher_CurrentPower.state as Number
						currDayofWeek     = now.getDayOfWeek.getValue
						currHourVariable  = now.getHour
						currHour.postUpdate(currHourVariable)
				
						// logInfo("WASHER","InSight_ClothesWasher_CurrentPower state is " + InSight_ClothesWasher_CurrentPower.state)
						// logInfo("WASHER","Variable Washer value is " + Washer)
						// Washer - Current Power when idle is 2 W
			
						if (Home_Away.state == ON && Washer >= 10 && InSight_ClothesWasher_LastOnForUnformat.state > 240 && InSight_ClothesWasher_OnTodayUnformat.state > 240) {	

							try {
									var Insight = getThingStatusInfo("wemo:insight:Insight-1_0-231707K1201DE8")
									if ((Home_Away.state == ON && Insight !== null) && (Insight.getStatus().toString() != 'ONLINE' )) {
						
										logInfo("tAlive","ClothesWasher_tAlive WeMo Insight OFFLINE --> RESCHEDULE Timer!")
										ClothesWasher_Proxy.postUpdate('Running')	
										Echo_Laundry_Switch.postUpdate(OFF)	
										ClothesWasher_tAlive.reschedule(now().plusMinutes(3))
										return;
									}
				
								} catch (Exception e) {
								
									logError("ERROR","ClothesWasher_tAlive WeMo Insight OFFLINE via ERROR --> RESCHEDULE Timer. Exception is " + e.getMessage)
									ClothesWasher_Proxy.postUpdate('Running')	
									Echo_Laundry_Switch.postUpdate(OFF)	
									ClothesWasher_tAlive.reschedule(now().plusMinutes(3))
									return;
								}
						}

						if (Home_Away.state == ON && Washer > 3 && InSight_ClothesWasher_LastOnForUnformat.state > 240 && InSight_ClothesWasher_OnTodayUnformat.state > 240) {	

							logInfo("tAlive","ClothesWasher_tAlive --> RESCHEDULE Timer!")
							ClothesWasher_Proxy.postUpdate('Running')	
							Echo_Laundry_Switch.postUpdate(OFF)						
							ClothesWasher_tAlive.reschedule(now().plusMinutes(3))
							return;
						}

						if (Home_Away.state == ON && InSight_ClothesWasher_LastOnForUnformat.state > 240 && InSight_ClothesWasher_OnTodayUnformat.state > 240 && Echo_Laundry_Switch.state != ON && Home_Away.state == ON && ClothesWasher_Proxy != 'Done' && ClothesWasher_Proxy != 'Empty' && currHour.state >= 7 && currHour.state <= 20 && Alexa_Status.state == 'ONLINE' && Washer == 2 ) {
							
							logInfo("WASHER","Turning Laundry Room Light on with InSight_ClothesWasher_CurrentPower value is " + Washer)
				
							Echo_Laundry_Switch.postUpdate(ON)					// stops it from running multiple times
							ClothesWasher_Proxy.postUpdate('Done') 
				
							logInfo("tAlive","CREATING Generic 13 Timer!")
							createTimer(now().plusNanos(1000), [ |

								Switch_LaundryRoom_Light.sendCommand(ON)
									Thread::sleep(1500)  
								Switch_LaundryRoom_Light.sendCommand(ON)
							])
				
							if (Home_Away.state == ON && Switch_LaundryRoom_Light.state == ON && LaundryWemoDelay_tAlive === null) {   		
					
								logInfo("WEMO","Switch_LaundryRoom_Light - CATCH ALL 15 min timer to turn OFF light.")
								logInfo("tAlive","LaundryWemoDelay_tAlive is null --> CREATING Timer!")
								LaundryWemoDelay_tAlive = createTimer(now().plusMinutes(15), [ |

									logInfo("tAlive","LaundryWemoDelay_tAlive timer ran out --> nulling timer.")
						
									Switch_LaundryRoom_Light.sendCommand(OFF)
										Thread::sleep(1500)  
									Switch_LaundryRoom_Light.sendCommand(OFF)
									
									Echo_Laundry_Switch.postUpdate(OFF)
			  
									LaundryWemoDelay_tAlive = null
								])
							}
			
							if (WasherDone_tAlive === null) {
			
								logInfo("tAlive","WasherDone_tAlive timer ran out --> nulling timer.")
								WasherDone_tAlive = createTimer(now().plusSeconds(5), [ |
								
									try {						
											logInfo("tAlive","CREATING Generic 280 Timer!")
											createTimer(now().plusMinutes(10), [ |
								
												Echo_Laundry_Switch.postUpdate(OFF)
											])	

											var String Message = '<speak><prosody rate="fast">Excuse me, The washing machine is finished.</prosody></speak>'
											
											var EchoThingLivingRoom = getThingStatusInfo("amazonechocontrol:echo:account1:echolivingroom") 
											if ((EchoThingLivingRoom !== null) && (EchoThingLivingRoom.getStatus().toString() == 'ONLINE' && gDnD_TTS_Doors.state != ON)) {
											
												logInfo("ECHO","Alexa_TTS_Doors - Washing Machine Done.") 
												Alexa_TTS_Doors.sendCommand(Message)
													Thread::sleep(3500)
											}		

											if (Home_Away.state == ON && gInternet.state == ON && Echo_Parker_doNotDisturb.state != ON && (ParkersPhoneDevice.state == ON || UnifiParker.state == ON)) {

												Echo_Parker_TTS.sendCommand(Message)  
													Thread::sleep(1500)
											}
							  
											if (currHour.state >= 6 && currHour.state <= 19 && Echo_Bedroom_doNotDisturb.state != ON) {	Echo_Bedroom_TTS.sendCommand(Message) 
													Thread::sleep(1500)	
													
												if (Switch_Bathroom_Light.state == ON && Echo_Bathroom_doNotDisturb.state != ON)	  { Echo_Bathroom_TTS.sendCommand(Message) }
													Thread::sleep(1500)
													
												var EchoThingGuestBathroom 	= getThingStatusInfo("amazonechocontrol:echo:account1:echoguestbath")
												if ((EchoThingGuestBathroom !== null) && (EchoThingGuestBathroom.getStatus().toString() == 'ONLINE')) {		
																					
													if (Switch_KidsBathroom_Light.state == ON )  { createTimer(now().plusSeconds(5), [ | Echo_Guest_Bathroom_TTS.sendCommand(Message) ]) }
												}	
											}
											
											var EchoThingGym = getThingStatusInfo("amazonechocontrol:echo:account1:echogym")
											if ((EchoThingGym !== null) && (EchoThingGym.getStatus().toString() == 'ONLINE')) {					
										
												if (Switch_Gym_Light.state == ON && Echo_Gym_doNotDisturb.state != ON) {
								
													Echo_Gym_TTS.sendCommand(Message)
														Thread::sleep(1500)
												}
											}	
							
											var EchoThingBackYard = getThingStatusInfo("amazonechocontrol:echo:account1:echobackyard")
											if ((EchoThingBackYard !== null) && (EchoThingBackYard.getStatus().toString() == 'ONLINE' && Alexa_Status.state == 'ONLINE' && gInternet.state == ON)) {
							
												if (Home_Away.state == ON && EchoThingBackYard.toString() == 'ONLINE' && (Wallplug_String_Lights.state == ON || PatioDoor_Status.state == OPEN || gPart1Zone3Fault.state == ON)) {
												
													Echo_BackYard_TTS.sendCommand(Message)   

												} else if (EchoThingBackYard.toString() == 'ONLINE' && PatioDoor_Status.state != OPEN && gPart1Zone3Fault.state != ON && (Sonos_BackYard_State.state == 'PLAYING' || Sonos_OnWallOutside_State.state == 'PLAYING')) {
												
													Echo_BackYard_TTS.sendCommand(Message)
												}
														
												Thread::sleep(1500)				
											}	
								
											if (JayAndriodUnifiRIS.state == ON && Home_Away.state == ON && JsAndriodUnifi.state == OFF && JaysPhoneDevice.state == OFF && Alexa_Status.state == 'ONLINE') {		
						 
												var EchoThingRIS  = getThingStatusInfo("amazonechocontrol:echo:account1:echoris")		
												if ((EchoThingRIS !== null) && (EchoThingRIS.getStatus().toString() == 'ONLINE')) {
						 
													Echo_RIS_TTS.sendCommand(Message)
												}	
											}
						
											ClothesWasher_Proxy.postUpdate('Empty')	
											Washer = 2									// set washer value again
										
										} catch (Exception e) {
									 
											logError("ERROR","Washer Done Inside Thread BLEW up. Exception is " + e.getMessage)
										}							
										
									WasherDone_tAlive = null
								])
							}
					
						} else if (Home_Away.state == ON && Washer >= 10 && InSight_ClothesWasher_LastOnForUnformat.state > 240 && InSight_ClothesWasher_OnTodayUnformat.state > 240) {
					
							ClothesWasher_Proxy.postUpdate('Running')	
							Echo_Laundry_Switch.postUpdate(OFF)				
				
						} else if (Home_Away.state == ON && ClothesWasher_Proxy != 'Done' && ClothesWasher_Proxy != 'Empty' && currHour.state < 7 && Washer == 2 && InSight_ClothesWasher_LastOnForUnformat.state > 240 && InSight_ClothesWasher_OnTodayUnformat.state > 240) {
				
							// Before 7 am w/o speaking on Echo
							Washer = 2											// set washer value again
							ClothesWasher_Proxy.postUpdate('Done')
				
							logInfo("tAlive","CREATING Generic 14 Timer!")
							createTimer(now().plusNanos(1000), [ |

								Switch_LaundryRoom_Light.sendCommand(ON)
									Thread::sleep(1500)  
								Switch_LaundryRoom_Light.sendCommand(ON)
							])
						}
					
				} catch (Exception e) {
			 
					logError("ERROR","Washer Done Outside Thread BLEW up. Exception is " + e.getMessage)
				}					

				ClothesWasher_tAlive = null
			])

		} else if (systemStarted.state != ON && ClothesWasher_tAlive !== null && InSight_ClothesWasher_CurrentPower.state !== null && InSight_ClothesWasher_CurrentPower.state != NULL) {

			PostWasher = InSight_ClothesWasher_CurrentPower.state as Number
			
			if (PostWasher > 10 && InSight_ClothesWasher_LastOnForUnformat.state > 240 && InSight_ClothesWasher_OnTodayUnformat.state > 240) {	

				ClothesWasher_Proxy.postUpdate('Running')
			}
		}
end	

Best, Jay

I had similar issue and used persistence to get average and min of the last 5/10 minutes, what solved the issue

1 Like