I have some devices that have several time variables.(.time1, .time2, time3 I have a time editor template common to multiple devices and am struggling to link the bits of functionality
When I jump to the template I need it to act on @device - and one of the multiple time variables.
This means the template must know which device (it does @device - perfect) but also which time variable to display and send adjust commands (by mqtt).
Plan A. Have three copies of the template identical except hardcoded to work on @device.time1 @device.time2 etc
Messy but at least easier to understand. Prone to error if I change anything
Plan B. Use virtual variables to tell the edit template which time variable (time1,time2,time 3) to operate on. I have two problems here.
-
For every display and field in the template it needs to choose between time1,time2.time3 based on the virtualvariable. Not sure how to do this cleanly - or even at all
-
In the plugin script I need to read a virtual variable to construct the mqtt publish message so the far end knows which of the three times to change. I couldn’t get at the virtual devices in the plugin so not sure if this is possible?
Plan C - something totally different… any suggestions?