![]() |
ThalamOS
a powerful Flask web application designed to enhance your storage management.
|
Functions | |
None | turn_off_lights () |
None | color_pos (int pos) |
None | load_default_state () |
None | change_power_state (state) |
Annotated[bool, "True if power is on, false if power is off"] | get_power_state () |
Variables | |
Annotated | ENV_PATH |
dotenv_path | |
Annotated | WLED_HOST |
Annotated | API = f"http://{WLED_HOST}/json" |
This module provides functions to interact with a WLED device via its JSON API. It allows for turning off lights, setting colors at specific positions, loading default states, changing power states, and retrieving the current power state of the WLED device. Functions: turn_off_lights(): Sends a request to turn off the lights by setting the segment color to black. color_pos(pos): Sends a request to set the color of a specific position on a WLED device. load_default_state(): Sends a POST request to the WLED API to load the default state. change_power_state(state): Change the power state of the device. get_power_state(): Retrieves the power state of a WLED device.
None wled_requests.change_power_state | ( | state | ) |
Change the power state of the device. Args: state (bool): The desired power state. True to turn on, False to turn off. Returns: None
Definition at line 71 of file wled_requests.py.
None wled_requests.color_pos | ( | int | pos | ) |
Sends a request to set the color of a specific position on a WLED device. Args: pos (int): The position to set the color for. Returns: None
Definition at line 48 of file wled_requests.py.
Annotated[bool, "True if power is on, false if power is off"] wled_requests.get_power_state | ( | ) |
Retrieves the power state of a WLED device. Sends a GET request to the WLED device's JSON API endpoint to fetch the current state. Parses the JSON response to determine if the device is on or off. Returns: bool: True if the WLED device is on, False otherwise.
Definition at line 83 of file wled_requests.py.
None wled_requests.load_default_state | ( | ) |
Sends a POST request to the WLED API to load the default state. This function creates a JSON payload with a preset state identifier and sends it to the WLED API endpoint using a POST request. Raises: requests.exceptions.RequestException: If there is an issue with the HTTP request.
Definition at line 60 of file wled_requests.py.
None wled_requests.turn_off_lights | ( | ) |
Sends a request to turn off the lights by setting the segment color to black. This function creates a JSON payload to set the color of a segment of lights to black (hex code "000000") and sends a POST request to the specified API endpoint to turn off the lights. Raises: requests.exceptions.RequestException: If there is an issue with the HTTP request.
Definition at line 36 of file wled_requests.py.
Annotated wled_requests.API = f"http://{WLED_HOST}/json" |
Definition at line 33 of file wled_requests.py.
wled_requests.dotenv_path |
Definition at line 26 of file wled_requests.py.
Annotated wled_requests.ENV_PATH |
Definition at line 23 of file wled_requests.py.
Annotated wled_requests.WLED_HOST |
Definition at line 28 of file wled_requests.py.