Example #1
0
def addUser():
    user_name = bottle.request.forms.get('name')
    user_id = bottle.request.forms.get('id')

    if re.match(r"\w+$", user_name) is not None: # check that the device name is alphanumeric
        if re.match(r"[a-zA-Z0-9]{0,128}$", user_id) is not None: # check that id only has letters & numbers
            try:
                sql_insert = "INSERT INTO `Users`(`name`, `id`) VALUES (%s,%s)"
                db.query(sql_insert, (user_name, user_id))
                HomerHelper.insert_history(user_name, user_id, "device added")

                cur = db.query("SELECT * FROM Users WHERE id = %s", user_id)
                row = cur.fetchone()

                objects_list = []
                d = collections.OrderedDict()
                d['name'] = row["name"]
                d['id'] = row["id"]
                objects_list.append(d)

                return json.dumps(objects_list)

            except MySQLdb.IntegrityError:
                bottle.abort(400, "Doh! Device exsists")
        else:
            bottle.abort(400, "Doh! That request was no bueno.  The id is invalid.")
    else:
        bottle.abort(400, "Doh! That request was no bueno.  The name is invalid")
Example #2
0
def getColor():
    device_id = bottle.request.params.get('id')

    if HomerHelper.idCheck('Devices', device_id):
        device_function = HomerHelper.getDeviceFunction(device_id)
        state_location = HomerHelper.lookupDeviceAttribute(device_function, 'State')
        color_location = HomerHelper.lookupDeviceAttribute(device_function, 'Color')
        if state_location is not None:
            if color_location is not None:
                try:
                    sql_query = "SELECT id, %s, %s FROM Devices " % (state_location, color_location)
                    sql_query += "WHERE id = %s"
                    cur = db.query(sql_query, device_id)

                    row = cur.fetchone()  # device IDs unique so just get one record

                    objects_list = []
                    d = collections.OrderedDict()
                    d['id'] = row['id']
                    d['mode'] = row[state_location]
                    d['color'] = row[color_location]
                    objects_list.append(d)

                    return json.dumps(objects_list)

                except MySQLdb.IntegrityError:
                    bottle.abort(400, "Doh! Device doesnt exist")
            else:
                bottle.abort(400, "Device does not have color attribute")
        else:
            bottle.abort(400, "Device does not have mode attribute")
    else:
        bottle.abort(400, "Doh! Device ID was not found")
Example #3
0
def viewBrightness():
    nav = HomerHelper.buildNav()
    cur = db.query("SELECT * FROM `Devices` WHERE function = %s", 'lamp')
    row = cur.fetchall()
    brightness_location = HomerHelper.lookupDeviceAttribute('lamp', 'Brightness')
    html = []  # parser for the information returned
    for col in row:
        devicename = col['name']
        devicename = devicename.replace(" ", "_")
        lampdevices = (col['name'], devicename, str((int(col[brightness_location])*100 )/255),col['id'])
        html.append(lampdevices)
    return bottle.template('Lamp', nav, devices=html)
Example #4
0
def PollingStart():
    schedule(DailyHouseKeeping, id="DailyRunTasks", trigger='cron', hour=03, misfire_grace_time=None)

    if HomerHelper.getSettingValue('hue_polling') == 'True':
        logger.info("They see me pollin they hating, Phillips hue polling enabled")
        polling_rate = int(HomerHelper.getSettingValue('hue_polling_rate'))
        schedule(HuePoll, id="HuePoll", trigger='interval', seconds=polling_rate)

    if HomerHelper.getSettingValue('myQ_polling') == 'True':
        logger.info("They see me pollin they hating, myQ Device polling enabled")
        polling_rate = int(HomerHelper.getSettingValue('myQ_polling_rate'))
        schedule(myQPoll, id="MyQ Poll", trigger='interval', seconds=polling_rate, misfire_grace_time=None)
Example #5
0
def myQPoll():
    MyQ = DeviceComunication.MyQ()
    #MyQ.authenticate()
    myq_ids = HomerHelper.getIDofDeviceTypes("MyQ")
    for id in myq_ids:
        try:
            doorstatus = MyQ.getDoorStatus(id)
            HomerHelper.updateDeviceAttribute(id, doorstatus, 'State')
        except:
            MyQ.authenticate()
            MyQ.getDoorStatus(id)
            HomerHelper.updateDeviceAttribute(id, doorstatus, 'State')
