def set_virtual_sensor(): """ Set the values (temperature, humidity, brightness) of a virtual sensor. """ return MasterCommandSpec("VS", [Field.byte('sensor'), Field.svt('tmp'), Field.svt('hum'), Field.svt('bri'), Field.padding(9)], [Field.byte('sensor'), Field.svt('tmp'), Field.svt('hum'), Field.svt('bri'), Field.padding(9), 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 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_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_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 setpoint_list(): """ Read the current setpoint of the thermostats in series of 12 """ return MasterCommandSpec("SL", [Field.byte("series"), Field.padding(12)], [Field.byte("series"), Field.svt('tmp0'), Field.svt('tmp1'), Field.svt('tmp2'), Field.svt('tmp3'), Field.svt('tmp4'), Field.svt('tmp5'), Field.svt('tmp6'), Field.svt('tmp7'), Field.svt('tmp8'), Field.svt('tmp9'), Field.svt('tmp10'), Field.svt('tmp11'), Field.lit('\r\n')])
def temperature_list(): """ Read the temperature thermostat sensor list for a series of 12 sensors """ return MasterCommandSpec("TL", [Field.byte("series"), Field.padding(12)], [Field.byte("series"), Field.svt('tmp0'), Field.svt('tmp1'), Field.svt('tmp2'), Field.svt('tmp3'), Field.svt('tmp4'), Field.svt('tmp5'), Field.svt('tmp6'), Field.svt('tmp7'), Field.svt('tmp8'), Field.svt('tmp9'), Field.svt('tmp10'), Field.svt('tmp11'), Field.lit('\r\n')])
def status(): """ Get the status of the master. """ return MasterCommandSpec("ST", [Field.padding(13)], [Field.byte('seconds'), Field.byte('minutes'), Field.byte('hours'), Field.byte('weekday'), Field.byte('day'), Field.byte('month'), Field.byte('year'), Field.lit('\x00'), Field.byte('mode'), Field.byte('f1'), Field.byte('f2'), Field.byte('f3'), Field.byte('h'), 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 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_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 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 setpoint_list(): """ Read the current setpoint of the thermostats in series of 12 """ return MasterCommandSpec( "SL", [Field.byte("series"), Field.padding(12)], [ Field.byte("series"), Field.svt('tmp0'), Field.svt('tmp1'), Field.svt('tmp2'), Field.svt('tmp3'), Field.svt('tmp4'), Field.svt('tmp5'), Field.svt('tmp6'), Field.svt('tmp7'), Field.svt('tmp8'), Field.svt('tmp9'), Field.svt('tmp10'), Field.svt('tmp11'), Field.lit('\r\n') ])
def temperature_list(): """ Read the temperature thermostat sensor list for a series of 12 sensors """ return MasterCommandSpec( "TL", [Field.byte("series"), Field.padding(12)], [ Field.byte("series"), Field.svt('tmp0'), Field.svt('tmp1'), Field.svt('tmp2'), Field.svt('tmp3'), Field.svt('tmp4'), Field.svt('tmp5'), Field.svt('tmp6'), Field.svt('tmp7'), Field.svt('tmp8'), Field.svt('tmp9'), Field.svt('tmp10'), Field.svt('tmp11'), 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 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 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_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 shutter_status(master_version): """ Read the status of a shutter module. """ if master_version >= (3, 143, 78): return MasterCommandSpec("SO", [Field.byte("module_nr"), Field.padding(12)], [Field.byte("module_nr"), Field.padding(3), Field.byte("status"), Field.byte("shutter_lock"), Field.lit('\r\n')]) return MasterCommandSpec("SO", [Field.byte("module_nr"), Field.padding(12)], [Field.byte("module_nr"), Field.padding(3), Field.byte("status"), 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 thermostat_list(): """ Read the thermostat mode, the outside temperature, the temperature of each thermostat, as well as the setpoint. """ return MasterCommandSpec("tl", [Field.padding(13)], [Field.byte('mode'), Field.svt('outside'), Field.svt('tmp0'), Field.svt('tmp1'), Field.svt('tmp2'), Field.svt('tmp3'), Field.svt('tmp4'), Field.svt('tmp5'), Field.svt('tmp6'), Field.svt('tmp7'), Field.svt('tmp8'), Field.svt('tmp9'), Field.svt('tmp10'), Field.svt('tmp11'), Field.svt('tmp12'), Field.svt('tmp13'), Field.svt('tmp14'), Field.svt('tmp15'), Field.svt('tmp16'), Field.svt('tmp17'), Field.svt('tmp18'), Field.svt('tmp19'), Field.svt('tmp20'), Field.svt('tmp21'), Field.svt('tmp22'), Field.svt('tmp23'), Field.svt('tmp24'), Field.svt('tmp25'), Field.svt('tmp26'), Field.svt('tmp27'), Field.svt('tmp28'), Field.svt('tmp29'), Field.svt('tmp30'), Field.svt('tmp31'), Field.svt('setp0'), Field.svt('setp1'), Field.svt('setp2'), Field.svt('setp3'), Field.svt('setp4'), Field.svt('setp5'), Field.svt('setp6'), Field.svt('setp7'), Field.svt('setp8'), Field.svt('setp9'), Field.svt('setp10'), Field.svt('setp11'), Field.svt('setp12'), Field.svt('setp13'), Field.svt('setp14'), Field.svt('setp15'), Field.svt('setp16'), Field.svt('setp17'), Field.svt('setp18'), Field.svt('setp19'), Field.svt('setp20'), Field.svt('setp21'), Field.svt('setp22'), Field.svt('setp23'), Field.svt('setp24'), Field.svt('setp25'), Field.svt('setp26'), Field.svt('setp27'), Field.svt('setp28'), Field.svt('setp29'), Field.svt('setp30'), Field.svt('setp31'), Field.crc(), Field.lit('\r\n')])
def number_of_io_modules(): """ Read the number of input and output modules """ return MasterCommandSpec("rn", [Field.padding(13)], [Field.byte("in"), Field.byte("out"), Field.byte("shutter"), 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 shutter_status(): """ Read the status of a shutter module. """ return MasterCommandSpec("SO", [Field.byte("module_nr"), Field.padding(12)], [Field.byte("module_nr"), Field.padding(3), Field.byte("status"), Field.lit('\r\n')])
def event_triggered(): """ The message sent by the master to trigger an event. This event is triggered by basic action 60. """ return MasterCommandSpec("EV", [], [Field.byte('code'), Field.padding(12), 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 permanent_manual_thermostat_list(): """ Read the permanent manual bytes, 1 per thermostat. """ return MasterCommandSpec("pL", [Field.padding(13)], [Field.byte('tm'), Field.byte('pmt0'), Field.byte('pmt1'), Field.byte('pmt2'), Field.byte('pmt3'), Field.byte('pmt4'), Field.byte('pmt5'), Field.byte('pmt6'), Field.byte('pmt7'), Field.byte('pmt8'), Field.byte('pmt9'), Field.byte('pmt10'), Field.byte('pmt11'), Field.byte('pmt12'), Field.byte('pmt13'), Field.byte('pmt14'), Field.byte('pmt15'), Field.byte('pmt16'), Field.byte('pmt17'), Field.byte('pmt18'), Field.byte('pmt19'), Field.byte('pmt20'), Field.byte('pmt21'), Field.byte('pmt22'), Field.byte('pmt23'), Field.byte('pmt24'), Field.byte('pmt25'), Field.byte('pmt26'), Field.byte('pmt27'), Field.byte('pmt28'), Field.byte('pmt29'), Field.byte('pmt30'), Field.byte('pmt31'), Field.crc(), 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 read_airco_status_bits(): """ Read the airco status bits. """ return MasterCommandSpec("AR", [Field.padding(13)], [Field.byte("ASB0"), Field.byte("ASB1"), Field.byte("ASB2"), Field.byte("ASB3"), Field.byte("ASB4"), Field.byte("ASB5"), Field.byte("ASB6"), Field.byte("ASB7"), Field.byte("ASB8"), Field.byte("ASB9"), Field.byte("ASB10"), Field.byte("ASB11"), Field.byte("ASB12"), Field.byte("ASB13"), Field.byte("ASB14"), Field.byte("ASB15"), Field.byte("ASB16"), Field.byte("ASB17"), Field.byte("ASB18"), Field.byte("ASB19"), Field.byte("ASB20"), Field.byte("ASB21"), Field.byte("ASB22"), Field.byte("ASB23"), Field.byte("ASB24"), Field.byte("ASB25"), Field.byte("ASB26"), Field.byte("ASB27"), Field.byte("ASB28"), Field.byte("ASB29"), Field.byte("ASB30"), Field.byte("ASB31"), Field.lit("\r\n")])
def write_airco_status_bit(): """ Write the airco status bit. """ return MasterCommandSpec("AW", [Field.byte("thermostat"), Field.byte("ASB"), Field.padding(11)], [Field.byte("ASB0"), Field.byte("ASB1"), Field.byte("ASB2"), Field.byte("ASB3"), Field.byte("ASB4"), Field.byte("ASB5"), Field.byte("ASB6"), Field.byte("ASB7"), Field.byte("ASB8"), Field.byte("ASB9"), Field.byte("ASB10"), Field.byte("ASB11"), Field.byte("ASB12"), Field.byte("ASB13"), Field.byte("ASB14"), Field.byte("ASB15"), Field.byte("ASB16"), Field.byte("ASB17"), Field.byte("ASB18"), Field.byte("ASB19"), Field.byte("ASB20"), Field.byte("ASB21"), Field.byte("ASB22"), Field.byte("ASB23"), Field.byte("ASB24"), Field.byte("ASB25"), Field.byte("ASB26"), Field.byte("ASB27"), Field.byte("ASB28"), Field.byte("ASB29"), Field.byte("ASB30"), Field.byte("ASB31"), Field.lit("\r\n")])
def thermostat_mode(): """ Read the current thermostat mode """ return MasterCommandSpec("TM", [Field.padding(13)], [Field.byte('mode'), Field.padding(12), Field.lit('\r\n')])
def virtual_sensor_list(): """ Read the list with virtual settings of the 32 (0-31) sensors. """ return MasterCommandSpec("VL", [Field.padding(13)], [Field.byte('vir0'), Field.byte('vir1'), Field.byte('vir2'), Field.byte('vir3'), Field.byte('vir4'), Field.byte('vir5'), Field.byte('vir6'), Field.byte('vir7'), Field.byte('vir8'), Field.byte('vir9'), Field.byte('vir10'), Field.byte('vir11'), Field.byte('vir12'), Field.byte('vir13'), Field.byte('vir14'), Field.byte('vir15'), Field.byte('vir16'), Field.byte('vir17'), Field.byte('vir18'), Field.byte('vir19'), Field.byte('vir20'), Field.byte('vir21'), Field.byte('vir22'), Field.byte('vir23'), Field.byte('vir24'), Field.byte('vir25'), Field.byte('vir26'), Field.byte('vir27'), Field.byte('vir28'), Field.byte('vir29'), Field.byte('vir30'), Field.byte('vir31'), Field.crc(), Field.lit('\r\n')])
def thermostat_mode_list(): """ Read the thermostat mode for each thermostat. """ return MasterCommandSpec("ml", [Field.padding(13)], [Field.byte('mode0'), Field.byte('mode1'), Field.byte('mode2'), Field.byte('mode3'), Field.byte('mode4'), Field.byte('mode5'), Field.byte('mode6'), Field.byte('mode7'), Field.byte('mode8'), Field.byte('mode9'), Field.byte('mode10'), Field.byte('mode11'), Field.byte('mode12'), Field.byte('mode13'), Field.byte('mode14'), Field.byte('mode15'), Field.byte('mode16'), Field.byte('mode17'), Field.byte('mode18'), Field.byte('mode19'), Field.byte('mode20'), Field.byte('mode21'), Field.byte('mode22'), Field.byte('mode23'), Field.byte('mode24'), Field.byte('mode25'), Field.byte('mode26'), Field.byte('mode27'), Field.byte('mode28'), Field.byte('mode29'), Field.byte('mode30'), Field.byte('mode31'), Field.crc(), 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 write_timer(): """ Writes a timer setting to an Output, and immediately activates the timer value (even when an Output is already on). """ return MasterCommandSpec("WT", [Field.byte("id"), Field.int("timer"), Field.padding(10)], [Field.byte("id"), Field.int("timer"), Field.padding(10), Field.lit("\r\n")], "RT")
def write_eeprom(): """ Write data bytes to the addr in the specified eeprom bank """ return MasterCommandSpec("WE", [Field.byte("bank"), Field.byte("address"), Field.varstr("data", 10)], [Field.byte("bank"), Field.byte("address"), Field.varstr("data", 10), Field.lit('\r\n')])
def input_list(): """ The message sent by the master whenever an input is enabled. """ return MasterCommandSpec("IL", [], [Field.byte('input'), Field.byte('output'), Field.lit("\r\n")])
def write_setpoint(): """ Write a setpoints of a thermostats """ return MasterCommandSpec("ws", [Field.byte("thermostat"), Field.byte("config"), Field.svt("temp"), Field.padding(10)], [Field.byte("thermostat"), Field.byte("config"), Field.svt("temp"), Field.padding(10), 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')])