def device_information_list_inputs(): """ Device information list for inputs """ return CoreCommandSpec(instruction='DL', request_fields=[LiteralBytesField(1)], response_fields=[ ByteField('type'), ByteArrayField('information', lambda length: length - 1) ])
def event_information(): """ Event information """ return CoreCommandSpec(instruction='EV', response_fields=[ ByteField('type'), ByteField('action'), WordField('device_nr'), ByteArrayField('data', 4) ])
def error_information(): """ Error information """ return CoreCommandSpec(instruction='ER', response_fields=[ ByteField('type'), ByteField('parameter_a'), WordField('parameter_b'), WordField('parameter_c') ])
def ucan_rx_transport_message(): """ uCAN transport layer packages """ return CoreCommandSpec(instruction='FM', response_fields=[ AddressField('cc_address'), ByteField('nr_can_bytes'), ByteField('sid'), ByteArrayField('payload', 8) ])
def _sensor_values(instruction, field): """ Receive sensor byte values """ return CoreCommandSpec( instruction='SI', request_fields=[ ByteField('module_nr'), LiteralBytesField(instruction) ], response_fields=[ByteField('module_nr'), PaddingField(1), field])
def general_configuration_number_of_modules(): """ Receives general configuration regarding number of modules """ return CoreCommandSpec(instruction='GC', request_fields=[LiteralBytesField(0)], response_fields=[ ByteField('type'), ByteField('output'), ByteField('input'), ByteField('sensor'), ByteField('ucan'), ByteField('ucan_input'), ByteField('ucan_sensor') ])
def get_ucan_address(): """ Receives the uCAN address of a specific uCAN """ return CoreCommandSpec(instruction='FS', request_fields=[ AddressField('cc_address'), LiteralBytesField(1), ByteField('ucan_nr') ], response_fields=[ AddressField('cc_address'), PaddingField(2), AddressField('ucan_address', 3) ])
def ucan_module_information(): """ Receives information from a uCAN module """ return CoreCommandSpec(instruction='CD', response_fields=[ AddressField('ucan_address', 3), WordArrayField('input_links', 6), ByteArrayField('sensor_links', 2), ByteField('sensor_type'), VersionField('version'), ByteField('bootloader'), CharField('new_indicator'), ByteField('min_led_brightness'), ByteField('max_led_brightness') ])
def get_amount_of_ucans(): """ Receives amount of uCAN modules """ return CoreCommandSpec(instruction='FS', request_fields=[ AddressField('cc_address'), LiteralBytesField(0), LiteralBytesField(0) ], response_fields=[ AddressField('cc_address'), PaddingField(2), ByteField('amount'), PaddingField(2) ])
def basic_action(): """ Basic action spec """ return CoreCommandSpec(instruction='BA', request_fields=[ ByteField('type'), ByteField('action'), WordField('device_nr'), WordField('extra_parameter') ], response_fields=[ ByteField('type'), ByteField('action'), WordField('device_nr'), WordField('extra_parameter') ])
def module_information(): """ Receives module information """ return CoreCommandSpec(instruction='MC', request_fields=[ ByteField('module_nr'), ByteField('module_family') ], response_fields=[ ByteField('module_nr'), ByteField('module_family'), ByteField('module_type'), AddressField('address'), WordField('bus_errors'), ByteField('module_status') ])
def general_configuration_max_specs(): """ Receives general configuration regarding maximum specifications (e.g. max number of input modules, max number of basic actions, ...) """ return CoreCommandSpec(instruction='GC', request_fields=[LiteralBytesField(1)], response_fields=[ ByteField('type'), ByteField('output'), ByteField('input'), ByteField('sensor'), ByteField('ucan'), WordField('groups'), WordField('basic_actions'), ByteField('shutters'), ByteField('shutter_groups') ])
def memory_write(length): """ Writes memory """ return CoreCommandSpec(instruction='MW', request_fields=[ CharField('type'), WordField('page'), ByteField('start'), ByteArrayField('data', length) ], response_fields=[ CharField('type'), WordField('page'), ByteField('start'), ByteField('length'), CharField('result') ])
def memory_read(): """ Reads memory """ return CoreCommandSpec(instruction='MR', request_fields=[ CharField('type'), WordField('page'), ByteField('start'), ByteField('length') ], response_fields=[ CharField('type'), WordField('page'), ByteField('start'), ByteArrayField('data', lambda length: length - 4) ])
def output_detail(): """ Received output detail information """ return CoreCommandSpec(instruction='OD', request_fields=[WordField('device_nr')], response_fields=[ WordField('device_nr'), ByteField('status'), ByteField('dimmer'), ByteField('dimmer_min'), ByteField('dimmer_max'), ByteField('timer_type'), ByteField('timer_type_standard'), WordField('timer'), WordField('timer_standard'), WordField('group_action'), ByteField('dali_output') ])