Example #6
0
def removeDevice():
    device_id = bottle.request.forms.get('id')

    if HomerHelper.idCheck('Devices', device_id):  #validate the device ID
        device_name = HomerHelper.getDeviceName(device_id)
        try:
            db.query("DELETE FROM Devices WHERE id = %s", device_id)
            HomerHelper.insert_history(device_name, device_id, "device removed")
            return "OK"
        except MySQLdb.IntegrityError:
            bottle.abort(400, "Doh! Unable to remove device. ")
    else:
        bottle.abort(400,"Doh! " + device_id + " is not a valid ID or it is not enrolled in HOMEr")
Example #7
0
def viewaddDevice():
    nav = HomerHelper.buildNav()
    cur = db.query("SELECT * FROM `Devices` WHERE function = %s", 'lamp')
    row = cur.fetchall()
    brightness_location = HomerHelper.lookupDeviceAttribute(con, 'lamp', 'Brightness')
    html = []  # parser for the information returned
    for col in row:
        devicename = col['name']
        devicename = devicename.replace(" ", "_")
        lampdevices = (col['name'], devicename, str((int(col[brightness_location])*100 )/255),col['id'])
        print "viewbrightness"
        print lampdevices
        html.append(lampdevices)
    return bottle.template('brightness', devices=html, webroot=nav['webroot'], rooms=nav['rooms'], functions=nav['functions'])
Example #8
0
def viewHistory():
    nav = HomerHelper.buildNav()
    #history_index = request.params.get('index')
    history_index = 1
    entry_count = 25
    details = {}
    details['range_min'] = ((history_index - 1) * entry_count) + 1
    details['range_max'] = history_index * entry_count

    sql_query = ("SELECT * FROM `History` WHERE `EventNumber` BETWEEN %s AND %s ORDER BY `EventNumber` DESC")
    cur = db.query(sql_query, (details['range_min'], details['range_max']) )
    row = cur.fetchall()  # device IDs unique so just get one record
    history = []  # parser for the information returned
    i = 0
    for col in row:
        i += 1
        historyEntry = (
            i ,
            col['name'],
            col["timestamp"].strftime("%c"),
            col["event"],
            col["id"],
            )
        history.append(historyEntry)


    return bottle.template('History', nav, entries=history, details=details)
Example #9
0
def addDevice():
    device_name = bottle.request.forms.get('name')
    device_type = bottle.request.forms.get('type')
    device_function = bottle.request.forms.get('function')
    device_id = bottle.request.forms.get('id')
    device_location = bottle.request.forms.get('location')

    if device_name is not None: # check that the device name is present
        if re.match(r"\w+$", device_type) is not None: # check that device type is alphanumeric
            #if re.match(r"[a-zA-Z0-9]{0,128}$", device_id) is not None: # check that id only has letters and numbers
            if HomerHelper.deviceIdCheck(device_id) is False: # check that id only has letters and numbers
                if HomerHelper.roomCheck(device_location):
                    try:
                        sql_insert = "INSERT INTO `Devices`(`name`, `type`, `function`, `id`, `location`) VALUES (%s, %s,%s,%s,%s)"
                        db.query(sql_insert, (device_name, device_type, device_function, device_id, device_location))

                        HomerHelper.insert_history(device_name, device_id, "device added")

                    except MySQLdb.IntegrityError:
                        bottle.abort(400, "Doh! Device exsists")

                    try:
                        cur = db.query("SELECT * FROM Devices WHERE id = %s", device_id)
                        rows = cur.fetchall()

                        objects_list = []
                        for row in rows:
                            d = collections.OrderedDict()
                            d['name'] = row["name"]
                            d['type'] = row["type"]
                            d['function'] = row["function"]
                            d['id'] = row["id"]
                            d['location'] = row["location"]
                            objects_list.append(d)

                        return json.dumps(objects_list)

                    except MySQLdb.IntegrityError:
                        bottle.abort(400, "Doh! Adding user failed")
                else:
                    bottle.abort(400, "Doh! That request was no bueno.  The room is invalid.")
            else:
                bottle.abort(400, "Doh! That request was no bueno.  The id is invalid." + device_id)
        else:
             bottle.abort(400,"Doh! That request was no bueno.  The type is invalid")
    else:
        bottle.abort(400, "Doh! That request was no bueno.  The name is invalid")
