HSL 2.0 framework Description of the framework

Public Member Functions |Private Member Functions |List of all members
hsl20_4.hsl20_4.BaseModule Class Reference

Base class for a HSL 2.0 block More..

## Public Member Functions
def | __init__ (self, homeserver_context, module_context)
| Construct, must be called in the constructor of the inherited class. More...
def | on_input_value (self, index, value)
| Called each time a value arrives at an input of the block. More...
def | on_init (self)
| Is called once when the block is initialised. More...

## Private Member Functions
def | _get_module_id (self)
| Returns the runtime ID of the module. More...
def | _get_module_class_id (self)
| Returns the five-digit block ID (for example '10001'). More...
def | _get_framework (self)
| Returns an object of type hsl20_4.framework. More...
def | _get_logger (self, logType, param)
| Returns an object of the type hsl20_4.Logger More...
def | _get_input_value (self, index)
| Returns the value that was at the time of the call at input index is present, back. More...
def | _set_output_value (self, index, value)
| Sets a value to an output. More...
def | _can_set_output (self)
| Indicates whether a value can be set to an output. More...
def | _get_remanent (self, index)
| Returns the value of the remanent variable. More...
def | _set_remanent (self, index, value)
| Describes a remanent variable. More...

## Detailed Description

Basic class for an HSL 2.0 device

An HSL 2.0 device must have this class as its base by inheritance. The generator generates the necessary code segments: An example of the implementation of the block lock is enclosed: 10701_MyBaseModule_03.py

## Constructor & Destructor Documentation

## ◆ __init__()

def hsl20_4.hsl20_4.BaseModule.__init__ | ( |  | self,
|  |  | homeserver_context,
|  |  | module_context
| ) |  |

Construct, must be called in the constructor of the inherited class

Parameters

  homeserver_context | object Reference to the HomeServer object structure
  module_context | string Key of the module context. The key determines the context in which the module runs

## Member Function Documentation

## ◆ _can_set_output()

def hsl20_4.hsl20_4.BaseModule._can_set_output | ( |  | self | ) |
| private

Indicates whether a value can be set to an output

Returns False if no further value can be written at first.

Returns
  bool An output can be set

## ◆ _get_framework()

def hsl20_4.hsl20_4.BaseModule._get_framework | ( |  | self | ) |
| private

Returns an object of the type hsl20_4.Framework

Returns
  hsl20_4.hsl20_4.Framework
  One instance on the HSL 2.0 framework

## ◆ _get_input_value()

def hsl20_4.hsl20_4.BaseModule._get_input_value | ( |  | self,
|  |  | index
| ) |  |
| private

Returns the value that was set at input
index is present, back

The value applied to the input can change during the execution of the block logic

Parameters

  index | int Index of the input

Returns
  float/str
  Value of the input. The type of the return value depends on the definition of the input

## ◆ _get_logger()

def hsl20_4.hsl20_4.BaseModule._get_logger | ( |  | self,
|  |  | logType,
|  |  | param
| ) |  |
| private

Returns an object of the type hsl20_4.Logger

Note
  This method is called by the code generated by the generator. Calling this method again returns (independent of the parameters) the already created logger object

Parameters

  logType | int Logging handler (e.g. hsl20_4.LOGGING_SYSLOG)
  param | tuple Parameters for the logging handler used

Returns
  hsl20_4.hsl20_4.Logger
  Logger object

## ◆ _get_module_class_id()

def hsl20_4.hsl20_4.BaseModule._get_module_class_id | ( |  | self | ) |
| private

Returns the five-digit block ID (for example '10001')

Returns
  string
  Building block ID

From version 2.0.3:
  Method set_reference(self, hsl_module) removed

## ◆ _get_module_id()

def hsl20_4.hsl20_4.BaseModule._get_module_id | ( |  | self | ) |
| private

Returns the runtime ID of the module

The ID is only valid during the runtime of the device.

Returns
  int
  ID of the module

## ◆ _get_remanent()

def hsl20_4.hsl20_4.BaseModule._get_remanent | ( |  | self,
|  |  | index
| ) |  |
| private

Returns the value of the remanent variable

See also the documentation on the remanent storage.

Parameters

  index | int Index of the remanent variable

Returns
  float/str
  Value of the remanent variable

## ◆ _set_output_value()

def hsl20_4.hsl20_4.BaseModule._set_output_value | ( |  | self,
|  |  | index,
|  |  | value
| ) |  |
| private

Sets a value to an output

Parameters

  index | int Index of the output to be written
  value | float/str Value that is written to the output. The data type depends on whether the output is defined as numeric or alphanumeric

## ◆ _set_remanent()

def hsl20_4.hsl20_4.BaseModule._set_remanent | ( |  | self,
|  |  | index,
|  |  | value
| ) |  |
| private

Describes a remanent variable

Warning
  The remanent memory is persisted in the HomeServer only every 15 minutes.

See also the documentation on the remote memory.

Parameters

  index | int Index of the remanent variable
  value | float/str Value of the remanent variable (maximum size: 30,000 bytes)

## ◆ on_init()

def hsl20_4.hsl20_4.BaseModule.on_init | ( |  | self | ) |

Is called once when the block is initialised

This method can be implemented (overwritten) when a block is created

## ◆ on_input_value()

def hsl20_4.hsl20_4.BaseModule.on_input_value | ( |  | self,
|  |  | index,
|  |  | value
| ) |  |

Called each time a value arrives at an input of the block

The method is called exactly once for each arrival of a value at an input.

This method must be implemented (overwritten) when a block is created

Parameters

  index | int Index of the input
  value | float/str Value that has arrived at the input. The data type depends on whether the input is defined as numeric or alphanumeric

The documentation for this class was generated from the following file:

- hsl20_4.py