Beispiel #1
0
 def test_config_temperature(self):
     xknx = XKNX(self.loop, start=False)
     Config(xknx).read('../xknx.yaml')
     self.assertEqual(
         xknx.devices['Kitchen.Thermostat_1'],
         Thermostat(xknx,
                    'Kitchen.Thermostat_1',
                    group_address_temperature='1/7/1'))
Beispiel #2
0
 def test_config_setpoint(self):
     xknx = XKNX(self.loop, start=False)
     Config(xknx).read('../xknx.yaml')
     self.assertEqual(
         xknx.devices['Livingroom.Thermostat_2'],
         Thermostat(xknx,
                    'Livingroom.Thermostat_2',
                    group_address_temperature='1/7/2',
                    group_address_setpoint='1/7/3'))
Beispiel #3
0
 def test_config_sensor_percent(self):
     xknx = XKNX(self.loop, start=False)
     Config(xknx).read('../xknx.yaml')
     self.assertEqual(
         xknx.devices['Heating.Valve1'],
         Sensor(xknx,
                'Heating.Valve1',
                group_address='2/0/0',
                value_type='percent'))
Beispiel #4
0
 def test_config_ligh_dimm(self):
     xknx = XKNX(self.loop, start=False)
     Config(xknx).read('../xknx.yaml')
     self.assertEqual(
         xknx.devices['Diningroom.Light_1'],
         Light(xknx,
               'Diningroom.Light_1',
               group_address_switch='1/6/4',
               group_address_dimm='1/6/5',
               group_address_brightness='1/6/6'))
Beispiel #5
0
 def test_config_sensor_binary_significant_bit(self):
     xknx = XKNX(self.loop, start=False)
     Config(xknx).read('../xknx.yaml')
     self.assertEqual(
         xknx.devices['Kitchen.Thermostat.Presence'],
         Sensor(xknx,
                'Kitchen.Thermostat.Presence',
                group_address='3/0/2',
                value_type='binary',
                significant_bit=2))
Beispiel #6
0
 def test_config_sensor_binary_sensor_class(self):
     xknx = XKNX(self.loop, start=False)
     Config(xknx).read('../xknx.yaml')
     self.assertEqual(
         xknx.devices['DiningRoom.Motion.Sensor'],
         Sensor(xknx,
                'DiningRoom.Motion.Sensor',
                group_address='3/0/1',
                value_type='binary',
                sensor_class='motion'))
Beispiel #7
0
 def test_config_shutter(self):
     xknx = XKNX(self.loop, start=False)
     Config(xknx).read('../xknx.yaml')
     self.assertEqual(
         xknx.devices['Livingroom.Shutter_2'],
         Shutter(xknx,
                 'Livingroom.Shutter_2',
                 group_address_long='1/4/5',
                 group_address_short='1/4/6',
                 group_address_position_feedback='1/4/7',
                 group_address_position='1/4/8',
                 travel_time_down=50,
                 travel_time_up=60))
Beispiel #8
0
 def test_config_switch(self):
     xknx = XKNX(self.loop, start=False)
     Config(xknx).read('../xknx.yaml')
     self.assertEqual(
         xknx.devices['Livingroom.Switch_1'],
         Switch(xknx,
                'Livingroom.Switch_1',
                group_address='1/2/7',
                actions=[
                    Action(xknx,
                           hook="on",
                           target="Livingroom.Outlet_1",
                           method="on"),
                    Action(xknx,
                           hook="on",
                           target="Livingroom.Outlet_2",
                           method="on")
                ]))
Beispiel #9
0
#!/usr/bin/python3

from xknx import XKNX, Config
import time


def telegram_received_callback(xknx, device, telegram):

    print("Callback received from {0}".format(device.name))

    if (device.name == "Livingroom.Switch_1"):
        if device.is_on():
            xknx.devices["Livingroom.Outlet_1"].set_on()
        elif device.is_off():
            xknx.devices["Livingroom.Outlet_1"].set_off()


xknx = XKNX()

Config(xknx).read()

xknx.start(True, telegram_received_callback=telegram_received_callback)
Beispiel #10
0
 def test_config_time(self):
     xknx = XKNX(self.loop, start=False)
     Config(xknx).read('../xknx.yaml')
     self.assertEqual(xknx.devices['General.Time'],
                      Time(xknx, 'General.Time', group_address='2/1/2'))
Beispiel #11
0
 def test_config_outlet(self):
     xknx = XKNX(self.loop, start=False)
     Config(xknx).read('../xknx.yaml')
     self.assertEqual(
         xknx.devices['Livingroom.Outlet_2'],
         Outlet(xknx, 'Livingroom.Outlet_2', group_address='1/3/2'))
Beispiel #12
0
 def test_config_light(self):
     xknx = XKNX(self.loop, start=False)
     Config(xknx).read('../xknx.yaml')
     self.assertEqual(
         xknx.devices['Living-Room.Light_1'],
         Light(xknx, 'Living-Room.Light_1', group_address_switch='1/6/7'))
Beispiel #13
0
 def test_config_sensor_no_value_type(self):
     xknx = XKNX(self.loop, start=False)
     Config(xknx).read('../xknx.yaml')
     self.assertEqual(
         xknx.devices['Some.Other.Value'],
         Sensor(xknx, 'Some.Other.Value', group_address='2/0/2'))