Example #10
0
def DailyHouseKeeping():
    street = HomerHelper.getSettingValue('StreetAddress')
    city = HomerHelper.getSettingValue('City')
    state = HomerHelper.getSettingValue('State')
    while True:
        logging.debug("performing daily housekeeping actions")
        sun = HomerHelper.calcSunPosition(street, city, state)
        HomerHelper.updateSettingValue('sunrise',sun['sunrise'])
        HomerHelper.updateSettingValue('sunset',sun['sunset'])
Example #11
0
def removeUser():
    user_id = bottle.request.forms.get('id')

    if HomerHelper.idCheck('Users', user_id):  #validate the device ID
        user_name = HomerHelper.getUserName(user_id)
        try:
            db.query("DELETE FROM Users WHERE id = %s", user_id)
            #con.commit()
            HomerHelper.insert_history(user_name, user_id, "user removed")

            return("OK")

        except MySQLdb.IntegrityError:
            bottle.abort(400, "Doh! Unable to remove device. ")
    else:
        err_msg = "Doh! That request was no bueno. %s is not a valid ID or it is not enrolled in HOMEr" % user_id
        bottle.abort(400, err_msg)
Example #12
0
def setState():
    #MANDATORY FIELDS FROM REQUEST
    #DEVICE ID AS id
    #STATE TO ASSIGN TO DEVICE AS state

    device_id = bottle.request.params.get('id')  # get device ID from request
    device_state = bottle.request.params.get('state')  # get state to assign

    if HomerHelper.idCheck('Devices', device_id):  # validate the ID
        device_function = HomerHelper.getDeviceFunction(device_id)
        state_location = HomerHelper.lookupDeviceAttribute(device_function, 'State')
        if state_location is not None:
            try:
                sql_update = "UPDATE `Devices` SET %s " % state_location  # write it the same column in devices
                sql_update += "= %s  WHERE id = %s"
                db.query(sql_update, (device_state, device_id))

                #call state.action or scene here.  TBD
                device_name = HomerHelper.getDeviceName(device_id)  # lookup the name, needed for history
                device_type = HomerHelper.getDeviceType(device_id)  # lookup the device type needed for history
                history_event = "set state to: " + device_state
                HomerHelper.insert_history(device_name, device_id, history_event)
                return "OK"

            except MySQLdb.IntegrityError:
                bottle.abort(400, "Doh! Device doesnt exist")
        else:
            bottle.abort(400, "device does not have state attribute")
    else:
        bottle.abort(400, "Doh! Device ID was not found") # lookup the device function
Example #13
0
    def authenticate(self):
        loginUrl = urlparse.urljoin(self.MYQ_API, "/Membership/ValidateUserWithCulture")
        payload = {
            'appId':self.MyQ_App_ID,
            'securityToken':'null',
            'username':HomerHelper.getSettingValue('MyQ_Username'),
            'password':HomerHelper.getSettingValue('MyQ_Password'),
            'culture':'en'
        }
        logging.debug('authenticating MyQ account')
        r = requests.get(loginUrl, params=payload)
        jsonData = json.loads(r.text)
        errorMessage = str(jsonData['ErrorMessage'])

        if not errorMessage:
            return jsonData['SecurityToken']
        else:
            return None
Example #14
0
def index():
    nav = HomerHelper.buildNav()
    cur = db.query("SELECT * FROM `Users`", None)
    row = cur.fetchall()
    users = []
    for col in row:
        userdata = (col['name'], col['location'])
        users.append(userdata)
    return bottle.template('Home', nav, users= users)
Example #15
0
def setLocation():
    user_id = bottle.request.params.get('id')
    user_location = bottle.request.params.get('location')

    if HomerHelper.userIdCheck(user_id):
        user_name = HomerHelper.getUserName(user_id)

        try:
            sql_update = "UPDATE `Users` SET `Location`= %s  WHERE ID = %s"
            db.query(sql_update, (user_location, user_id))
            history_event = "set user location to: " + user_location
            HomerHelper.insert_history(user_name, user_id, history_event)
            return "OK"

        except MySQLdb.IntegrityError:
            bottle.abort(400, "Doh! User doesn't exist")
    else:
        bottle.abort(400, "Doh! User ID was not found")
