Ejemplo n.º 1
0
class CliConfiguration(EepromModel):
    """ Models the cli configuration. These values are set by the OpenMotics daemon at startup. """
    auto_response = EepromByte((0, 11))
    auto_response_OL = EepromByte((0, 18))
    echo = EepromByte((0, 12))
    start_cli_api = EepromByte((0, 13))
    auto_init = EepromByte((0, 14))
Ejemplo n.º 2
0
class ScheduledActionConfiguration(EepromModel):
    """ Models the scheduled actions. The maximum number of scheduled actions is 102. """
    id = EepromId(102)
    hour = EepromByte(lambda mid: (113 + (mid / 51), 5 * (mid % 51) + 0))
    minute = EepromByte(lambda mid: (113 + (mid / 51), 5 * (mid % 51) + 1))
    day = EepromByte(lambda mid: (113 + (mid / 51), 5 * (mid % 51) + 2))
    # day's 8th byte -> one time or reschedule
    action = EepromActions(1, lambda mid: (113 + (mid / 51), 5 *
                                           (mid % 51) + 3))
Ejemplo n.º 3
0
class ShutterConfiguration(EepromModel):
    """
    Models a shutter. The maximum number of shutters is 120 (30 modules), the actual number of
    shutters is 4 times the number of shutter modules (eeprom address 0, 3).
    """
    id = EepromId(120, address=EepromAddress(0, 3, 1), multiplier=4)
    timer_up = EepromByte(page_per_module(4, 33, 177, 2))
    timer_down = EepromByte(page_per_module(4, 33, 178, 2))
    up_down_config = EepromByte(page_per_module(4, 33, 185, 1))
    name = EepromString(16, page_per_module(4, 33, 189, 16))
    group_1 = EepromByte(lambda mid: (63, (mid * 2) + 0))
    group_2 = EepromByte(lambda mid: (63, (mid * 2) + 1))
    steps = EextWord()
Ejemplo n.º 4
0
    def test_get_addresses(self):
        """ Test get_addresses. """
        cdt = CompositeDataType([('one', EepromByte((1, 2))), ('two', EepromByte((1, 3)))])
        addresses = cdt.get_addresses(None, 'cdt')

        self.assertEqual(2, len(addresses))

        self.assertEqual(1, addresses['one'].bank)
        self.assertEqual(2, addresses['one'].offset)
        self.assertEqual(1, addresses['one'].length)

        self.assertEqual(1, addresses['two'].bank)
        self.assertEqual(3, addresses['two'].offset)
        self.assertEqual(1, addresses['two'].length)
Ejemplo n.º 5
0
    def test_get_addresses_id(self):
        """ Test get_addresses with an id. """
        cdt = CompositeDataType([('one', EepromByte(lambda id: (1, 10+id))),
                                 ('two', EepromByte(lambda id: (1, 20+id)))])
        addresses = cdt.get_addresses(5, 'cdt')

        self.assertEqual(2, len(addresses))

        self.assertEqual(1, addresses['one'].bank)
        self.assertEqual(15, addresses['one'].offset)
        self.assertEqual(1, addresses['one'].length)

        self.assertEqual(1, addresses['two'].bank)
        self.assertEqual(25, addresses['two'].offset)
        self.assertEqual(1, addresses['two'].length)
Ejemplo n.º 6
0
class OutputConfiguration(EepromModel):
    """
    Models an output. The maximum number of inputs is 240 (30 modules), the actual number of
    outputs is 8 times the number of output modules (eeprom address 0, 2).
    """
    id = EepromId(240, address=EepromAddress(0, 2, 1), multiplier=8)
    module_type = EepromString(1,
                               lambda mid: (33 + mid / 8, 0),
                               read_only=True,
                               shared=True)
    name = EepromString(16, page_per_module(8, 33, 20, 16))
    timer = EepromWord(page_per_module(8, 33, 4, 2))
    floor = EepromByte(page_per_module(8, 33, 157, 1))
    type = EepromByte(page_per_module(8, 33, 149, 1))
    lock_bit_id = EepromByte(lambda mid: (231, mid))
    can_led_1_id = EepromByte(gen_address(221, 32, 0))
    can_led_1_function = EepromEnum(gen_address(221, 32, 1),
                                    get_led_functions())
    can_led_2_id = EepromByte(gen_address(221, 32, 2))
    can_led_2_function = EepromEnum(gen_address(221, 32, 3),
                                    get_led_functions())
    can_led_3_id = EepromByte(gen_address(221, 32, 4))
    can_led_3_function = EepromEnum(gen_address(221, 32, 5),
                                    get_led_functions())
    can_led_4_id = EepromByte(gen_address(221, 32, 6))
    can_led_4_function = EepromEnum(gen_address(221, 32, 7),
                                    get_led_functions())
