Daniel_OH
(Daniel)
February 19, 2022, 12:49am
89
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
DrRSatzteil
(Thomas Lauterbach)
February 19, 2022, 8:03am
90
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
Daniel_OH
(Daniel)
February 20, 2022, 7:24pm
92
thank you jonathan
can you please send the whole rule, as this seems only to be a part of the rule.
Thank
Daniel
Daniel_OH
(Daniel)
February 20, 2022, 7:25pm
93
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
2 Likes
padarox
(Marc)
April 22, 2022, 8:14am
96
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?
Gufti
(Christoph)
May 8, 2022, 11:58am
97
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?
Gufti
(Christoph)
May 21, 2022, 9:28am
99
It’s openHAB 3.2 Release running on Ubuntu Linux.
ckx
(Christian Krausse)
June 27, 2022, 10:57am
100
Any hint why “… _Remainingprogramtime” is ony showed as NaN? In my Setup the String is for example “3000 s” the other part work fine…
stefan13
(Stefan)
June 27, 2022, 1:02pm
101
Not sure - is the item type 'Number:Type
’ for _Remainingprogramtime
?
Flip
(Flip)
August 3, 2022, 5:56am
102
Just a thought for people who have a washdryer combo: Would it be possible to introduce another state “DRYING” (next to OFF, RUNNING or FINISHED) and then automatically switch Dryer Mode to ON?
DrRSatzteil
(Thomas Lauterbach)
August 3, 2022, 7:18am
103
Good idea. But you should be able to do this without any changes to the widget: just use an expression for the dryer mode configuration and you should be fine
Flip
(Flip)
August 3, 2022, 7:21am
104
Currently I have:
component: widget:washing_machine_v4
config:
title: LG WashDryer
state: =MQTTThinQ_WashDryerState.state
runtime: =openHAB2_ItemThinqRemainingminutes.state
dryer: =openHAB2_ItemThinqDrying.state
openHAB2_ItemThinqDrying is a switch but unfortunately it doesn’t work… Does it need to be a string?
DrRSatzteil
(Thomas Lauterbach)
August 3, 2022, 8:06am
105
Unfortunately it has to be a string yes. This is because I only use this as a static configuration without an item at all. You could remove the string literals in the widget code where checks for the dryer mode are implemented or use an expression that evaluates to a string based on your switch item.
Flip
(Flip)
August 3, 2022, 9:19am
106
I changed everything to String now but it seems it doesn’t read the state correctly… Also a .toString() at the end didn’t help… I will look at the widget source - maybe I can track down the problem…
DrRSatzteil
(Thomas Lauterbach)
August 3, 2022, 9:24am
107
You should use: items.openHAB2_ItemThinqDrying.state
It should work then I guess
Flip
(Flip)
August 3, 2022, 9:33am
108
Arg… I always do the same mistake! Thanks!