Have you tried checking the value later/in a subsequent run of your code?
I would think it likely that the variable is updated non-atomic/synchronously and only updates when the code exits its current run. Or it may have a cached value that is not updated until next run.
So checking it immediately after setting it may not yield the result you expect. Just a guess though - someone will correct me if I'm wrong.
Let me expound on what I was trying to do and see if there's another way. I have several apps that are looking at similar conditions all related to rooms. e.g. is the room occupied, what is the room temp? are the room lights on?
Ideally, it would be great if the native rooms were extensible so that I could add attributes to them (e.g. isOccupied, roomTemp, etc...) but short of that, I couldn't find a way to centrally share that information.
My plan was to dynamically create a set of global variables with a naming conversion room.#.param = val but I don't want to manually create each variable.
My other option is to create a virtual device but then I'd need to give every app permission to access that device.