![]() |
ThalamOS
a powerful Flask web application designed to enhance your storage management.
|
Functions | |
| get_power_state () | |
| None | turn_off_lights () |
| None | color_pos (int pos) |
| None | load_default_state () |
| None | change_power_state (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 87 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 64 of file wled_requests.py.
| 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
Returns:
bool: True if the WLED device is on, False otherwise. Returns None if the device is unreachable.
Definition at line 35 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 76 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 52 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.