Make the state device store the number of online devices instead of text

Makes it easier to write rules comparing integer numbers than states