Global variable in other app eg motion lighting

Can a rule machine global variable be used in other apps?

If you create a connector for it, then it becomes a device, and you can use it in any app--just like any device. The bigger question is whether the app you're using is able to use a device of the type you created, and that answer will vary based on that and what you want the variable/device to do.

Was thinking of something like a time variable that I can modify in RM and use in motion lighting

But for what purpose? That's the part that will determine whether you can really do what you want. You could expose a boolean variable as as switch device, which could be usable in Motion Lighting as a restriction, for example. You can't modify a numeric variable, with or without a connector, and use it as a dimmer level, for example--the app only lets you use literal numeric values, not device attributes (or variables). Just two examples.

Time for example ML let's you have per mode durations, just thinking could do a more complex timings, ie if 2 motion sensors are active then add on 2min to the normal time

That's another case where Motion Lighting only lets you work with a literal number you specify when configuring the app--though not a bad idea for a feature request (probably unlikely...) or a custom app (although I suppose you could also just do this entire logic in RM instead, instead of just the calculation of the value).

We are moving slowly in this direction. First step in 2.2.8 moves variables to hub level, not just RM. After that, use of variables in other apps will expand.

2 Likes

Good to know thanks