Example #16
0
def getBrightness():
    device_id = bottle.request.params.get('id')

    if HomerHelper.idCheck('Devices', device_id):
        device_function = HomerHelper.getDeviceFunction(device_id)
        brightness_location = HomerHelper.lookupDeviceAttribute(device_function, 'Brightness')
        if brightness_location is not None:   #"SELECT `value1` FROM Devices WHERE id = %s"
            try:
                sql_query = "SELECT %s FROM Devices " % brightness_location  # write it the same column in devices
                sql_query += "WHERE id = %s"
                cur = db.query(sql_query, device_id)

                row = cur.fetchone()  # device IDs unique so just get one record
                device_brightness = 'brightness', row[brightness_location]
                return json.dumps(device_brightness)
            except MySQLdb.IntegrityError:
                bottle.abort(400, "Doh! Device doesnt exist")
        else:
            bottle.abort(400, "device does not have brightness attribute")
    else:
        bottle.abort(400, "Doh! Device ID was not found")
Example #17
0
def savePicture():
    device_id = bottle.request.params.get('id')  # get device ID from request
    picture_location = bottle.request.params.get('pictureURL')

    if HomerHelper.idCheck('Devices', device_id):  # validate the ID
        try:
            file = urllib.urlopen(picture_location).read()
            sql_insert = 'INSERT INTO `Images`(`device_id`, `image`) VALUES (%s, %s)'
            db.query(sql_insert, (device_id, file))

            device_name = HomerHelper.getDeviceName(device_id)  # lookup the name, needed for history
            history_event = "stored picture from  " + picture_location
            HomerHelper.insert_history(device_name, device_id, history_event)

            return "OK"
        except MySQLdb.IntegrityError:
            bottle.abort(400, "Doh! Device doesnt exist")
        except urllib2.URLError:
            bottle.abort(400, "failed to store image from source, check the url")
    else:
        bottle.abort(400, "Doh! Device ID was not found") # lookup the device function
Example #18
0
def getPicture():
    image_id = bottle.request.params.get('id')

    if HomerHelper.idCheck('Images', image_id):  # images IDs are unique so return only one image
        try:
            cur = db.query("SELECT `image` FROM `Images` WHERE id = %s", image_id)

            row = cur.fetchone()  # image IDs unique so just get one record
            response.content_type = 'image/jpg'
            return row['image']

        except MySQLdb.IntegrityError:
            bottle.abort(400, "Doh! Device doesnt exist")
    else:
        bottle.abort(400, "Doh! Image ID was not found")
Example #19
0
def getlocation():
    user_id = bottle.request.params.get('id')

    if HomerHelper.idCheck('Users', user_id):
        try:
            cur = db.query("SELECT `location` FROM `Users` WHERE id = %s", user_id)

            row = cur.fetchone()  # User IDs unique so just get one record

            user_location = 'location', row['location']
            return json.dumps(user_location)

        except MySQLdb.IntegrityError:
            bottle.abort(400, "Doh! User doesnt exist")

    else:
        bottle.abort(400, "Doh! User ID was not found")
Example #20
0
def getDevice():

    device_id = bottle.request.params.get('id')
    if HomerHelper.idCheck('Devices', device_id):  #validate the device ID
        sql_query = "SELECT * FROM `Devices` WHERE `id` = %s "
        cur = db.query(sql_query, device_id)
        row = cur.fetchone()

        objects_list = []  # parser for the information returned

        d = collections.OrderedDict()
        d['name'] = row["name"]
        d['type'] = row["type"]
        d['function'] = row["function"]
        d['id'] = row["id"]
        d['location'] = col["location"]
        objects_list.append(d)

        return json.dumps(objects_list)
    else:
        bottle.abort(400, "Doh! " + device_id + " is not a valid ID or it is not enrolled in HOMEr")
