Example #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'))
Example #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'))
Example #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'))
Example #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'))
Example #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))
Example #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'))
Example #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))
Example #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")
                ]))
Example #9
0
        if (device.name == "Livingroom.Switch_4" ):
            if device.is_on():
                devices_.device_by_name("Livingroom.Outlet_2/1").set_on()
                devices_.device_by_name("Livingroom.Outlet_2/2").set_on()
                devices_.device_by_name("Livingroom.Outlet_2/3").set_on()
                devices_.device_by_name("Livingroom.Outlet_2/4").set_on()
            elif device.is_off():
                devices_.device_by_name("Livingroom.Outlet_2/1").set_off()
                devices_.device_by_name("Livingroom.Outlet_2/2").set_off()
                devices_.device_by_name("Livingroom.Outlet_2/3").set_off()
                devices_.device_by_name("Livingroom.Outlet_2/4").set_off()

    except CouldNotResolveAddress as c:
        print(c)
        
Config.read()

#devices_.update_thread_start(20)

#devices = devices_.get_devices()
#for device in devices:
#    print(device)

#print("down");
#devices_.device_by_name("Livingroom.Shutter_1").set_down()
#time.sleep(2)
#print("up");
#devices_.device_by_name("Livingroom.Shutter_1").set_up()
#time.sleep(5)
#print("short down")
#devices_.device_by_name("Livingroom.Shutter_1").set_short_down()
Example #10
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)
Example #11
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'))
Example #12
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'))
Example #13
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'))
Example #14
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'))