Controlling a FAN using Antumbra and Envision Touch Application.
When Controlling functionality in a Dynalite network, it is likely that devices may be controlled from different sources, for example an Anumbra panel with a Multi Preset Icon and also the Envision Touch Application.
To keep these devices in sync, we can use some tasks with a Start command to listen to specific dynet packets and store them in a RAM address. When using the Multi Preset Button, the presets will then stay in sync.
The first line we define the dynet area we want to monitor, as this is referenced from multiple parts of the code, it is much better to define this globally. This makes the code easily re-usable and easier to understand.
In the startup task we have two intitialisation tasks to complete. The first one stores and OFF (Present 4) into the RAM address we are using to store the current preset of the device, this is just a catchall to ensure the address is initialised to something known, as RAM could be random after a reboot. The second task requests the current preset for the FAN, this will be useful for our monitoring tasks to update correctly to the current actual preset
Task 1 and Task 2 are monitoring Tasks. The Task 1 listens to changes to the device preset, ie when someone changes it from OFF to ON. Task 2 Listens to the replies when something requests the current preset of the device, like we did in the Startup Task. Both of these tasks then store the preset into RAM address 10 for use by our Control Task
Task 3 is to control the Fan from the Multi-Preset Icon on an Antumbra panel. Whilst the icon will synchronise with the preset, pressing the button will not, and will just action what you did last on the each specific panel. Using this task as a Start Task control on this button, it uses the preset stored in the RAM address from the previous monitoring tasks to ensure when you push the button it will cycle to the next preset. In this case it cycles through HIGH-->MED-->LOW-->OFF-->HIGH
This is the configuration used on each Antumbra panel
Example Envision Touch screen. This will not show the same preset as your Antumbra Panels.
This code can be used on as many Antumbra panels as required. If using on mutliple panels, I would recommend randomising the delay in the Startup task to minimise clashes on the network, but keep it high enough that control devices will be online before it is sent.