Washing machine status widget

It appears in the marketplace, but fails to “Add” with the following message in the logs:

16:52:35.337 [ERROR] [mmunity.CommunityUIWidgetAddonHandler] - Widget from marketplace is invalid: Couldn't find the widget in the add-on entry

Same goes for the Dishwasher widget.

I am able to install other widgets…

Thanks for testing. Could you try once more please? If it still does not work I’m out of ideas how to fix this…

1 Like

Yep, works now!

1 Like

I can also confirm it works. Thanks a lot for your support and for such a great widget @DrRSatzteil!

hey guys,
I’m struggling to get the widget running.

This is my expression for the state and the item washingmachineBosch_state.state is switched via rule between ‘Aus’, ‘Waschvorgang’, ‘Waschvorgang beendet’

=items.washingmachineBosch_state.state == 'Aus' ? "OFF" : items.washingmachineBosch_state.state == 'Waschvorgang' ? "RUNNING" : items.washingmachineBosch_state.state == 'Waschvorgang beendet' ? "FINISHED" 

after configuration the widget looks like this:
grafik

but in run mode there is no time and no status (animation)

Could anyone help me please?

The screenshot you provided is from the edit mode of the page you added the widget to. It should behave normally once you saved the page and open the page from the normal Main UI view. Did you try that? Does it still look like this?

Alternatively you can switch to run mode in the bottom right corner.

Thanks for your fast reply.
Yeah I switched back to the normal UI view, with both of your described ways. I even tried Chrome browser instead of firefox and cleared my cache. This is how it looks like in normal view.
grafik

Do my provided expressions look right to you?

No this does not look right but I was able to replicate this behaviour:

You need to replace the values “Aus”, “Waschvorgang” and “Waschvorgang beendet” with the actual states of your washingmachineBosch_state item. I assume that this item has different states than the one used in the expression is that correct? If none of the Strings in the expression match the actual item state the widget looks like shown in your screenshot.

If you provide me the actual values that washingmachineBosch_state may have I might be able to help you fix the expression.

OK…now after some trial an error I got it running and even found my mistake. In the expression the last “else”-Option was missing. By adding another colon with an else option everything works fine :slight_smile:
So the right expression in my case would be:

=items.washingmachineBosch_state.state == 'Aus' ? "OFF" : items.washingmachineBosch_state.state == 'Waschvorgang' ? "RUNNING" : items.washingmachineBosch_state.state == 'Waschvorgang beendet' ? "FINISHED" : "OFF"

OR even leave out the last condition and just make the “FINISHED” as an else option

=items.washingmachineBosch_state.state == 'Aus' ? "OFF" : items.washingmachineBosch_state.state == 'Waschvorgang' ? "RUNNING" :  "FINISHED"
1 Like

Ok great that you got it working! I didn’t see that error in the expression… it can get quite hard to read if the line gets longer and longer :wink:

1 Like

Hi
this widget looks really beautyfull.
I’am migrating my system from OH2 to OH3.
I will also use a shelly plugs to make the washing machine “smart”.
to calculate the minutes running I want to calculate the time between started and now.
Does anyone have an example or a hint for me?

You may have a look at the third post in this thread. I explained how my solution is working. I’m using the persistence extensions to retrieve the time since the last status update. Someone else suggested to do something simpler a few posts after mine: you could just trigger a rule every minute as long as the machine is running and increase the runtime by one minute in a very simple script.

Hi Thomas
thanks, this was that what really helped.
Now I have to figure out what is the initial consumption when the machine starts and is finished

Then I can addapt it to the dryer and dishwasher

Let’s see if it has the WAF and I can think about the Miele bridge

BR Uwe

But

Well I must confess that my status determination rule has grown a bit more complicated to skip phases of low consumption that do not mark the end of the washing program. However don’t worry, most of the additional code was added so that I could reuse the same rule for dishwasher, washing machine and dryer which is not really needed. I guess having three rules is actually simpler that what I did but it gets tiring to change the same code in three different locations…

