def add_location(name) -> Location:
    """

    :param name:
    :return:
    """
    newloc = Location(name)
    commit(newloc)
    return newloc
def add_event(device: Device, state: str, date) -> EventLog:
    """

    :param device:
    :param state:
    :param date:
    :return:
    """
    event = EventLog(device, state, date, 0)
    commit(event)
    return event
Example #3
0
def add_window(location: Location, x: int, y: int, name: str) -> Window:
    """
    Adds a window to devices table and returns a Window model

    :param location:
    :param name:
    :return:
    """
    newlight = Window(location, x, y, name)
    commit(newlight)
    return newlight
Example #4
0
def add_water_meter(location: Location, x: int, y: int, name: str) -> Water:
    """
    Adds a water meter to devices table and returns a Water model

    :param location:
    :param name:
    :return:
    """
    newlight = Water(location, x, y, name)
    commit(newlight)
    return newlight
Example #5
0
def add_door(location: Location, x: int, y: int, name: str) -> Door:
    """
    Adds a door to devices table and returns a Door model

    :param location: The location to add the door to
    :param name: A unique name for the door
    :return: Door object
    """
    door = Door(location, x, y, name)
    commit(door)
    return door
def add_hvac_event(device: Device, state: str, temperature: int,
                   date) -> EventLog:
    """

    :param device:
    :param state:
    :param date:
    :return:
    """
    event = EventLog(device, state, date, temperature)
    commit(event)
    return event
def add_out_temperature_log(device: Device, temperature: int,
                            date) -> EventLog:
    """

    :param device:
    :param state:
    :param date:
    :return:
    """
    event = EventLog(device, "EXTTEMP", date, temperature)
    commit(event)
    return event
Example #8
0
def add_hvac(location: Location, x: int, y: int, name: str,
             wattage: int) -> HVAC:
    """

    :param location:
    :param name:
    :param wattage:
    :return:
    """
    newhvac = HVAC(location, x, y, name, wattage)
    commit(newhvac)
    return newhvac
Example #9
0
def add_electric_device(location: Location, x: int, y: int, name: str,
                        wattage: int) -> Electric:
    """

    :param location:
    :param name:
    :param wattage:
    :return:
    """
    newelec = Electric(location, x, y, name, wattage)
    commit(newelec)
    return newelec
Example #10
0
def add_light(location: Location, x: int, y: int, name: str,
              wattage: int) -> Light:
    """
    Adds a light to devices table and returns a Light model

    :param name:
    :param wattage:
    :param location:
    :return:
    """
    newlight = Light(location, x, y, name, wattage)
    commit(newlight)
    return newlight
Example #11
0
def add_usage(device: Device, date, type: str, data: float) -> Usage:
    """

    :param device: deviceId
    :param date: DATETIME
    :param type: water/electric
    :param data: gallons/kWh
    :return:
    """
    assert data > 0

    usageData = Usage(device, date, type, data)

    commit(usageData)
    return usageData
Example #12
0
def set_hvac_params(hvacsystem: HVAC, set_f: int, high_f: int, low_f: int,
                    int_f: int, ext_f: int) -> None:
    """

    :param hvacsystem:
    :param set_f The temperature in degrees F to set the house to
    :param high_f: The temperature in degrees to automatically switch to COOL
    :param low_f: The temperature in degrees to automatically switch to HEAT
    :param int_f: The temperature of the house in F
    :param ext_f: The temperature of outside in F
    :return:
    """
    # Ensure high temp is not less than low temp
    assert high_f > low_f
    assert high_f > set_f and set_f > low_f

    hvacsystem.set_f = set_f
    hvacsystem.int_f = int_f
    hvacsystem.ext_f = ext_f
    hvacsystem.high_f = high_f
    hvacsystem.low_f = low_f

    commit(hvacsystem)