Is there a way of getting the total number of HS devices in a script? I am trying to get away from hard coded device references in my scripts and want to loop through the devices to find specific text.
Announcement
Collapse
No announcement yet.
HS4 Get total number of devices in script
Collapse
X
-
To get all devices, you can call GetAllDevices(bool withFeatures) but this is a very expensive method to call.
To get a list of all the Device Refs, you can call GetAllDeviceRefs() or GetAllRefs() which will return a list of all Device Refs.HS4Pro on a Raspberry Pi4
54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI
HSTouch Clients: 1 Android
-
The HS4 scripting functionality is provided by the PluginSDK library as the class IhsController. The hs4 object is instanitated from this class in both the HS4 scripting environment and in tenScripting. In both you would use: hs4.GetAllDevices(True).
In HS4, the hs3 scripting functionality from class IHSapplication and the hs4 scripting additions from IhsController are both available using the hs object. So, you could use either hs.GetAllDevices() or hs4.GetAllDevices() in HS scripting. However, only hs4.GetAllDevices() will work in tenScripting. Best practice is to always use hs for HS3 methods and hs4 for HS4 additions (there are some methods that exist in both classes, and hence require the use of the proper object).
This page may clarify some: http://tenholder.net/tenWare2/tenScr...S4Changes.aspx
tenholde
Comment
Comment