Example #21
0
def setColor():
    device_id = bottle.request.params.get('id')
    device_color = bottle.request.params.get('color')
    device_state = bottle.request.params.get('mode')

    if HomerHelper.idCheck('Devices', device_id):  # validate the ID
        device_name = HomerHelper.getDeviceName(device_id)
        device_type = HomerHelper.getDeviceType(device_id)
        device_function = HomerHelper.getDeviceFunction(device_id)
        state_location = HomerHelper.lookupDeviceAttribute(device_function, 'State')
        if state_location is not None:
            try:
                sql_update = "UPDATE `Devices` SET %s " % state_location  # write it the same column in devices
                sql_update += "= %s  WHERE id = %s"
                db.query(sql_update, (device_state, device_id))
            except MySQLdb.IntegrityError:
                bottle.abort(400, "Doh! Device doesnt exist")

            color_location = HomerHelper.lookupDeviceAttribute(device_function, 'Color')
            if color_location is not None:
                try:
                    sql_update = "UPDATE `Devices` SET %s " % color_location  # write it the same column in devices
                    sql_update += "= %s  WHERE id = %s"
                    db.query(sql_update, (device_color, device_id))
                except MySQLdb.IntegrityError:
                    bottle.abort(400, "Doh! Device doesnt exist")
            else:
                bottle.abort(400, "Device does not have color attribute")
        else:
            bottle.abort(400, "Device does not have mode attribute")

        DeviceComunication.sendDeviceColor(device_id, device_color, device_state)
        history_event = "set color to: " + device_color + "set mode to " + device_state
        HomerHelper.insert_history(device_name, device_id, history_event)
        return "OK"
    else:
        bottle.abort(400, "Doh! Device ID was not found")
Example #22
0
def viewRooms(roomname):
    nav = HomerHelper.buildNav()
    cur = db.query("SELECT * FROM `Device_Types`", None)  # Lookup all the device types to lookup devices in groups
    deviceTypes = cur.fetchall()
    html = {}

    for deviceType in deviceTypes:  # step through device types building dict of device status values
        functiontype = deviceType['type']
        cur = db.query("SELECT * FROM `Devices` WHERE `function` = %s AND `location` = %s",  (functiontype, roomname))
        rows = cur.fetchall()

        d = []
        for row in rows:
            devicename = row['name']
            devicename = devicename.replace(" ", "_")
            devices = (row['name'], devicename, row['function'], row['id'])
            d.append(devices)
        html[functiontype] = d
    print 'html'
    print html

    return bottle.template('rooms', nav, lamps=html['Lamp'])
Example #23
0
def sendDeviceBrightness(device_id, device_type, brightness):
    if device_type == "imp":
        url = IMP_API
        urllib.urlopen(IMP_API + device_id + "?setbrightness= " + brightness)

    elif device_type == "hue":
        name = HomerHelper.getDeviceName(device_id)
        logging.debug("HUE brightness being set to " + str(brightness))
        if int(brightness) == 0:
             Greenlet.spawn(b.set_light,name, 'on', False)

        else:
            Greenlet.spawn(b.set_light, name, 'on', True)
            Greenlet.spawn(b.set_light, name, 'bri', int(brightness))

    elif device_type == "spark":
        # url = SPARK_API
        #urllib.urlopen(SPARK_API + device_id + "/setbrightness " + brightness)
        payload = {
            'access_token' : spark_token,
            'args' : brightness
        }
        device_path = "devices/" + device_ID + "/setbrightness"
        url = urlparse.urljoin(SPARK_API, device_path)
        try:
            data = urllib.urlencode(payload)
            req = urllib2.Request(url, data)
            response = urllib2.urlopen(req)
            spark_response = response.read()
        except urllib2.HTTPError, httperror:
            raise SparkError(httperror)

        d = json.loads(spark_response)
        if d['return_value'] is not 1:
            #raise SparkError(spark_response)
            print "error"
Example #24
0
__author__ = 'matt'
import HomerHelper
from apscheduler.schedulers.gevent import GeventScheduler
from apscheduler.jobstores.memory import MemoryJobStore
from apscheduler.executors.pool import ThreadPoolExecutor



street = HomerHelper.getSettingValue('StreetAddress')
city = HomerHelper.getSettingValue('City')
state = HomerHelper.getSettingValue('State')
timezone = HomerHelper.calcTimeZone(street, city, state)

jobstores = {
    'default': MemoryJobStore
}
executors = {
    'default': ThreadPoolExecutor(40)
}
job_defaults = {
    'misfire_grace_time': None,
    'coalesce': True,
    'max_instances': 3
}
scheduler = GeventScheduler(executors=executors, job_defaults=job_defaults, timezone=timezone)
scheduler.start()

def schedule(*args, **kwargs):
    job = scheduler.add_job(*args, **kwargs)
    return job
