def add_virtual_module(): """ Adds a virtual module """ return MasterCommandSpec( "AV", [Field.str('vmt', 1), Field.padding(12)], [Field.str("resp", 2), Field.padding(11), Field.lit('\r\n')])
def modules_goto_application(): """ Let the module go to application. """ return MasterCommandSpec("FG", [Field.str('addr', 4), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1'), Field.padding(6)], [Field.str('addr', 4), Field.byte("error_code"), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1'), Field.padding(5), Field.lit("\r\n")])
def get_module_version(): """ Get the version of the module. """ return MasterCommandSpec("FV", [Field.str('addr', 4), Field.crc(), Field.padding(6)], [Field.str('addr', 4), Field.byte("error_code"), Field.byte("hw_version"), Field.byte("f1"), Field.byte("f2"), Field.byte("f3"), Field.byte("status"), Field.crc(), Field.lit("\r\n")])
def modules_goto_bootloader(): """ Reset the module to go to the bootloader. """ return MasterCommandSpec("FR", [Field.str('addr', 4), Field.byte('sec'), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1'), Field.padding(5)], [Field.str('addr', 4), Field.byte("error_code"), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1'), Field.padding(5), Field.lit("\r\n")])
def modules_new_firmware_version(): """ Preprare the slave module for a new version. """ return MasterCommandSpec("FN", [Field.str('addr', 4), Field.byte("f1n"), Field.byte("f2n"), Field.byte("f3n"), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1'), Field.padding(3)], [Field.str('addr', 4), Field.byte("error_code"), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1'), Field.padding(5), Field.lit("\r\n")])
def modules_update_firmware_block(): """ Upload 1 block of 64 bytes to the module. """ return MasterCommandSpec("FD", [Field.str('addr', 4), Field.int("block"), Field.str("bytes", 64), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1')], [Field.str('addr', 4), Field.byte("error_code"), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1'), Field.lit("\r\n")])
def modules_integrity_check(): """ Check the integrity of the new code. """ return MasterCommandSpec("FE", [Field.str('addr', 4), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1'), Field.padding(6)], [Field.str('addr', 4), Field.byte("error_code"), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1'), Field.padding(5), Field.lit("\r\n")])
def modules_new_crc(): """ Write the new crc code to the bootloaded module. """ return MasterCommandSpec("FC", [Field.str('addr', 4), Field.byte("ccrc0"), Field.byte("ccrc1"), Field.byte("ccrc2"), Field.byte("ccrc3"), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1'), Field.padding(2)], [Field.str('addr', 4), Field.byte("error_code"), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1'), Field.padding(5), Field.lit("\r\n")])
def modules_get_version(): """ Get the version of the module. """ return MasterCommandSpec("FV", [Field.str('addr', 4), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1'), Field.padding(6)], [Field.str('addr', 4), Field.byte("error_code"), Field.byte("hw_version"), Field.byte("f1"), Field.byte("f2"), Field.byte("f3"), Field.byte("status"), Field.lit('C'), Field.byte('crc0'), Field.byte('crc1'), Field.lit("\r\n")])
def read_output(): """ Read the information about an output """ return MasterCommandSpec("ro", [Field.byte("id"), Field.padding(12)], [Field.byte('id'), Field.str('type', 1), Field.byte('light'), Field.int('timer'), Field.int('ctimer'), Field.byte('status'), Field.dimmer('dimmer'), Field.byte('controller_out'), Field.byte('max_power'), Field.byte('floor_level'), Field.bytes('menu_position', 3), Field.str('name', 16), Field.crc(), Field.lit('\r\n')])
def module_initialize(): """ The message sent by the master whenever a module is initialized in module discovery mode. """ return MasterCommandSpec("MI", [], [ Field.str('id', 4), Field.str('instr', 1), Field.byte('module_nr'), Field.byte('data'), Field.byte('io_type'), Field.padding(5), Field.lit('\r\n') ])
def module_discover_start(): """ Put the master in module discovery mode. """ return MasterCommandSpec( "DA", [Field.padding(13)], [Field.str("resp", 2), Field.padding(11), Field.lit("\r\n")])
def read_setpoint(): """ Read the programmed setpoint of a thermostat """ return MasterCommandSpec("rs", [Field.byte('thermostat'), Field.padding(12)], [Field.byte('thermostat'), Field.svt('act'), Field.svt('csetp'), Field.svt('psetp0'), Field.svt('psetp1'), Field.svt('psetp2'), Field.svt('psetp3'), Field.svt('psetp4'), Field.svt('psetp5'), Field.byte('sensor_nr'), Field.byte('output0_nr'), Field.byte('output1_nr'), Field.byte('output0'), Field.byte('output1'), Field.svt('outside'), Field.byte('mode'), Field.str('name', 16), Field.byte('pid_p'), Field.byte('pid_i'), Field.byte('pid_d'), Field.byte('pid_ithresh'), Field.svt('threshold_temp'), Field.byte('days'), Field.byte('hours'), Field.byte('minutes'), Field.svt('mon_start_d1'), Field.svt('mon_stop_d1'), Field.svt('mon_start_d2'), Field.svt('mon_stop_d2'), Field.svt('tue_start_d1'), Field.svt('tue_stop_d1'), Field.svt('tue_start_d2'), Field.svt('tue_stop_d2'), Field.svt('wed_start_d1'), Field.svt('wed_stop_d1'), Field.svt('wed_start_d2'), Field.svt('wed_stop_d2'), Field.svt('thu_start_d1'), Field.svt('thu_stop_d1'), Field.svt('thu_start_d2'), Field.svt('thu_stop_d2'), Field.svt('fri_start_d1'), Field.svt('fri_stop_d1'), Field.svt('fri_start_d2'), Field.svt('fri_stop_d2'), Field.svt('sat_start_d1'), Field.svt('sat_stop_d1'), Field.svt('sat_start_d2'), Field.svt('sat_stop_d2'), Field.svt('sun_start_d1'), Field.svt('sun_stop_d1'), Field.svt('sun_start_d2'), Field.svt('sun_stop_d2'), Field.lit('T'), Field.svt('mon_temp_d1'), Field.svt('tue_temp_d1'), Field.svt('wed_temp_d1'), Field.svt('thu_temp_d1'), Field.svt('fri_temp_d1'), Field.svt('sat_temp_d1'), Field.svt('sun_temp_d1'), Field.svt('mon_temp_d2'), Field.svt('tue_temp_d2'), Field.svt('wed_temp_d2'), Field.svt('thu_temp_d2'), Field.svt('fri_temp_d2'), Field.svt('sat_temp_d2'), Field.svt('sun_temp_d2'), Field.svt('mon_temp_n'), Field.svt('tue_temp_n'), Field.svt('wed_temp_n'), Field.svt('thu_temp_n'), Field.svt('fri_temp_n'), Field.svt('sat_temp_n'), Field.svt('sun_temp_n'), Field.crc(), Field.lit('\r\n')])
def clear_error_list(): """ Clear the number of errors. """ return MasterCommandSpec( "ec", [Field.padding(13)], [Field.str("resp", 2), Field.padding(11), Field.lit("\r\n")])
def eeprom_list(): """ List all bytes from a certain eeprom bank """ return MasterCommandSpec( "EL", [Field.byte("bank"), Field.padding(12)], [Field.byte("bank"), Field.str("data", 256), Field.lit("\r\n")])
def reset(): """ Reset the gateway, used for firmware updates. """ return MasterCommandSpec( "re", [Field.padding(13)], [Field.str("resp", 2), Field.padding(11), Field.lit("\r\n")])
def module_discover_stop(): """ Put the master into the normal working state. """ return MasterCommandSpec( "DO", [Field.padding(13)], [Field.str("resp", 2), Field.padding(11), Field.lit("\r\n")])
def basic_action(): """ Basic actions. """ return MasterCommandSpec("BA", [ Field.byte("action_type"), Field.byte("action_number"), Field.padding(11) ], [Field.str("resp", 2), Field.padding(11), Field.lit("\r\n")])
def indicate(): """ Flash the led for a given output/input/sensor. """ return MasterCommandSpec( "IN", [Field.byte('type'), Field.byte('id'), Field.padding(11)], [Field.str("resp", 2), Field.padding(11), Field.lit("\r\n")])
def activate_eeprom(): """ Activate eeprom after write """ return MasterCommandSpec( "AE", [Field.byte("eep"), Field.padding(12)], [ Field.byte("eep"), Field.str("resp", 2), Field.padding(10), Field.lit('\r\n') ])
def read_input(): """ Read the information about an input """ return MasterCommandSpec( "ri", [Field.byte("input_nr"), Field.padding(12)], [ Field.byte('input_nr'), Field.byte('output_action'), Field.bytes('output_list', 30), Field.str('input_name', 8), Field.crc(), Field.lit('\r\n') ])
def clear_error_list(): """ Clear the number of errors. """ return MasterCommandSpec("ec", [Field.padding(13)], [Field.str("resp", 2), Field.padding(11), Field.lit("\r\n")])
def basic_action(): """ Basic actions. """ return MasterCommandSpec("BA", [Field.byte("action_type"), Field.byte("action_number"), Field.padding(11)], [Field.str("resp", 2), Field.padding(11), Field.lit("\r\n")])
def reset(): """ Reset the gateway, used for firmware updates. """ return MasterCommandSpec("re", [Field.padding(13)], [Field.str("resp", 2), Field.padding(11), Field.lit("\r\n")])
def module_initialize(): """ The message sent by the master whenever a module is initialized in module discovery mode. """ return MasterCommandSpec("MI", [], [Field.str('id', 4), Field.str('instr', 1), Field.byte('module_nr'), Field.byte('data'), Field.byte('io_type'), Field.padding(5), Field.lit('\r\n')])
def indicate(): """ Flash the led for a given output/input/sensor. """ return MasterCommandSpec("IN", [Field.byte('type'), Field.byte('id'), Field.padding(11)], [Field.str("resp", 2), Field.padding(11), Field.lit("\r\n")])
def module_discover_stop(): """ Put the master into the normal working state. """ return MasterCommandSpec("DO", [Field.padding(13)], [Field.str("resp", 2), Field.padding(11), Field.lit("\r\n")])
def module_discover_start(): """ Put the master in module discovery mode. """ return MasterCommandSpec("DA", [Field.padding(13)], [Field.str("resp", 2), Field.padding(11), Field.lit("\r\n")])
def eeprom_list(): """ List all bytes from a certain eeprom bank """ return MasterCommandSpec("EL", [Field.byte("bank"), Field.padding(12)], [Field.byte("bank"), Field.str("data", 256), Field.lit("\r\n")])
def activate_eeprom(): """ Activate eeprom after write """ return MasterCommandSpec("AE", [Field.byte("eep"), Field.padding(12)], [Field.byte("eep"), Field.str("resp", 2), Field.padding(10), Field.lit('\r\n')])
def read_input(): """ Read the information about an input """ return MasterCommandSpec("ri", [Field.byte("input_nr"), Field.padding(12)], [Field.byte('input_nr'), Field.byte('output_action'), Field.bytes('output_list', 30), Field.str('input_name', 8), Field.crc(), Field.lit('\r\n')])