Washing Machine State Machine

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.

I don’t know Smappee, but judging from the website it’s cloud-powered. So your local Installation sends the data to the Cloud and the Apps use this data.
I also found, Smappe provides an API: https://smappee.atlassian.net/wiki/display/DEVAPI/SmappeeDevAPI+Home
As it appears, this API provides the overall power consumption with Get Comsumption (https://smappee.atlassian.net/wiki/display/DEVAPI/Get+Consumption). I’m not into the Smappee terms, but it could be, that a “sensor” equals a identified appliance? In that case, the Get Sensor Consumption method brings up the sensor data (https://smappee.atlassian.net/wiki/display/DEVAPI/Get+Sensor+Consumption).

1 Like

Hi, i’m new here. I saw that it is referenced to e.g. Homematic HM-ES-PMSw1-Pl. But how do I connect this device to openHAB? If it’s using WifI, what protocol is it using? Or is it as easy as it seams to just connect a WiFi device? I cannot imagine. Regards.

Hey Moritz,
welcome to the openHAB community!! For such an off-topic question you might find a better answer by opening a new thread.

You want to integrate a Homematic device into your openHAB setup. Please read up on homematic. It doesn’t work with Wifi. You will need a special tranceiver for that. You can either use your existing CCU2 or (my preferred recommendation) a Raspberry Pi with a busware SCC tranceiver stacked on top of it and running the homegear software. Our openHAB Raspberry Pi image openHABian includes all setup steps needed to get this combination working for you. Have a look:

For any further question I would kindly ask you to open a new thread. Good luck!

1 Like

Hi, here grahps of my washig machine and Sonoff POW and Sonoff-Tasmota firmware :slight_smile:

Sonoff POW not very sensitive to low power load, but increasing Period to 1 minute or 2 should look better.


I also experience some peaks in power usage, if the washing machine is ready - or sometimes if it’s not fully turned off.
These peaks are high enough to be trigger the threshold:

If you take a close look, the machine is ready at about 9:20 (after all those peaks) and it’s showing the “ready”-LED in front, but still, there are some POW-peaks over 10Watts (here at 09:26) occurring, which makes my logic a bit complicated…

Looks like your problem, too? Some more with this behaviour?

Typically at the end many machines have something called “Knitterschutz” in Germany. his means that the machine tumbles every seconds or minutes the clothes again, and so your have some spikes in Power consuption. This is one of the states that should be used with a timer.


1 Like

Hi @Seaside ,
I am very interesting and would like to know how these part works?
do you mind share your code how to record start end time also calculate the running time?

Thank you and Regards

1 Like

I double checked that. At first, the program i ran didn’t have a “knitterschutz” at the end (more common with dryers). The peaks also appear, if there’s no program running at all. Perhaps something, my SIEMENS iq300 washing mashine does it anyways…?

There is also a local API for Smappee to get some numbers from it. I just set it up and will work on a post next week.

I’m running Smappe for more than a year now. The app is quite nice, but relies on the cloud service. There are several ways to poll the smappee data from the local device as well. I’m using a bash script for that, but havent found a way to access “device data” but only the overall consumption. Theres a github issue asking for a Smappee binding. Would love to see this.

Hi all,

I setup a washing machine state machine. It works fine. Thanks @ThomDietrich for this great tutorial. After the state changes to FINISHED I adittionally create a report to sum up the progress. I did some calculations and create a report to be send per email or whatever notification service you like.

My items:

Number householdWashingMachineState "State [MAP(household-en.map):%d]" <washingmachine_2>
DateTime householdWashingMachineLastChange "Last Change [%1$tA, %1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS Uhr]" <clock>

@hamwong Here is an abstract of my rule for your inspiration and for general discussion:

import org.joda.time.*
import org.openhab.core.library.types.DateTimeType

val STATE_OFF = 0 

rule "Washing Machine State changed"
    Item householdWashingMachineState changed
    // create report if washing machine is finished
    if( householdWashingMachineState.state == STATE_FINISHED ) {
        // get last change from item
        val lastChange = new DateTime(householdWashingMachineLastChange.state.toString)
        // calculate running time
        val seconds = (now.millis - lastChange.millis) / 1000
        val totalMinutes = seconds / 60
        val remainderSeconds = seconds % 60
        val totalHours = totalMinutes / 60
        val remainderMinutes = totalMinutes % 60
        // get energy consumption from persistence
        val diffEnergy = fritzWashingMachineEnergy.deltaSince(lastChange, "rrd4j")
        // calculate costs ... TODO
        val diffCosts = diffEnergy * 27.01

        val report = "State: " + householdWashingMachineState.state.toString + " (" + transform("MAP", "household-en.map", householdWashingMachineState.state.toString) + ")\n" +
                     "Begin: " + householdWashingMachineLastChange.state.format("%1$tA, %1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS Uhr") + "\n" +
                     "End: " + new DateTimeType().format("%1$tA, %1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS Uhr") + "\n" +
                     "Running time: " + String::format("%02d", totalHours) + "h " + String::format("%02d", remainderMinutes) + "m " + String::format("%02d", remainderSeconds) + "s\n" +
                     "Energy consumption: " + String::format("%.3f", diffEnergy.floatValue) + " kWh\n" +
                     "Costs: " + String::format("%.2f", diffCosts) + " Cent"

        val message = "Washing machine:\n\n" + report

        // send an email with message ... TODO
    // remember last change
    postUpdate(householdWashingMachineLastChange, new DateTimeType())

Have fun.


Thanks for sharing, I’ll try your solution immediately.

Thank you for your work. What kind of item is the item [quote=“cweitkamp, post:96, topic:15587”]

Have a nice evening!

[quote=“johannesbonn, post:98, topic:15587”]
What kind of item is the item[/quote]
I added my items in my original post.

Have a good one.

Oh my god:-), I lost sight of the wood for the trees.

Thank you for your patience!