Java Runtime Environment: i dont find this information
openHAB version: 2.5.1
Issue of the topic: the rule dont work
the rule :
rule “RigRX480 neustart”
when
Time cron “0 0/1 * * * ?” // for testing 1min (15min original)
then
var State = RX480X5Power.state as DecimalType
if ((RX480X5Power.state == ON) && (State < “250”)) {
RX480X5Switch.sendCommand(OFF)
createTimer(now.plusSeconds(6), [
if (RX480X5Switch.state == OFF) RX480X5Switch.sendCommand(ON)
])
}
end
If logs where generated please post these here using code fences:
2020-02-21 12:10:00.008 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule ‘RigRX480 neustart’: Could not cast 216.134111 W to org.eclipse.smarthome.core.library.types.DecimalType; line 5, column 15, length 33
Iam a big noob and i struggled at setting up openhab, than i struggled at setting up samba, win10 is a little *****, than i struggled at getting visual Studio to run.
As you can read i struggled nearly everywhere and i dumped a lot of time in this easy looking project.
i have defined items:
Switch RX480X5Switch “Switch” {channel=“tplinksmarthome:hs110:4DA6F1:switch”}
Number:Power RX480X5Power “Wattage” {channel=“tplinksmarthome:hs110:4DA6F1:power”}
In the Paper UI i can see the switch and the Wattage output, but i dont get the rule to work.
Error during the execution of rule ‘RigRX480 neustart’: Could not cast 213.819957 W to org.eclipse.smarthome.core.library.types.DecimalType; line 5, column 15, length 33
if ((RX480X5Power.state == ON) && (State < "250" | "W"))
Remove the Number:Power part of the item so it does not use the UoM e.g use Number RX480X5Power “Wattage” {channel=“tplinksmarthome:hs110:4DA6F1:power”}
Okay i changed the item to Number RX480X5Power “Wattage” {channel=“tplinksmarthome:hs110:4DA6F1:power”}.
Now the Watt is gone.
So far so good but i have a new error massage.
2020-02-21 16:41:00.015 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule ‘RigRX480 neustart’: An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.lib.NumberExtensions.operator_lessThan(java.lang.Number,java.lang.Number) on instance: null
Why are you texting?
I have a solution that works, i am fine.
You contributed nothing to the solution and feel superior with your knowledge without helping.
Don’t you have something better to do then trolling around in a forum?
Why? Because changing the source data to fit the rule is not a good approach. I would not wish later readers to fall in the same trap. Ways to make the rule fit the original data, with units, have already been given.