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