Hello there,
I am trying to get the washing machine widget running.
The Widget can be downloaded at the “User Interface” section, it comes with a script and the creator page.
unfortunately the page is not very well observed anymore, I hope someone here can give me a hint with my error.
https://community.openhab.org/t/washing-machine-status-widget/116621
Error:
2022-08-04 01:07:30.981 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'Laufzeit_Spuelmaschine' failed: Could not cast 0 to org.openhab.core.library.types.QuantityType; line 8, column 6, length 37
Code:
configuration: {}
triggers:
- id: "1"
configuration:
itemName: S4_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('Laufzeit_Spuelmaschine.rules', logPrefix + 'StateMachine Zustand alt: ' + Washingmachine_OpState.state.toString + '; Leistung momentan: '+ S4_Power.state.toString)
if (EnableLog_WaschmaschineRules.state == ON) logInfo('Laufzeit_Spuelmaschine.rules', logPrefix + 'Leistung momentan (doubleValue): '+ (S4_Power.state as QuantityType<Power>).doubleValue.toString)
if ((S4_Power.state as QuantityType<Power>).doubleValue < 0.5) {
Washingmachine_OpState.postUpdate(MODE_OFF)
}
else if ((S4_Power.state as QuantityType<Power>).doubleValue > 15) {
if (Washingmachine_OpState.state != MODE_ACTIVE) {
Washingmachine_OpState.postUpdate(MODE_ACTIVE)
dishwasher_machine_runtime.postUpdate(1)
}
}
else if ((S4_Power.state as QuantityType<Power>).doubleValue < 6.5) {
if (Washingmachine_OpState.state == MODE_OFF) Washingmachine_OpState.postUpdate(MODE_STANDBY)
else if (Washingmachine_OpState.state == MODE_ACTIVE) Washingmachine_OpState.postUpdate(MODE_FINISHED)
}
if (EinbleLog_WaschmaschineRules.state == ON) logInfo('Laufzeit_Spuelmaschine.rules', logPrefix ,+ 'StateMachine Zustand neu: ' + Washingmachine_OpState.state.toString)
type: script.ScriptAction
I found a topic where someone ran into this problem, I can’t transfer his solution to my problem.
Also, I tried different types.
I think the Input is the problem, my input is an energy measurement plug, and the item is declared as “Number”.
Can anyone here give me a hint on that?
I would be thankful to understand my problem.