Ejemplo n.º 7
0
class RTD10CoolingConfiguration(EepromModel):
    """ Configuration for RTD-10 when in cooling mode. """
    id = EepromId(32)
    temp_setpoint_output = EepromByte(lambda mid: (217, 200 + mid))
    ventilation_speed_output = EepromByte(lambda mid: (218, mid))
    ventilation_speed_value = EepromByte(lambda mid: (218, 64 + mid))
    mode_output = EepromByte(lambda mid: (219, mid))
    mode_value = EepromByte(lambda mid: (219, 64 + mid))
    on_off_output = EepromByte(lambda mid: (219, 100 + mid))
    poke_angle_output = EepromByte(lambda mid: (220, mid))
    poke_angle_value = EepromByte(lambda mid: (220, 64 + mid))
    room = EextByte()
Ejemplo n.º 8
0
class RTD10HeatingConfiguration(EepromModel):
    """ Configuration for RTD-10 when in heating mode. """
    id = EepromId(32)
    temp_setpoint_output = EepromByte(lambda mid: (213, 200 + mid))
    ventilation_speed_output = EepromByte(lambda mid: (214, mid))
    ventilation_speed_value = EepromByte(lambda mid: (214, 64 + mid))
    mode_output = EepromByte(lambda mid: (215, mid))
    mode_value = EepromByte(lambda mid: (215, 64 + mid))
    on_off_output = EepromByte(lambda mid: (215, 100 + mid))
    poke_angle_output = EepromByte(lambda mid: (216, mid))
    poke_angle_value = EepromByte(lambda mid: (216, 64 + mid))
    room = EextByte()
Ejemplo n.º 9
0
class InputConfiguration(EepromModel):
    """
    Models an input. The maximum number of inputs is 240 (30 modules), the actual number of
    inputs is 8 times the number of input modules (eeprom address 0, 1).
    """
    id = EepromId(240, address=EepromAddress(0, 1, 1), multiplier=8)
    module_type = EepromString(1,
                               lambda mid: (2 + mid / 8, 0),
                               read_only=True,
                               shared=True)
    name = EepromString(
        8,
        per_module(
            8, lambda mid, iid: (115 + (mid / 4), 64 * (mid % 4) + 8 * iid)))
    action = EepromByte(page_per_module(8, 2, 4, 1))
    basic_actions = EepromActions(15, page_per_module(8, 2, 12, 30))
    invert = EepromByte(lambda mid: (32, mid))
    can = EepromString(1,
                       lambda mid: (2 + mid / 8, 252),
                       read_only=True,
                       shared=True)
Ejemplo n.º 10
0
class CanLedConfiguration(EepromModel):
    """
    Models a CAN LED configuration. Each configuration defines the CAN LED that will be driven
    and the the function to drive the LED. The LED function will be activated when:
    the number of lights on is 0 (id = 0), the number of lights on is greater than 0 (id = 1), ...,
    the number of lights on is greater than 14 (id = 15), the number of outputs on is 0 (id = 16),
    ther number of outputs is greater than 0 (id = 17), the number of outputs on is greater than 14
    (id = 31). """
    id = EepromId(32)
    can_led_1_id = EepromByte(gen_address(229, 32, 0))
    can_led_1_function = EepromEnum(gen_address(229, 32, 1),
                                    get_led_functions())
    can_led_2_id = EepromByte(gen_address(229, 32, 2))
    can_led_2_function = EepromEnum(gen_address(229, 32, 3),
                                    get_led_functions())
    can_led_3_id = EepromByte(gen_address(229, 32, 4))
    can_led_3_function = EepromEnum(gen_address(229, 32, 5),
                                    get_led_functions())
    can_led_4_id = EepromByte(gen_address(229, 32, 6))
    can_led_4_function = EepromEnum(gen_address(229, 32, 7),
                                    get_led_functions())
