Device ID's / Names within rules

It seems that Rules only accepts the device id (i.e. 5270c846-914d-4bd7-917f-11d23c63e45c) for a rule. There seems to be no way to use a device’s name or label which would improve the readability of a rule.

Possible?

1 Like

It depends how you look at it. Unless the API is using a relaxed and flexible dialect of JSON the answer is going to be no at the point of consumption.

However no one says you can’t use a preprocessor on your JSON, or indeed write your Rules in a different language and convert it to JSON. So in that respect the answer is yes.

I wrote my Rules manually in YAML a couple of years or so ago so I make do with YAML anchors and aliases to make them a little easier to read, but I am a tiny bit more organised now so I’d probably be using a text preprocessor of some sort if I had to do it again.

1 Like

I write my Rules in JSON via Postman, and use variables to define devices. Not only easy to read, but easy to swap DeviceIds when needed.