class EnergyUsageLight(object):
    def __init__(self, db_path, pence_per_hour):
        self._comms = DBComms(db_path)
        self._light = Lighting()
        self._pence_per_hour = pence_per_hour

    def update(self):
        if not self._comms.check_comms_status():
            self._light.set_error()
        else:
            kw = self._comms.get_current_kw()
            rgb_dict = kw_to_rgb(kw, self._pence_per_hour)
            self._light.set_light(rgb_dict)
 def __init__(self, db_path, pence_per_hour):
     self._comms = DBComms(db_path)
     self._light = Lighting()
     self._pence_per_hour = pence_per_hour