-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Adds a new device to the user's device list.
-
Parameters:
-
name(str): The name of the device. -
ip(str): The IP address of the device. -
device_type(str): The type of the device.
-
Removes a device from the user's device list by name.
-
Parameters:
-
name(str): The name of the device to remove.
-
Returns the list of devices associated with the user.
-
Returns:
-
list: A list of devices.
-
Saves user settings such as theme and IP address visibility.
-
Parameters:
-
user_settings(dict): A dictionary of user settings.
-
Returns the user's settings.
-
Returns:
-
dict: A dictionary of user settings.
-
Renders the home page, displaying the user's devices. Requires login.
-
Route:
/ -
Methods:
GET
Handles user registration. Displays the registration form and processes form submissions.
-
Route:
/register -
Methods:
GET,POST
Handles user login. Displays the login form and processes form submissions.
-
Route:
/login -
Methods:
GET,POST
Logs out the current user and redirects to the login page.
-
Route:
/logout -
Methods:
GET
Adds a new device to the user's device list. Requires login.
-
Route:
/add_device -
Methods:
POST
Removes a device from the user's device list. Requires login.
-
Route:
/remove_device -
Methods:
POST
Toggles the state of a device.
-
Route:
/toggle_device -
Methods:
POST
Saves user settings. Requires login.
-
Route:
/save_settings -
Methods:
POST
Returns the user's settings. Requires login.
-
Route:
/get_settings -
Methods:
GET
Fetches and returns real-time data from Fronius solar panels.
-
Route:
/solar-data -
Methods:
GET
Returns simulated temperature, humidity, and pressure data.
-
Route:
/temperature-data -
Methods:
GET
Loads a user by their ID.
-
Parameters:
-
user_id(int): The ID of the user to load.
-
-
Returns:
-
User: The user object.
-
Returns the appropriate icon class for a given device type.
-
Parameters:
-
device_type(str): The type of the device.
-
-
Returns:
-
str: The icon class.
-
Fetches data from Fronius devices associated with the current user.
-
Returns:
-
list: A list of device data.
-
Fetches data from a Fronius device by its IP address.
-
Parameters:
-
ip_address(str): The IP address of the Fronius device.
-
-
Returns:
-
dict: The data from the Fronius device.
-
Checks if the config.json file exists.
-
Returns:
-
bool:Trueif the file exists,Falseotherwise.
-
Tests the connection to the database using the provided URI.
-
Parameters:
-
db_uri(str): The database URI.
-
-
Returns:
-
bool:Trueif the connection is successful,Falseotherwise.
-
Prompts the user to enter database configuration details and creates the config.json file.
-
Returns:
-
str: The database URI.
-
Loads the database configuration from the config.json file.
-
Returns:
-
dict: The database configuration.
-
Opens the location of the config.json file in the file explorer.