Ejemplo n.º 11
0
class ShutterGroupConfiguration(EepromModel):
    """ Models a group of shutters. """
    id = EepromId(30)
    timer_up = EepromByte(lambda mid: (64, (mid * 2) + 0))
    timer_down = EepromByte(lambda mid: (64, (mid * 2) + 1))
Ejemplo n.º 12
0
 class RoModel(EepromModel):
     """ Dummy model. """
     id = EepromId(10)
     name = EepromString(100, lambda id: (1, 2 + id))
     other = EepromByte(lambda id: (2, 2 + id), read_only=True)
Ejemplo n.º 13
0
class CoolingConfiguration(EepromModel):
    """ Models a thermostat in cooling mode. The maximum number of thermostats is 32. """
    id = EepromId(32)
    name = EepromString(16, lambda mid: (204 + (mid / 16), 16 * (mid % 16)))
    setp0 = EepromTemp(lambda mid: (201, 32 + mid))
    setp1 = EepromTemp(lambda mid: (201, 64 + mid))
    setp2 = EepromTemp(lambda mid: (201, 96 + mid))
    setp3 = EepromTemp(lambda mid: (201, 128 + mid))
    setp4 = EepromTemp(lambda mid: (201, 160 + mid))
    setp5 = EepromTemp(lambda mid: (201, 192 + mid))
    sensor = EepromByte(lambda mid: (203, 8 + mid))
    output0 = EepromByte(lambda mid: (201, mid))
    output1 = EepromByte(lambda mid: (201, 224 + mid))
    pid_p = EepromByte(lambda mid: (200, 4 * mid))
    pid_i = EepromByte(lambda mid: (200, (4 * mid) + 1))
    pid_d = EepromByte(lambda mid: (200, (4 * mid) + 2))
    pid_int = EepromByte(lambda mid: (200, (4 * mid) + 3))
    permanent_manual = EepromIBool(lambda mid: (195, 64 + mid))
    auto_mon = CompositeDataType([
        ('temp_n', EepromTemp(lambda mid: (212, mid + 0))),
        ('start_d1', EepromTime(lambda mid: (206, (4 * mid) + 0))),
        ('stop_d1', EepromTime(lambda mid: (206, (4 * mid) + 1))),
        ('temp_d1', EepromTemp(lambda mid: (210, mid + 0))),
        ('start_d2', EepromTime(lambda mid: (206, (4 * mid) + 2))),
        ('stop_d2', EepromTime(lambda mid: (206, (4 * mid) + 3))),
        ('temp_d2', EepromTemp(lambda mid: (211, mid + 0)))
    ])
    auto_tue = CompositeDataType([
        ('temp_n', EepromTemp(lambda mid: (212, mid + 32))),
        ('start_d1', EepromTime(lambda mid: (206, (4 * mid) + 128))),
        ('stop_d1', EepromTime(lambda mid: (206, (4 * mid) + 129))),
        ('temp_d1', EepromTemp(lambda mid: (210, mid + 32))),
        ('start_d2', EepromTime(lambda mid: (206, (4 * mid) + 130))),
        ('stop_d2', EepromTime(lambda mid: (206, (4 * mid) + 131))),
        ('temp_d2', EepromTemp(lambda mid: (211, mid + 32)))
    ])
    auto_wed = CompositeDataType([
        ('temp_n', EepromTemp(lambda mid: (212, mid + 64))),
        ('start_d1', EepromTime(lambda mid: (207, (4 * mid) + 0))),
        ('stop_d1', EepromTime(lambda mid: (207, (4 * mid) + 1))),
        ('temp_d1', EepromTemp(lambda mid: (210, mid + 64))),
        ('start_d2', EepromTime(lambda mid: (207, (4 * mid) + 2))),
        ('stop_d2', EepromTime(lambda mid: (207, (4 * mid) + 3))),
        ('temp_d2', EepromTemp(lambda mid: (211, mid + 64)))
    ])
    auto_thu = CompositeDataType([
        ('temp_n', EepromTemp(lambda mid: (212, mid + 96))),
        ('start_d1', EepromTime(lambda mid: (207, (4 * mid) + 128))),
        ('stop_d1', EepromTime(lambda mid: (207, (4 * mid) + 129))),
        ('temp_d1', EepromTemp(lambda mid: (210, mid + 96))),
        ('start_d2', EepromTime(lambda mid: (207, (4 * mid) + 130))),
        ('stop_d2', EepromTime(lambda mid: (207, (4 * mid) + 131))),
        ('temp_d2', EepromTemp(lambda mid: (211, mid + 96)))
    ])
    auto_fri = CompositeDataType([
        ('temp_n', EepromTemp(lambda mid: (212, mid + 128))),
        ('start_d1', EepromTime(lambda mid: (208, (4 * mid) + 0))),
        ('stop_d1', EepromTime(lambda mid: (208, (4 * mid) + 1))),
        ('temp_d1', EepromTemp(lambda mid: (210, mid + 128))),
        ('start_d2', EepromTime(lambda mid: (208, (4 * mid) + 2))),
        ('stop_d2', EepromTime(lambda mid: (208, (4 * mid) + 3))),
        ('temp_d2', EepromTemp(lambda mid: (211, mid + 128)))
    ])
    auto_sat = CompositeDataType([
        ('temp_n', EepromTemp(lambda mid: (212, mid + 160))),
        ('start_d1', EepromTime(lambda mid: (208, (4 * mid) + 128))),
        ('stop_d1', EepromTime(lambda mid: (208, (4 * mid) + 129))),
        ('temp_d1', EepromTemp(lambda mid: (210, mid + 160))),
        ('start_d2', EepromTime(lambda mid: (208, (4 * mid) + 130))),
        ('stop_d2', EepromTime(lambda mid: (208, (4 * mid) + 131))),
        ('temp_d2', EepromTemp(lambda mid: (211, mid + 160)))
    ])
    auto_sun = CompositeDataType([
        ('temp_n', EepromTemp(lambda mid: (212, mid + 192))),
        ('start_d1', EepromTime(lambda mid: (209, (4 * mid) + 0))),
        ('stop_d1', EepromTime(lambda mid: (209, (4 * mid) + 1))),
        ('temp_d1', EepromTemp(lambda mid: (210, mid + 192))),
        ('start_d2', EepromTime(lambda mid: (209, (4 * mid) + 2))),
        ('stop_d2', EepromTime(lambda mid: (209, (4 * mid) + 3))),
        ('temp_d2', EepromTemp(lambda mid: (211, mid + 192)))
    ])
    room = EextByte()
