Howto display variable as item number?

I want to display value of count_motion
Have tried both, adding varialbe at end of number item and using number item in rules.
However was not successful in getting this work.
Would appriciate any hint/help to get that working
Thanks
Jens

demo.rules
count_motion = count_motion + 1

// ++++does not work ++++v
Motion_count.state = count_motion

demo.item
// ++++ does not work ++++++++++++++++v
Number Motion_count “Motion [%d]” { var=“count_motion as DecimalType” }

1 Like

Since your “count_motion” is a local variable, would you not want to do something like:

postUpdate(Motion_Count,count_motion) in your demo.rules file?

As you want to display the variable, why not use the item itself as variable? The only downside is the more complex way to update the item compared to the variable:
Motion_Count.postUpdate(Motion_Count.state as DecimalType + 1)
refer to it with Motion_Count.state as DcimalType wherever you need the counter in the rule.

Many thanks for fast reply.
Works perfectly for me