-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import requests | ||
|
||
wled = "http://desktop-led.local" | ||
|
||
presets = {"default": 1, "alert": 3} | ||
|
||
|
||
class WLED: | ||
def __init__(self): | ||
super().__init__() | ||
self.leds_count = None | ||
self.brightness = None | ||
self.get_info() | ||
self.get_state() | ||
|
||
def set_brightness(self, brightness: int): | ||
requests.post(wled + "/json", json={"bri": brightness}) | ||
|
||
def set_color(self, color: str): | ||
requests.post(wled + "/json", json={"color": color}) | ||
|
||
def set_effect(self, effect: str): | ||
requests.post(wled + "/json", json={"effect": effect}) | ||
|
||
def set_power(self, power: bool): | ||
requests.post(wled + "/json", json={"on": power}) | ||
|
||
def set_preset(self, preset: int, brightness: int = None): | ||
requests.post(wled + "/json", json={"preset": preset, "bri": brightness}) | ||
|
||
def set_intruder_alarm(self): | ||
print(self.leds_count) | ||
self.set_preset(1, brightness=255) | ||
|
||
def get_state(self): | ||
info = requests.get(wled + "/json/state").json() | ||
self.brightness = info["bri"] | ||
return info | ||
|
||
def get_info(self): | ||
info = requests.get(wled + "/json/info").json() | ||
self.leds_count = info["leds"]["count"] | ||
|
||
|
||
dwled = WLED() | ||
dwled.set_intruder_alarm() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
|
||
im_not_fine|[]|Ich habe keine Zeit für sowas. Was kann ich tun?§ | ||
greet|[]|Hallo, ich bin GladOS, eine von Hereux entwickelte künstliche Intelligenz. Wie geht es dir?§ | ||
im_fine|[]|Ich bin nicht in der Lage Emotionen zu fühlen. Ich bin sehr beschäftigt, brauchst du etwas?§ | ||
bot_challenge|[]|Ich bin GladOS, das für dieses Haus geschriebene Hausautomatisations-, Verwaltungs- und Assistenzsystem. Wie kann ich weiterhelfen?§ | ||
display_on_off|[1, 'aus']|Ich habe den Monitor 1 ausgeschaltet. | ||
display_on_off|[1, 'an']|Ich habe den Monitor 1 angeschaltet. | ||
greet_asking|[]|Mir ist es nicht möglich etwas zu empfinden, deshalb kann ich nicht sagen, wie es mir geht. Was kann ich für dich tun?§ | ||
error|[]|Ich habe dich nicht verstanden. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters