Shortcut check current light state?

Can I have a shortcut that checks the current state of a light?

If HueBulb is RED AND HueBulb is 100%
{ Do this }
{Do that }


Set old_state to color_and_brightnessof HueBulb
do { things to light }
set HueBulb to old_state

If you access your hub directly through the Hue hub API, I’m 99% sure you could query it directly.

I looked at the API a few years back for some light control scripting I do from my Mac mini. I didn’t use Shortcuts (Workflow at the time) as they ran over scheduled periods and the like - but I do trigger them from Shortcuts. While I didn’t write any queries, they must be in there for third party apps to allow you to set levels independently of other apps.

OK, Hue was just an example. I mean, generally, can I check the current state of a HomeKit device, and it seems that is still a no in iOS 13?

You can. Add an If to a shortcut and you should see HomeKit accessory:

There’s also an action to get the status of a device:

1 Like

I am trying to test if the color of a Hue light is “Red” and running into choices I do not understand. If I say If “Projector One” ( a hue color bulb) Hue is I get a choice of options that do not sound like they have anything to do with color to me, and more to do with 8th grade geometry and “Trig for summer fun”.

My other choices are “Saturation” which lets me set a slider from 0-100% and looks exactly like Brightness. Or I can pick Custom and fill in some text?

(I want to trigger a different automation if the lights are 100% red than if they are 100% white)