Defining Blocks and Datapoints
Blocks implement IzoT Resource files, and each resource file Block contains datapoints and properties. A Python application only needs to create an instance of each desired IzoT block, and all of the mandatory datapoints and properties are automatically created. In the sample lines below, the first set gains access to the IzoT resource files, the second set instantiates those blocks. To expose the various datapoints and properties to a Web browser, see Creating an IzoT Device Class File.
def main(): # Create instances of each desired resource block # the app object is obtained from the framework, see Creating an IzoT Application Object # ... global keypad global lux keypad = app.block(profile = iotKeypad()) lux = app.block(profile = iotAnalogOutput())
You can create a tuple that creates multiple blocks based on the same profile. The following example shows how to create a lux block tuple:
MAX_LUX = 2 lux = tuple( app.block( profile = iotAnalogOutput(), ext_name = 'lux{0}'ext_name = 'lux{0}'.format(i)) for i in range (MAX_LUX))