Look at Design Pattern: DRY, How Not to Repeat Yourself in Rules DSL. This DP will provide a few more techniques to avoid the duplicated code.
In this particular case the Associated Items DP and How to Structure a Rule DP will probably be the most useful to you in this case. You will obviously need to create Items for all your devices, but you likely will only need one Rule.
The Working with Groups in Rules DP is at a bit lower level and is used by these other DPs.