Ejemplo n.º 14
0
class ModuleConfiguration(EepromModel):
    """ Models the global module configuration. """
    nr_input_modules = EepromByte((0, 1), read_only=True)
    nr_output_modules = EepromByte((0, 2), read_only=True)
    enable_thermostat_16 = EepromByte((0, 15))
Ejemplo n.º 15
0
class Model7(EepromModel):
    """ Dummy model with multiple fields, including eext fields and an id. """
    id = EepromId(3)
    name = EepromString(10, lambda id: (id, 4))
    link = EepromByte(lambda id: (id, 14))
    room = EextByte()
Ejemplo n.º 16
0
class Model5(EepromModel):
    """ Dummy model with multiple fields and an id. """
    id = EepromId(3)
    name = EepromString(10, lambda id: (3+id, 4))
    link = EepromByte(lambda id: (3+id, 14))
    out = EepromWord(lambda id: (3+id, 15))
Ejemplo n.º 17
0
 def test_get_name(self):
     """ Test get_name. """
     cdt = CompositeDataType([('one', EepromByte((1, 2))), ('two', EepromByte((1, 3)))])
     self.assertEqual('[one(Byte),two(Byte)]', cdt.get_name())
Ejemplo n.º 18
0
class GlobalRTD10Configuration(EepromModel):
    """ The global RTD-10 configuration. """
    output_value_heating_16 = EepromByte((213, 24))
    output_value_heating_16_5 = EepromByte((213, 25))
    output_value_heating_17 = EepromByte((213, 26))
    output_value_heating_17_5 = EepromByte((213, 27))
    output_value_heating_18 = EepromByte((213, 28))
    output_value_heating_18_5 = EepromByte((213, 29))
    output_value_heating_19 = EepromByte((213, 30))
    output_value_heating_19_5 = EepromByte((213, 31))
    output_value_heating_20 = EepromByte((213, 32))
    output_value_heating_20_5 = EepromByte((213, 33))
    output_value_heating_21 = EepromByte((213, 34))
    output_value_heating_21_5 = EepromByte((213, 35))
    output_value_heating_22 = EepromByte((213, 36))
    output_value_heating_22_5 = EepromByte((213, 37))
    output_value_heating_23 = EepromByte((213, 38))
    output_value_heating_23_5 = EepromByte((213, 39))
    output_value_heating_24 = EepromByte((213, 40))
    output_value_cooling_16 = EepromByte((217, 24))
    output_value_cooling_16_5 = EepromByte((217, 25))
    output_value_cooling_17 = EepromByte((217, 26))
    output_value_cooling_17_5 = EepromByte((217, 27))
    output_value_cooling_18 = EepromByte((217, 28))
    output_value_cooling_18_5 = EepromByte((217, 29))
    output_value_cooling_19 = EepromByte((217, 30))
    output_value_cooling_19_5 = EepromByte((217, 31))
    output_value_cooling_20 = EepromByte((217, 32))
    output_value_cooling_20_5 = EepromByte((217, 33))
    output_value_cooling_21 = EepromByte((217, 34))
    output_value_cooling_21_5 = EepromByte((217, 35))
    output_value_cooling_22 = EepromByte((217, 36))
    output_value_cooling_22_5 = EepromByte((217, 37))
    output_value_cooling_23 = EepromByte((217, 38))
    output_value_cooling_23_5 = EepromByte((217, 39))
    output_value_cooling_24 = EepromByte((217, 40))
