Dishwasher Widget with smart outlet

I want to use this widget with my OH to show if the dishwasher is running Dishwasher Status

To make it working I bought smart outlet from Tuya. I’ve configured the current channel so it shows when the dishwasher is using electricity, but I don’t know how to map it to Minutes running and State that are required by dishwasher widget

With the information available, the only approach I can think of is you’ll need to do the following.

  1. Create a Number:Time Item to store the minutes
  2. Create the String Item to store the running state of the dishwasher
  3. Create a rule that identifies when the dishwasher starts running (you’ll have to figure that out but it looks like you can see if the power stays over 8000 for a few minutes you can assume it’s started) and update the Item created in 1 with number of minutes. This same rule will need to detect when the washer is done (power under 100 for long enough?) and it should update the Item in 2 also.
  4. The expression for the widget then just pulls the state from these Items.

Can you point me to a documentation how can I do point 1 and 2?

śr., 31 sty 2024, 21:21 użytkownik Rich Koshak via openHAB Community <bot@community.openhab.org> napisał:

Creating and using Items is kind of the bare minimum you need to know in order to be successful with OH.

Ah I see. So I need to create item in items file? Till now I was only creating items from UI

Hi Martin,
to answer your question: you can decide if you want to go for a textual- or GUI-based config.
Both is possible. :smiley:

I recommend to read some basic docu :slight_smile: … as Rich also recommended. I know, nobody likes reading docu - but here it’s worth to learn how OH works. If you understood once the concept you can do so many things with OH :slight_smile:

One of the links above has a section showing how to create Items through MainUI.

I use it like this:

dishwasher

My dishwasher equipement has a status item that needs to be set to RUNNING when the machine is running and OFF when it is powered down. These are both easy - when the power is over 5 watts in my case the machine is running. When the poweroutlet is off or the power is at 0 watts either the dishwasher or the outlett are switched off.

Maybe you chart a few runs of the dishwasher to know how it looks like when its done. In my case five minutes under 5 watts works well but your machine might behave differently. If you use an eco mode this might be the case and you might have to wait longer. When the time is up you set the state item (Spühlmaschinenstatus in my case) to FINISHED and the widget shows the result.

Thank you all! I was familiar with concept of items, but I didn’t know that I’m able to create it on my own. I always thought that only plugins can do it.

For future generations I’m putting my items and rules below:

DateTime Dishwasher_Runtime "Dishwasher Start Time [%1$tA, %1$td.%1$tm.%1$tY %1$tH:%1$tM]"  <clock>

String Dishwasher_State "Dishwasher State [%s]" <dishwasher>
var onOffThreshold = 30

// Rule to detect when the device starts running
rule "Dishwasher Started"
when
    Item Gniazdko_2_Current changed
then
    if (Gniazdko_2_Current.state <= onOffThreshold) return;
	if (Dishwasher_State.state.toString == "RUNNING") return;
	Dishwasher_Runtime.postUpdate(new DateTimeType())
	Dishwasher_State.postUpdate("RUNNING")
end

// Rule to detect when the device is done
rule "Dishwasher Done"
when
    Item Gniazdko_2_Current changed  
then
    // Sometimes the current goes to zero, but the device did not finished working
	// This loop checks every 1 sec if current is below treshold for total time of 125 secs
	// if at some point current will be above threshold, the rule finishes - the device did not yet finish working
	var secondsToWaitForCheck = 125
	for (var idx = 0; idx < secondsToWaitForCheck; idx ++) {
	if (Dishwasher_State.state.toString != "RUNNING") return;
		if (Gniazdko_2_Current.state >= onOffThreshold) return;
		Thread::sleep(1_000)
		if (Dishwasher_State.state.toString != "RUNNING") return;
		if (Gniazdko_2_Current.state >= onOffThreshold) return;
	}
	
	Dishwasher_Runtime.postUpdate(new DateTimeType())
	Dishwasher_State.postUpdate("FINISHED")
	createTimer(now.plusMinutes(30), [|
		Dishwasher_State.postUpdate("OFF")
	])
end