WeMo Insight tied to a US Clothes Washer Example

I wanted to share the rule I used to alert the house using Amazon TTS with the WeMo Insight Plug on a US Clothes Washer.

Hope this helps someone else.

Items:

String		ClothesWasher_Proxy						"Clothes Washer is [MAP(clotheswasher_proxy.map):%s]"					(WeMo)		
Switch 		InSight_ClothesWasher_State				"Washer Outlet Power [MAP(On_Off.map):%s]"			<poweroutlet_us> 	(WeMo)	{ channel="wemo:insight:Insight-1_0-XXXXXXX:state" }
DateTime	InSight_ClothesWasher_LastChangedAt		"Last Changed At [%1$tm.%1$td.%1$tY %1$tH:%1$tM]"	<time> 						{ channel="wemo:insight:Insight-1_0-XXXXXXX:lastChangedAt" }
Number		InSight_ClothesWasher_LastOnFor			"Last On For [JS(duration_from_seconds.js):%s]"		<time>						{ channel="wemo:insight:Insight-1_0-XXXXXXX:lastOnFor" }
Number		InSight_ClothesWasher_OnToday			"On Today [JS(duration_from_seconds.js):%s]"		<time>						{ channel="wemo:insight:Insight-1_0-XXXXXXX:onToday" }
Number		InSight_ClothesWasher_OnTotal			"On Total [JS(duration_from_seconds.js):%s]"		<time>						{ channel="wemo:insight:Insight-1_0-XXXXXXX:onTotal" }
Number		InSight_ClothesWasher_TimeSpan			"Time Span [JS(duration_from_seconds.js):%s]"		<time>						{ channel="wemo:insight:Insight-1_0-XXXXXXX:timespan" }
Number		InSight_ClothesWasher_AveragePower		"Average Power [%.1f W]"							<energy>					{ channel="wemo:insight:Insight-1_0-XXXXXXX:averagePower" }
Number		InSight_ClothesWasher_CurrentPower		"Current Power [%.1f W]"							<energy>					{ channel="wemo:insight:Insight-1_0-XXXXXXX:currentPower" }
Number		InSight_ClothesWasher_EnergyToday		"Energy Today [%.1f W]"								<energy>					{ channel="wemo:insight:Insight-1_0-XXXXXXX:energyToday" }
Number		InSight_ClothesWasher_EnergyTotal		"Energy Total [%.1f W]"								<energy>					{ channel="wemo:insight:Insight-1_0-XXXXXXX:energyTotal" }
Number		InSight_ClothesWasher_StandByLimit		"Stand By Limit [%s]"								<time>						{ channel="wemo:insight:Insight-1_0-XXXXXXX:standByLimit" }

Mapping:

Done=Done
done=Done
DONE=Done
Empty=Empty
empty=Empty
EMPTY=Empty
Running=Running
running=Running
RUNNING=Running
null=Unknown
NULL=Unknown

Rule:

rule "Clothes Washer Cycle Done"
	when
		Item InSight_ClothesWasher_CurrentPower changed
	then
	
		var Washer = InSight_ClothesWasher_CurrentPower.state as Number
		// 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.0 W

		if (currHour.state !== null) {
			currHourVariable = now.getHourOfDay
			currHour.postUpdate(currHourVariable) }

		if (ClothesWasher_Proxy != 'Done' && ClothesWasher_Proxy != 'Empty' && currHour.state >= 7 && currHour.state <= 22 && Alexa_Status.state == 'ONLINE' && Washer < 3 ) {
			
			// logInfo("Washer", "InSight_ClothesWasher_CurrentPower state is " + InSight_ClothesWasher_CurrentPower.state)
			// logInfo("Washer", "Variable Washer value is " + Washer)

			ClothesWasher_Proxy.postUpdate('Done')
			
			logInfo("Echo", "-----------------------------------------------------------------------------")
    		logInfo("Echo", "** Echo Speaking on Living Room")
			logInfo("Echo", "-----------------------------------------------------------------------------")
			if (Echo_Living_Room_textToSpeechVolume.state != '40' ) { Echo_Living_Room_textToSpeechVolume.sendCommand('40') }
				Thread::sleep(2000)  // 2 second wait
        	Echo_Living_Room_TTS.sendCommand("Excuse me, The clothes washer has completed its wash cycle.")
				Thread::sleep(2000)  // 2 second wait

			logInfo("Echo", "Echo speaks - The clothes washer has completed its wash cycle.")

		}

		if (Washer > 10 ) {
			
			// logInfo("Washer", "InSight_ClothesWasher_CurrentPower state is " + InSight_ClothesWasher_CurrentPower.state)
			// logInfo("Washer", "Variable Washer value is " + Washer)

			ClothesWasher_Proxy.postUpdate('Running')
		}
end

Best, Jay

1 Like