Feel free to use this or feel free to check out the other code examples for the same problem here in the forums! I’ve seen quite a few solution so far and they may be better than my own?! Who knows, this works for me at least :wink:

var Semantics = Java.type("org.openhab.core.model.script.actions.Semantics");
var NotificationAction = Java.type("org.openhab.io.openhabcloud.NotificationAction");
var PersistenceExtensions = Java.type("org.openhab.core.persistence.extensions.PersistenceExtensions");
var ScriptExecution = Java.type("org.openhab.core.model.script.actions.ScriptExecution");
var ZonedDateTime = Java.type("java.time.ZonedDateTime");
var logger = Java.type("org.slf4j.LoggerFactory").getLogger("scripts.test");


// Load config
var triggerItem = ir.getItem(event.itemName);
var outlet = Semantics.getEquipment(triggerItem);
var equipment = ir.getItem(outlet.name.replace('outlet_',''));
var threshold;
var zero;
var waitTime;
var icon;

equipment.getMembers().forEach(function(member) {
  if(member.name == equipment.name + "_config") {
    member.getMembers().forEach(function(configItem){
      if(configItem.name == equipment.name + "_config_threshold") {
        threshold = configItem.state;
      }
      if(configItem.name == equipment.name + "_config_zero") {
        zero = configItem.state;
      }
      if(configItem.name == equipment.name + "_config_waittime") {
        waitTime = configItem.state;
      }
      if(configItem.name == equipment.name + "_config_icon") {
        icon = configItem.state;
      }
    });
  }
});

if (icon == undefined || icon == NULL) {
  icon = "whitegood";
}

if ((threshold != undefined && threshold != NULL) && 
    (zero != undefined && zero != NULL) && 
    (waitTime != undefined && waitTime != NULL)) {
  if (newState <= zero) {
    if (this.timer != undefined) {
      this.timer.cancel();
      this.timer = undefined;
    }
    events.sendCommand(equipment.name + '_status', 'OFF')
    if(oldState > threshold) {
      NotificationAction.sendBroadcastNotification(equipment.getLabel() + " ausgeschaltet", icon, "Info");
    }
    oldState.toString();
  } else if (newState >= threshold && oldState < threshold) {
    if (this.timer != undefined) {
      this.timer.cancel();
      this.timer = undefined;
    } else {
      events.sendCommand(equipment.name + '_status', 'RUNNING');
      events.sendCommand(equipment.name + '_runtime', 0);
    }
  } else if (newState < threshold && oldState >= threshold) {
    var futureTime = ZonedDateTime.now().plusMinutes(waitTime);
    this.timer = ScriptExecution.createTimer(futureTime, function() {
      events.sendCommand(equipment.name + '_status', 'FINISHED');
      this.timer = undefined;
      NotificationAction.sendBroadcastNotification(equipment.getLabel() + " ist fertig", icon, "Info");
    });
  }
}

Hi Thomas
thanks for sharing this rule

I will try to understand how it works and after that to implement
But at the moment I try to migrate my rollershutter and the shutter rules and the homematic stuff

And I have to find a way to understand the difference between habpanell OH 2 and OH 3 and how I can arive the similar behavior

Everybody knows, it is allways the WAF :wink:

BR Uwe

Is it somehow possible to get the average power value using persistence. My Washing machine often pauses with <1W.

Sure: you can use averageSince in the PersistenceExtensions

Thank you for this great widget!
That says I have a problem of adjustment between chrome and the android app, and this on several mobile or tablets, do you have an idea?

many thanks

with chrome:


with android app

Hm, sorry I’ve never seen this behaviour on any of my devices (Android phone, iPhone, iPad) or any browser. I can’t really try to fix it without being able to replicate this unfortunately. Have you modified the widget or are you using it in conjunction with some other widget that may affect the layout?

no i have this type of behaviour to some widget, and really i don’t know why…