Ejemplo n.º 19
0
class CoolingPumpGroupConfiguration(EepromModel):
    """ Models a pump group for cooling. The maximum number of pump groups is 8. """
    id = EepromId(8)
    outputs = EepromCSV(32, lambda mid: (202, mid * 32))
    output = EepromByte(lambda mid: (203, mid))
    room = EextByte()
Ejemplo n.º 20
0
class Model3(EepromModel):
    """ Dummy model with multiple fields. """
    name = EepromString(10, (3, 4))
    link = EepromByte((3, 14))
    out = EepromWord((3, 15))
Ejemplo n.º 21
0
class PulseCounterConfiguration(EepromModel):
    """ Models a pulse counter. The maximum number of pulse counters is 24. """
    id = EepromId(24)
    name = EepromString(16, lambda mid: (98 + (mid / 16), 16 * (mid % 16)))
    input = EepromByte(lambda mid: (0, 160 + mid))
Ejemplo n.º 22
0
class Model6(EepromModel):
    """ Dummy model with a CompositeDataType. """
    name = EepromString(10, (3, 4))
    status = CompositeDataType([('link', EepromByte((3, 14))),
                                ('out', EepromWord((3, 15)))])
Ejemplo n.º 23
0
class DimmerConfiguration(EepromModel):
    """ Models the global dimmer configuration.  """
    min_dim_level = EepromByte((0, 5))
    dim_step = EepromByte((0, 6))
    dim_wait_cycle = EepromByte((0, 7))
    dim_memory = EepromByte((0, 9))
Ejemplo n.º 24
0
class Model8(EepromModel):
    """ Dummy model with multiple fields, including eext fields, without an id. """
    name = EepromString(10, (1, 4))
    link = EepromByte((1, 14))
    room = EextByte()
Ejemplo n.º 25
0
class GlobalThermostatConfiguration(EepromModel):
    """ The global thermostat configuration. """
    outside_sensor = EepromByte((0, 16))
    threshold_temp = EepromTemp((0, 17))
    pump_delay = EepromByte((0, 19))
    switch_to_heating_output_0 = EepromByte((199, 0))
    switch_to_heating_value_0 = EepromByte((199, 1))
    switch_to_heating_output_1 = EepromByte((199, 2))
    switch_to_heating_value_1 = EepromByte((199, 3))
    switch_to_heating_output_2 = EepromByte((199, 4))
    switch_to_heating_value_2 = EepromByte((199, 5))
    switch_to_heating_output_3 = EepromByte((199, 6))
    switch_to_heating_value_3 = EepromByte((199, 7))
    switch_to_cooling_output_0 = EepromByte((199, 8))
    switch_to_cooling_value_0 = EepromByte((199, 9))
    switch_to_cooling_output_1 = EepromByte((199, 10))
    switch_to_cooling_value_1 = EepromByte((199, 11))
    switch_to_cooling_output_2 = EepromByte((199, 12))
    switch_to_cooling_value_2 = EepromByte((199, 13))
    switch_to_cooling_output_3 = EepromByte((199, 14))
    switch_to_cooling_value_3 = EepromByte((199, 15))