So I want to check which door is open after going into away mode.
But %device% doesn't contain the device name but the hub name.
It appears to be set in the Triger event. The trigger event test for AWAY
How can I get the device name in a conditional statement. I know I could test each door separately which I guess I will have to do.. But is there a way on a conditional statement testing lots of devices to get the device name of the one that's open?
@FriedCheese2006 has a device grouping app that lets you group like devices together and then get a list of which of them are open, for contact sensors, for example.
As mentioned above, the device variable refers to the trigger event. A conditional will never affect the value of this variable. Further, if the trigger is not a device, the value may not be very useful or set at all (in your case, it's a location/hub event, not a device event, and the value is apparently your hub name).
I haven't checked out the app mentioned above, but I also wrote an app to solve this problem for me. It is possible to do in a rule if you want to do it that way, too--it's just a lot of work and manual string concatenation. I have an example of a rule (from Rule 4.x, but it would still work more or less the same now) that this app replaced in the thread where I announced the app in case you want to explore either option: