def get_firmware_version(): # type: () -> CoreCommandSpec """ Receives the Core firmware version """ return CoreCommandSpec( instruction='ST', request_fields=[LiteralBytesField(1)], response_fields=[ByteField('info_type'), VersionField('version')])
def request_slave_firmware_versions(): # type: () -> CoreCommandSpec """ Requests the slave firmware versions, which will be send to the GW in separate FW calls """ return CoreCommandSpec( instruction='ST', request_fields=[LiteralBytesField(2)], response_fields=[ByteField('info_type'), PaddingField(2)])
def get_slave_bus_mode(): # type: () -> CoreCommandSpec """ Receives the slave bus mode """ return CoreCommandSpec( instruction='ST', request_fields=[LiteralBytesField(0)], response_fields=[ByteField('info_type'), ByteField('mode')])
def slave_rx_transport_message(): # type: () -> CoreCommandSpec """ Slave transport layer packages """ return CoreCommandSpec(instruction='TM', response_fields=[ RawByteArrayField('payload', lambda length: length) ])
def device_information_list_inputs(): # type: () -> CoreCommandSpec """ Device information list for inputs """ return CoreCommandSpec(instruction='DL', request_fields=[LiteralBytesField(1)], response_fields=[ ByteField('type'), ByteArrayField('information', lambda length: length - 1) ])
def get_master_modes(): # type: () -> CoreCommandSpec """ Receives various master modes (rs485 bus mode, BA debug mode) """ return CoreCommandSpec(instruction='ST', request_fields=[LiteralBytesField(0)], response_fields=[ ByteField('info_type'), ByteField('rs485_mode'), ByteField('ba_debug_mode') ])
def error_information(): # type: () -> CoreCommandSpec """ Error information """ return CoreCommandSpec(instruction='ER', response_fields=[ ByteField('type'), ByteField('parameter_a'), WordField('parameter_b'), WordField('parameter_c') ])
def event_information(): # type: () -> CoreCommandSpec """ Event information """ return CoreCommandSpec(instruction='EV', response_fields=[ ByteField('type'), ByteField('action'), WordField('device_nr'), RawByteArrayField('data', 4) ])
def ucan_rx_transport_message(): # type: () -> CoreCommandSpec """ uCAN transport layer packages """ return CoreCommandSpec(instruction='FM', response_fields=[ AddressField('cc_address'), ByteField('nr_can_bytes'), ByteField('sid'), RawByteArrayField('payload', 8) ])
def _sensor_values(instruction, field): # type: (int, Field) -> CoreCommandSpec """ Receive sensor byte values """ return CoreCommandSpec( instruction='SI', request_fields=[ ByteField('module_nr'), LiteralBytesField(instruction) ], response_fields=[ByteField('module_nr'), PaddingField(1), field])
def get_ucan_address(): # type: () -> CoreCommandSpec """ 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 get_amount_of_ucans(): # type: () -> CoreCommandSpec """ 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 ucan_module_information(): # type: () -> CoreCommandSpec """ 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_date_time(): # type: () -> CoreCommandSpec """ Reads the date/time from the Core """ return CoreCommandSpec(instruction='TR', request_fields=[LiteralBytesField(0)], response_fields=[ ByteField('info_type'), ByteField('hours'), ByteField('minutes'), ByteField('seconds'), ByteField('weekday'), ByteField('day'), ByteField('month'), ByteField('year') ])
def basic_action(): # type: () -> CoreCommandSpec """ 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 general_configuration_max_specs(): # type: () -> CoreCommandSpec """ 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 module_information(): # type: () -> CoreCommandSpec """ 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 execute_basic_action_series(length): # type: (int) -> CoreCommandSpec """ Executes a Basic action on multiple devices """ if not 2 <= length <= 40: raise ValueError('Amount of device numbers should be 2 <= n <= 40') return CoreCommandSpec(instruction='ES', request_fields=[ ByteField('type'), ByteField('action'), WordField('extra_parameter'), WordArrayField('device_nrs', length) ], response_fields=[ ByteField('type'), ByteField('action'), WordField('extra_parameter') ])
def memory_write(length): # type: (int) -> CoreCommandSpec """ Writes memory """ return CoreCommandSpec(instruction='MW', request_fields=[ CharField('type'), WordField('page'), ByteField('start'), RawByteArrayField('data', length) ], response_fields=[ CharField('type'), WordField('page'), ByteField('start'), ByteField('length'), CharField('result') ])
def general_configuration_number_of_modules( ): # type: () -> CoreCommandSpec """ 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'), ByteField('power_rs485'), ByteField('power_can') ])
def memory_read(): # type: () -> CoreCommandSpec """ Reads memory """ return CoreCommandSpec(instruction='MR', request_fields=[ CharField('type'), WordField('page'), ByteField('start'), ByteField('length') ], response_fields=[ CharField('type'), WordField('page'), ByteField('start'), RawByteArrayField('data', lambda length: length - 4) ])
def output_detail(): # type: () -> CoreCommandSpec """ 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'), ByteField('output_lock') ])
def slave_tx_transport_message(length): # type: (int) -> CoreCommandSpec """ Slave transport layer packages """ return CoreCommandSpec( instruction='TC', request_fields=[RawByteArrayField('payload', length)], response_fields=[ByteField('length')])
def firmware_information(): # type: () -> CoreCommandSpec """ Firmware information """ return CoreCommandSpec( instruction='FW', response_fields=[AddressField('address'), VersionField('version')])
def set_slave_bus_mode(): # type: () -> CoreCommandSpec """ Sets the slave bus to a different mode""" return CoreCommandSpec(instruction='SM', request_fields=[ByteField('mode')], response_fields=[ByteField('mode')])