It will get easier with the Member of Group Trigger
But as @job said when changing transforming the value in the rule don’t set it to the same Item.
This will probably lead to conflicts, but in your case this could be an exception.
The Item is only one way. Get info from node.
The rule is set to received command
The Item state is change by postUpdate which does not trigger the rule again.
The incomming and transformed value is a number
As there is no other interaction with this Item, this could work out without issues.