i have a rule for copy a Value in the item “power” when the item “Test” changed but it don´t work correctly
rules "Copy"
when Item Test changed
then
power.sendCommand(Test)
end
Can everybody help me what i can do.
i have a rule for copy a Value in the item “power” when the item “Test” changed but it don´t work correctly
rules "Copy"
when Item Test changed
then
power.sendCommand(Test)
end
Can everybody help me what i can do.
Just use the state of the Item. Be aware of the typo. It’s rule
, not rule
s
.
rule "Copy"
when
Item Test changed
then
power.sendCommand(Test.state)
end
Of course, the items Test
and power
must be of the same type.
thanks a lot and happy Easter
I have the same Problem with a rule. I tested two versions:
rule “Comunication”
when
Item Byte_04 changed from OFF to ON
then
Int_02.sendCommand(Int_04.state as DecimalType)
Int_03.sendCommand(Int_05.state)
end
Errors in Visual Studio:
SendCommand:
Ambiguous Feature Call. The Extension methods sendCommand(Item, Command) in BusEvent and sendCommand (Item, Number) in BusEvent both match.
Error Int_05.state:
Type missmatch: cannot convert from State to String.
Can someone help me?
Try Int_05.state.toString
instead.
In question of DecimalType, if you don’t need to use a number as number (i.e. calculate a result), simply use the string. Otherwise, try (Int_04.state as DecimalType).intValue
or (Int_04.state as Number).intValue
.
These two versions work without Errors:
rule “Comunication”
when
Item Byte_04 changed from OFF to ON
then
Int_02.sendCommand(Int_04.state.toString)
Int_03.sendCommand(Int_05.state as Number)
end
many thanks for your help!