Example #25
0
def setBrightness():
    #MANDATORY FIELDS FROM REQUEST
    #DEVICE ID AS id
    #STATE TO ASSIGN TO DEVICE AS state
    device_id = bottle.request.params.get('id')
    brightness = bottle.request.params.get('brightness')
    device_group = bottle.request.params.get('group')

    if device_group is None:
        if HomerHelper.idCheck('Devices', device_id):  # validate the ID
            device_function = HomerHelper.getDeviceFunction(device_id)
            brightness_location = HomerHelper.lookupDeviceAttribute(device_function, 'Brightness')
            if brightness_location is not None:
                try:
                    sql_update = "UPDATE `Devices` SET %s " % brightness_location  # write it the same column in devices
                    sql_update += "= %s  WHERE id = %s"
                    db.query(sql_update, (brightness, device_id))
                    #con.commit()

                    device_name = HomerHelper.getDeviceName(device_id)
                    device_type = HomerHelper.getDeviceType(device_id)
                    DeviceComunication.sendDeviceBrightness(device_id, device_type, brightness)
                    history_event = "set brightness to: " + brightness
                    HomerHelper.insert_history(device_name, device_id, history_event)


                    d = collections.OrderedDict()
                    d['name'] = device_name
                    d['brightness'] = brightness

                    return json.dumps(d)

                except MySQLdb.IntegrityError:
                    bottle.abort(400, "Doh! Device doesnt exist")
            else:
                bottle.abort(400, "Device does not have brightness attribute")
        else:
            bottle.abort(400, "Doh! Device ID was not found")
    else:
        if HomerHelper.deviceGroupCheck(device_group):  # validate the group
            try:
                sql_query = "SELECT `id` FROM Devices WHERE `group` = %s"  #get a list of device IDs from the group
                cur = db.query(sql_query, device_group)
                row = cur.fetchall()

                objects_list = []
                d = collections.OrderedDict()

                for device in row:
                    device_id = device['id']
                    print device_id
                    device_function = HomerHelper.getDeviceFunction(device_id)
                    brightness_location = HomerHelper.lookupDeviceAttribute(device_function, 'Brightness')
                    if brightness_location is not None:
                        try:
                            sql_update = "UPDATE `Devices` SET %s " % brightness_location  # write it the same column in devices
                            sql_update += "= %s  WHERE id = %s"
                            db.query(sql_update, (brightness, device_id))

                            device_name = HomerHelper.getDeviceName(device_id)
                            device_type = HomerHelper.getDeviceType(device_id)
                            DeviceComunication.sendDeviceBrightness(device_id, device_type, brightness)
                            history_event = "set brightness to: " + brightness
                            HomerHelper.insert_history(device_name, device_id, history_event)

                            d = collections.OrderedDict()
                            d['name'] = device_name
                            d['brightness'] = brightness
                            objects_list.append(d)

                            print objects_list

                        except MySQLdb.IntegrityError:
                            bottle.abort(400, "Something went horribly wrong, data loaded from DB was bad...uh oh")

                return json.dumps(objects_list)


            except MySQLdb.IntegrityError:
                    bottle.abort(400, "No Devices in the group: %s" % device_group)
Example #26
0
 def __init__(self):
     self.MYQ_API = HomerHelper.getSettingValue('MyQ_API_URL')
     self.MyQ_App_ID = HomerHelper.getSettingValue('MyQ_App_ID')
     self.securityToken = self.authenticate()
Example #27
0
import HomerHelper
import logging
import threading
import gevent
from gevent import Greenlet
import urlparse
import requests
import json
from Scheduler import schedule, KillJob, GetJob
import random



logger = logging.getLogger(__name__)

IMP_API = HomerHelper.getSettingValue('Imp_API_URL')
SPARK_API = HomerHelper.getSettingValue('Spark_API_URL')



spark_token = HomerHelper.getSettingValue('spark_token')



b = Bridge("Philips-hue.mattlovett.com", config_file_path = "./HOMEr_hue")

# If the app is not registered and the button is not pressed, press the button and call connect() (this only needs to be run a single time)
b.connect()

# Get the bridge state (This returns the full dictionary that you can explore)
b.get_api()
Example #28
0
def HuePoll():
        hue_ids = HomerHelper.getIDofDeviceTypes("hue")
        for id in hue_ids:
            hue_brightness = DeviceComunication.getHueBrightness(id)
            HomerHelper.updateDeviceAttribute(id, hue_brightness, 'Brightness')