Script for a Service that changes the property values of the Things inside an InfoTable
I have a selection of Sensors for a User to choose. The User can create a grouping of whatever order of sensors, called a 'Scene'. These Scenes share the same SceneTemplate and the property that stores the Sensors they chose is an InfoTable, called "DeviceList".
Goal: What I wanted to do was let a User choose one of their created Scenes, and use a Button to call a service that allows that Scene's Sensors "OnOff" property to be set to On, subsequently having non-included sensors turned Off.
I'm stuck on figuring out the best way to implement that. I assume I would have to create my own service.
The service I will need to make must access all implemented things of my SensorTemplate and also access the DeviceList of the User-selected Scene, and then access the properties of the Sensors, comparing which Sensors of SensorTemplate are and aren't inside DeviceList so their property can be correctly set On or Off.
I'm guessing it should be a service for my SensorTemplate and it wouldn't necessarily need a return value, but other than that I haven't found a useful tutorial for writing my own script for a service. For example, I know how to find the function "GetImplementedThings" for my SensorTemplate inside the script, but am unsure how I could use it's return value(InfoTable) to do further work in the script and eventually change property values.
Any kind of webpages, tutorials, or advice would be appreciated. Thank You
Your explanation is somewhat complicated for me to understand exactly what you are doing, but sounds like you have a good idea and are on the right track.