def setUp(self): self.hue = Hue(ip=ip, api_key=api_key) self.dummy_links = [ '/scenes/7FQzspPLCTwjAsL', '/rules/4', '/sensors/66', '/groups/1' ] self.dummy_resourcelink = Resourcelink(self.hue, 'dummy_id', 10013, 'dumy dimmer switch', 'Dimmer switch', self.dummy_links)
def __init__(self, notification=False, room_id=0, temperature_notification=False, temperature_sensor=None, temperature_limit=2100): self.hue = Hue.Hue(ip=ip, api_key=api_key) self.notification = notification self.temperature_notification = temperature_notification self.room = self.hue.get_group(room_id) self.room_all = self.hue.get_group(0) if temperature_sensor is not None: self.temperature = self.hue.get_sensor( temperature_sensor).get_temperature() self.temperature_limit = temperature_limit
def setUp(self): self.hue = Hue(ip=ip, api_key=api_key)
current_time = time.time() current_time_formatted = time.strftime('%H:%M', time.localtime(current_time)) f = open("last_triggered.txt", "r") last_triggered = float(f.read()) f = open("last_triggered.txt", "w") f.write(str(current_time)) f.close() last_triggered_plus_four_hours = last_triggered + (4 * 60) return last_triggered, last_triggered_plus_four_hours, current_time_formatted if __name__ == '__main__': hue = Hue.Hue(ip=ip, api_key=hue_api_key) temperature = hue.get_sensor(86).get_temperature() last_triggered, last_triggered_plus_four_hours, current_time_formatted = getTimes( ) temperature_limit = 2100 if '06.00' <= current_time_formatted <= '21.30': if last_triggered < time.time(): if temperature > temperature_limit: title = 'Temperature is {} °C'.format(temperature / 100) send_request(title, "Shortcuts", "now")
import RPi.GPIO as GPIO import time from config import ip, api_key from huePyApi import Hue debounce_time = 0.22 long_press_time = 0.8 index = 0 hue = Hue.Hue(ip=ip, api_key=api_key) group_0 = hue.get_group(0) group_5 = hue.get_group(5) scenes_dimmer = hue.get_resourcelink(1063).get_linked_scenes() scenes_dimmer.reverse() scenes_dimmer.append('8CwvoHEQe02ATlp') # (schlafen II) class Button: id_counter = 0 def __init__(self, title, gpioPin, btnAction): self.id = Button.id_counter self.title = title self.gpioPin = gpioPin self.btnAction = btnAction Button.id_counter += 1