Washing Machine State Machine

I thought it was there. Going to add it if I somehow didn’t make these clear.

Looks like the info was there but not clear. I reworked the section hopefully making it more clear.

I did some additional testing. It looks like classic UI does use the “unmapped” value (like OH1), basic UI does too (but doesn’t auto-refresh) but the iOS app NOT use the unmapped value.

It doesn’t matter if the icon is remapped in the sitemap.


Group Test

Switch Test1 "Schakelaar 1 [MAP(nl.map):%s]" <switch> (Test)
Switch Test2 "Schakelaar 2 [%s]" <switch> (Test)


sitemap test label="Test" {
	Frame label="Schakelaars" {
		Switch item=Test1
		Text item=Test1
		Text item=Test1 label="Schakelaar 1 [%s]" icon="switch"

		Switch item=Test2
		Text item=Test2
		Text item=Test2 label="Schakelaar 2 [MAP(nl.map):%s]" icon="switch"

		Group item=Test



I agree, that is probably the most convincing use case for BasicUI to use the raw Item state, not the mapped Item state.

Too bad at our house we all mostly use an iPhone or iPad with native app to control OH.

Known bug

My Sonoff Pow (or my Washing Machine, or my Dryer?) detects some peaks, even if the program is finished. Partly because they machine perfome some “anti-crease” actions to prevent the laundry to get knitted. partly because of some internal measuring effects of the Pow.

So I came up with an different approach for detecting the machine states: If you’re using persistance, why not use historic data for this. So I use the item.averageSince(AbstractInstant) extension to get an average of the last minutes to check, if there’s just noise or if it’s really a change of state:

so my rule ended up like this:

val Number MODE_OFF = 0
val Number MODE_STANDBY = 1
val Number MODE_ACTIVE = 2
val Number MODE_FINISHED = 3

rule "Washingmachine Consumption State Machine"
    Item Washingmachine_Power changed
    if (Washingmachine_Power.averageSince(now.minusMinutes(2)) < 0.2) Washingmachine_OpState.postUpdate(MODE_OFF)
    else if (Washingmachine_Power.averageSince(now.minusMinutes(2))> 10) Washingmachine_OpState.postUpdate(MODE_ACTIVE)
    else if (Washingmachine_Power.averageSince(now.minusMinutes(2))< 5) {
        if (Washingmachine_OpState.state == MODE_OFF) Washingmachine_OpState.postUpdate(MODE_STANDBY)
        else if (Washingmachine_OpState.state == MODE_ACTIVE) Washingmachine_OpState.postUpdate(MODE_FINISHED)

Also just an idea for making sure, the washing machine gets depleted: just attaching a button at the washing machine, which is pressed, if you take out the clothes. I’m thinking of Amazon Dash Button:

In that case, adding a item “Washingmachine_full” would be ON the same time, Washingmachine_OpState goes over to “MODE_FINISHED”. So you can add a rule, if the state of Washingmachine_full is ON since 30mins or so, you get some more decisive action like some creepy sound playing in the house, or whatever you like. That’s our pain even getting some pushovers to your mobile when the machine is ready: you press OK and it’s easily forgotten.

1 Like

Hey Thomas, averageSince is a nice idea! I had my personal reasons to not relying on persistence here but I can totally see the benefit, even for my system now. I’ll add the solution to the first post.
I’ll add the button idea as well. I myself just use the machine for it by only turning it off after I’ve removed everything. You know how it is, “Tausend Wege führen nach Rom” :slight_smile:

I’ve no time right now, please remind me if I forget :wink: Thanks!

I hope to try some of this this weekend. But curious how effective identifying your power consumption state on smaller appliances like toasters is. Or if there are multiple appliances going at the same time, if OH2 is getting confused on reporting the correct state of each.

I’m also considering getting an Aeotec HEM. Would monitoring the power consumption there give a better measurement?

Basically, I’m pretty sure, you’re not getting a clear picture, if there’s are more than one device on one measurment device. There’s too much noise to be considered and the logic would be a total mess. I didn’t expect much from my 10€ China-device, but it seems pretty stable. If you have a dedicated measuring device of any kind, you have to find out two things:

  1. how is the power consumption regarding to what you would like to achieve
  2. how short your intervals schould be. I can imagine a toaster requires a much shorter interval than a washing machine.

If you have done this (like @ThomDietrich explained in the first post of this thread), you can then adjust your rule to that.
Long Story short: I don’t think there’s a device small enough to be monitored and it is nearly impossible to filter a specific device, if you connect more than one to your power measurement device.

as explained above, the 10€ China-device delivers enough output for a clear rule. I don’t know the Aeotec HEM, but it should do the job. All you need is a reading of the wattage over time and then compare it to your thresholds - that’s it.

I do have some headaches also regarding the amount of data, which goes into the MySQL Server at this point. But I’m thinking of a garbage collection within MySQL or in a monthly/weekly rule within OH2 to get the old data out of the persistance. There are some values, which I want to persist over years (e.g. some variables regarding heating, weather and so on), to have a base for future rules or comparisons - but I don’t think the persisted Washing Machine states will needed for this! :wink:

@ptmuldoon I agree, it would be a fun experiment to break down overall consumption of multiple devices but from a practical standpoint, just get two modules and be done with it :wink:

Regarding the toaster: First it’s not a problem to detect states as long as they are characterized by a certain wattage (and/or duration). @binderth is right that it could be problematic to observe the toaster, as he will be active only for a short time. However you (@binderth) forgot, that most modules have a threshold option :wink: They will send acyclic extra measurements if a certain value is passed.
Both the mentioned Homematic and Sonoff Pow module provide this functionality.

I’d also recommend the Sonoff Pow as a cheap good module:

1 Like

Ok, but I’m really not sure how I connect those cheap modules to a washing machine or other without needing splice the power plug to the device, etc. Unless I am misreading the instructions to use them.

Aeotec offers the more expensive zwave home energy meter. And I was thinking perhaps monitoring the usage there of each device and you could do the same thing?

1 Like

I have one of those hooked up to the main feed circuit in the fuse box, so basically monitoring the total energy consumption of my house. It is working very well, and seems to give fairly precise measurement reports.

For monitoring of individual appliances, however, I am using Fibaro Wall Plugs (FGWPF-101). These devices are very well suited for the purpose. I am currently using these on my washing machine, drying machine, dishwasher, freezer and water heater.

Apart from being very nice devices, that are rock solid in operation, I can see the following two benefits:

  • Ease of use - simply plug it into the socket, and then plug your appliance into the device.
  • Master switch - If you happen to leave for an extended vacation, and forgot to turn off your washing machine, you can simply cut all power to the unit, :slight_smile:

oh. I didn’t understand this on my first readovers, but now I’m getting a bit more context. So this means basically, that the Sonoff sends (regardless of the intervall set in TelePeriod) a MQTT message, if I set a low and high wattage threshold and this threshold is met?

PowerHigh       | <watt>  | Set power high threshold value
PowerLow        | <watt>  | Set power low threshold value

I’m getting some more ideas! :wink:

That’s correct. The Sonoff Pow doesn’t have a outlet, you have to connect blank wires on them, see on the picutre on the bottom from left to right: L(OUT) - E/E - N/N - L(IN).

As my Installation in the cellar is surface-mounted, I just placed them in between the wiring. But you could also splice an extension cable and put it in the middle.

My issue is being the USA and I do not believe I can use the Fibaro’s here with different current/outlet system. But I do have unused a Leviton Zwave outlet not being used at the moment. I could potentially give that a try. I do believe those outlets track the usage/wattage of the outlet.

I may start with the Aeotec HEM first though. I do want some whole home energy monitoring.

And splicing an extension cord is a very good idea to use the cheap $10 ones.

In the end I think either solution has it’s benefits. The Sonoff module needs soldering/flashing/splicing, other modules are more expensive, others might have other interesting characteristics. The Z-Wave module might be nice if you are already using Z-Wave, Sonoff communicates over Wifi+MQTT, that might be another pro OR con to pay attention to. I think you get the idea :wink:

Yes that’s correct. That’s probably the only downside to Sonoff-Tasmota, the author is not the biggest fan of documentation :smiley: The threshold function is actually only know to me because I were the one to request it :smile: https://github.com/arendst/Sonoff-MQTT-OTA-Arduino/issues/38

1 Like

Did anyone have a look at Smappee for energy monitoring? It does promise to detect a large number of the appliances and measure energy usage in a home network only by monitoring just behind the meter. If it works well, it could give the inputs for a whole series of washing machine state machines. I don’t have one, but am intrigued by the simplicity this could provide for energy monitoring.

Interesting device. I see it connects to your home wifi and then uses the App to to check the usage. Unsure how it would monitor all appliances except for similar methods mentioned above in learning its energy usage.

And I do like the optional separte Water and Gas monitoring. But its more then double the cost of the Aeotec HEM.