Ejemplo n.º 1
0
def blinds_control(space_id, value):
    '''
    Call this method to control blinds of the given space id
    :param space_id: ID of the space (Meeting room, Office space)
    :param value: 0 to 100 (0 - Blinds OFF, 100 - Blinds ON)
    :return:
    '''
    se_client = EBO()
    token = se_client.token.get_token(se_user, se_pass)

    # get the room ID of SE
    se_id = room_mapping.get(space_id, default_room) + '/Shade'

    result = se_client.values.update_value(
        urllib.parse.quote(se_id, safe=''),
        new_value=value,
        custom_headers={'Authorization': 'Bearer ' + token.access_token})
Ejemplo n.º 2
0
def retrieve_current_thermostat(space_id):
    '''
    This method retrieves current temperature of AC
    :param space_id: ID of the space (Meeting room, Office space)
    :return: returns the current temperature of the room
    '''
    se_client = EBO()
    token = se_client.token.get_token(se_user, se_pass)

    # get the room ID of SE
    se_id = room_mapping.get(space_id, default_room) + '/Temp'

    result = se_client.values.retrieve_value(
        urllib.parse.quote(se_id, safe=''),
        custom_headers={'Authorization': 'Bearer ' + token.access_token})

    return result
Ejemplo n.º 3
0
def room_occupancy_control(space_id, value):
    '''
    Call this method to control the lights of the given space id
    :param space_id: ID of the space (Meeting room, Office space)
    :param value: set room to available, occupied or unoccupied
    :return:
    '''

    se_client = EBO()
    token = se_client.token.get_token(se_user, se_pass)

    #get the room ID of SE
    se_id = room_mapping.get(space_id, default_room) + '/RoomStatus'

    result = se_client.values.update_value(
        urllib.parse.quote(se_id, safe=''),
        new_value=value,
        custom_headers={'Authorization': 'Bearer ' + token.access_token})
Ejemplo n.º 4
0
def thermostat_control(space_id, value):
    '''
    Call this method to control thermostat of the given space id
    :param space_id: ID of the space (Meeting room, Office space)
    :param value: Thermostat value
    :return:
    '''

    # Check if the value is within the range, if not set to the limit
    if int(value) > int(thermostat_max):
        value = thermostat_max
    if int(value) < int(thermostat_min):
        value = thermostat_min

    se_client = EBO()
    token = se_client.token.get_token(se_user, se_pass)

    # get the room ID of SE
    se_id = room_mapping.get(space_id, default_room) + '/Temp'

    result = se_client.values.update_value(
        urllib.parse.quote(se_id, safe=''),
        new_value=value,
        custom_headers={'Authorization': 'Bearer ' + token.access_token})