I do not recommend to instantly change the status of your washing machine when the power falls below a certain threshold but to use timers (see my example a couple of posts above). It may be that your equipment reports values below a certain threshold just for a second or two which will result in your script assuming that the washing is finished.
You might have to explain this a bit more. You certainly can get weirdness with filename and
rule "blah"
naming clumsiness, but this usually only affects file-based rule users. Show us the names of whatever it is you are concerned about?
Hi,
i very new to OH and i have zero knowlege about rules and the needed items/groups.
I did alot of trial and error. With no result.
But then i tried the State-O-Matic binding and Boom it works just with the expression in the widget config.
State o matic binding offers channels like running time, state, Powerā¦all what you solved with items and rules i think.
Im glad, that i found my way to use your beautiful widget! I combined it with a telegram bot and now i have a smart washing mashine which can talk, looks good and i hope my wife likes
Thank you for all your work!
Cheers
yes sorry, i meant in the second rule the iāve posted, there is this line:
Java.type("org.slf4j.LoggerFactory").getLogger("scripts.washing.runtime");
and i asked, because i use this template rule for disher, washing machine, and for dryer (of course changing items names) i just asked if i need to change also that line for example as:
Java.type("org.slf4j.LoggerFactory").getLogger("scripts.drying.runtime");
or
Java.type("org.slf4j.LoggerFactory").getLogger("scripts.cleaning.runtime");
thx
ok, so i just need to find the right values on where to put states.
one request, is it possibile to ask you if youāre able to build a widget also for hoover and one for fridge?
for fridge could be a nice idea to put moving ice crystals
Great ideas, however to be honest I wonāt be doing these as long as I donāt own a smart fridge myself. Itās simply a lot of work to create these (at least for me) and thereās just always too little timeā¦
However somebody may be picking up the ideas and create something?!
I may be creating a letterbox soon but first I need to build a sensor for it
Hello together
thanks for the widget. It looks really great but Iām really too stupid to understand where to put my status item. With the props I can not select an item.
My status item comes from a rule with a shelly plug with four statuses which looks like this:
val Number MODE_OFF = 0
val Number MODE_STANDBY = 1
val Number MODE_ACTIVE = 2
val Number MODE_FINISHED = 3
var java.util.concurrent.locks.ReentrantLock finishLock = new java.util.concurrent.locks.ReentrantLock()
rule "Washingmachine Consumption State Machine Echo_Dot"
when
Item TP_Link_Waschmaschine_power changed
then
if (TP_Link_Waschmaschine_power.state < 0.2) WashingMachine_OpState.postUpdate(MODE_OFF)
else if (TP_Link_Waschmaschine_power.state > 12) WashingMachine_OpState.postUpdate(MODE_ACTIVE)
else if (TP_Link_Waschmaschine_power.state < 5) {
if (WashingMachine_OpState.state == MODE_OFF) WashingMachine_OpState.postUpdate(MODE_STANDBY)
else if (WashingMachine_OpState.state == MODE_ACTIVE) {
finishLock.lock()
try {
Thread::sleep(20000) // Debounce for 20 seconds
if (TP_Link_Waschmaschine_power.state < 4) WashingMachine_OpState.postUpdate(MODE_FINISHED)
} finally {
finishLock.unlock()
}
}
}
end
If necessary, I would adjust the rule so that there are only three statuses, if the four do not work out.
Thanks
Daniel
HI @Daniel_OH,
I am also using the widget and my configuration looks like this:
or in code:
component: widget:washing_machine_v4
config:
itemGroup: SteckdoseWaschmaschine
runtime: =items.Waschmaschine_Runtime.state
state: =items.Waschmaschine_OpState.displayState
title: Waschmaschine
The ādisplayStateā of the item Waschmaschine_OpState is mapped like this via āState Description | Optionsā:
// Waschmaschinenstatus
0=OFF
1=STANDBY
2=RUNNING
3=FINISHED
=-
(Donāt mind the standby status. It has no effect on the proper function of the widget. As I can see - you also have a Standby status )
Cheers
Jonathan
Hi Jonathan
thx - that helps a lot. How du you calculate your runtime?
Thats what I have so far but I think it will not work and if it would somehow work, it would not reset to 0
configuration: {}
triggers:
- id: "1"
configuration:
cronExpression: 0 * * * * ? *
type: timer.GenericCronTrigger
conditions:
- inputs: {}
id: "3"
configuration:
itemName: WashingMachine_OpState
state: "2"
operator: =
type: core.ItemStateCondition
actions:
- inputs: {}
id: "2"
configuration:
type: application/javascript;version=ECMAScript-2021
script: |+
WashingMachine_Runtime.state + 1
type: script.ScriptAction
Thank you
Daniel
Hi Daniel,
your cron expression should be triggered once a minute, is this the case? Then I think your rule should work!
To reset to 0 you could add a second rule that gets triggered once when the status changes to RUNNING.
Regards
Thomas
I am resetting my timer (to 1 min, just like Thomas stated elsewhere) when the state machine switches to the running state:
if (Waschmaschine_OpState.state != MODE_ACTIVE) {
Waschmaschine_OpState.postUpdate(MODE_ACTIVE)
Waschmaschine_Runtime.postUpdate(1)
}
Cheers
Jonathan
thank you jonathan
can you please send the whole rule, as this seems only to be a part of the rule.
Thank
Daniel
thank you - I oversaw your post in the first place.
Will try it in combination with the suggestion of Jonathan
Sure:
configuration: {}
triggers:
- id: "1"
configuration:
itemName: SteckdoseWaschmaschine_Power
type: core.ItemStateChangeTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
type: application/vnd.openhab.dsl.rule
script: >-
val Number MODE_OFF = 0
val Number MODE_STANDBY = 1
val Number MODE_ACTIVE = 2
val Number MODE_FINISHED = 3
val String logPrefix = 'Waschmaschine StateMachine - '
if (EnableLog_WaschmaschineRules.state == ON) logInfo('waschmaschine.rules', logPrefix + 'StateMachine Zustand alt: ' + Waschmaschine_OpState.state.toString + '; Leistung momentan: '+ SteckdoseWaschmaschine_Power.state.toString)
if (EnableLog_WaschmaschineRules.state == ON) logInfo('waschmaschine.rules', logPrefix + 'Leistung momentan (doubleValue): '+ (SteckdoseWaschmaschine_Power.state as QuantityType<Power>).doubleValue.toString)
if ((SteckdoseWaschmaschine_Power.state as QuantityType<Power>).doubleValue < 0.5) {
Waschmaschine_OpState.postUpdate(MODE_OFF)
}
else if ((SteckdoseWaschmaschine_Power.state as QuantityType<Power>).doubleValue > 15) {
if (Waschmaschine_OpState.state != MODE_ACTIVE) {
Waschmaschine_OpState.postUpdate(MODE_ACTIVE)
Waschmaschine_Runtime.postUpdate(1)
}
}
else if ((SteckdoseWaschmaschine_Power.state as QuantityType<Power>).doubleValue < 6.5) {
if (Waschmaschine_OpState.state == MODE_OFF) Waschmaschine_OpState.postUpdate(MODE_STANDBY)
else if (Waschmaschine_OpState.state == MODE_ACTIVE) Waschmaschine_OpState.postUpdate(MODE_FINISHED)
}
if (EnableLog_WaschmaschineRules.state == ON) logInfo('waschmaschine.rules', logPrefix + 'StateMachine Zustand neu: ' + Waschmaschine_OpState.state.toString)
type: script.ScriptAction
Edit:
This rule design is based on: Washing Machine State Machine - Tutorials & Examples - openHAB Community
Cheers
Jonathan
thank you
Hey Rondal,
i hope youāve got an advice for meā¦
All my Miele Maschines doesnāt update the states for the widgetā¦
The Dryer for example looks like:
component: widget:washing_machine_v4
config:
title: Trockner
state: =items.Trockner_OperationState.state
runtime: =(items.Trockner_ProgramRemainingTime.state)/60
header: =items.Trockner_ProgramPhase.state
footer: =items.Trockner_ActiveProgram.state + ' / ' + items.Trockner_DryingTarget.state
dryer: ON
On a created Sitemap all Points are updated correctly (automatically) and show the correct state.
But in the widget it doesnāt work - state is always ā-ā
Have you any idea for me?
Installation error
Hi there,
Iām getting an error trying to install this widget from Marketplace.
[ERROR] [mmunity.CommunityUIWidgetAddonHandler] - Unable to parse YAML: Cannot deserialize value of type `java.util.Date` from String "Oct 2, 2021, 9:24:59 PM": not a valid representation (error: Failed to parse Date value 'Oct 2, 2021, 9:24:59 PM': Unparseable date: "Oct 2, 2021, 9:24:59 PM")
at [Source: (StringReader); line: 36, column: 12] (through reference chain: org.openhab.core.ui.components.RootUIComponent["timestamp"])
[ERROR] [mmunity.CommunityUIWidgetAddonHandler] - Widget from marketplace is invalid: Unable to parse YAML
Any idea why and how to solve this?
I havenāt installed it from the marketplace myself so I cannot really help here. Which OH version are you using? It seemed to work for quite a few other users so this may have something to do with a new OH version maybe?
Itās openHAB 3.2 Release running on Ubuntu Linux.
Any hint why āā¦ _Remainingprogramtimeā is ony showed as NaN? In my Setup the String is for example ā3000 sā the other part work fineā¦