### Install openWB Core Source: https://github.com/openwb/core/blob/master/README.md Execute this command in the shell to install the openWB core software. Ensure you are using a compatible Debian 11 'Bullseye' system. ```bash curl -s https://raw.githubusercontent.com/openWB/core/master/openwb-install.sh | sudo bash ``` -------------------------------- ### Datastore Upgrade Function Example Source: https://github.com/openwb/core/blob/master/docs/Neues Modul programmieren.md An example of an upgrade function for Datastore version 104, which adds missing configuration parameters for the aWATTar provider. It iterates through MQTT topics, decodes payloads, checks for specific conditions, and updates configurations if necessary. ```python def upgrade_datastore_104(self) -> None: """Upgrade-Funktion für Datastore-Version 104: Ergänzt fehlende aWATTar-Konfigurationsparameter""" def upgrade(topic: str, payload) -> None: """Prüft und migriert ein einzelnes MQTT-Topic""" # Topic finden, das aktualisiert werden soll if "openWB/optional/ep/flexible_tariff/provider" == topic: provider = decode_payload(payload) # Nur für aWATTar-Provider ausführen if provider["type"] == "awattar": # Prüfen, ob das "net"-Feld fehlt (neue Konfiguration) if provider["configuration"].get("net") is None: # Standardwerte für fehlende Konfigurationsparameter setzen provider["configuration"]["net"] = False provider["configuration"]["fix"] = 0.015 provider["configuration"]["proportional"] = 0.03 provider["configuration"]["tax"] = 0.2 # Aktualisierte Konfiguration zurückgeben return {topic: provider} # Alle gespeicherten MQTT-Topics durchlaufen und Upgrade-Funktion anwenden self._loop_all_received_topics(upgrade) # Diese Upgrade-Funktion als ausgeführt markieren (Version 104) self._append_datastore_version(104) ``` -------------------------------- ### LG Device API - Correct Auth Key Source: https://github.com/openwb/core/blob/master/packages/modules/devices/lg/lg/JSON-Beispiele.txt This example demonstrates a successful POST request to the /v1/user/essinfo/home endpoint using a valid authentication key. The response contains detailed device statistics and operational information. ```bash $ curl -k -d '{"auth_key":"67567d76-0c83-11ea-8a59-d84fb802005a"}' -H "Content-Type: application/json" -X POST https://192.168.0.248/v1/user/essinfo/home { "statistics": { "pcs_pv_total_power": "0", "batconv_power": "372", "bat_use": "1", "bat_status": "2", "bat_user_soc": "14.58333", "load_power": "361", "load_today": "0.0", "grid_power": "11", "current_day_self_consumption": "94.8", "current_pv_generation_sum": "7415", "current_grid_feed_in_energy": "385" }, "direction": { "is_direct_consuming_": "0", "is_battery_charging_": "0", "is_battery_discharging_": "1", "is_grid_selling_": "0", "is_grid_buying_": "0", "is_charging_from_grid_": "0" }, "operation": { "status": "start", "mode": "1" }, "wintermode": { "winter_status": "on" }, "pcs_fault": { "pcs_status": "pcs_ok" } } ``` -------------------------------- ### LG Device API - Incorrect Auth Key Source: https://github.com/openwb/core/blob/master/packages/modules/devices/lg/lg/JSON-Beispiele.txt This example shows the response when an incorrect or invalid authentication key is used in a POST request to the /v1/user/essinfo/home endpoint. ```bash $ curl -k -d '{"auth_key":"a7df86bc-092c-11ea-8a59-d84fb802005a"}' -H "Content-Type: application/json" -X POST https://192.168.0.248/v1/user/essinfo/home { "auth": "auth_key failed" } ``` -------------------------------- ### Get ESS Home Information (Valid Auth Key) Source: https://github.com/openwb/core/blob/master/packages/modules/devices/lg/lg/JSON-Beispiele.txt Retrieves detailed ESS home information using a valid authentication key. ```APIDOC ## POST /v1/user/essinfo/home (Valid Auth Key) ### Description Retrieves detailed ESS home information, including statistics, operational direction, and status, using a valid authentication key. ### Method POST ### Endpoint https://192.168.0.248/v1/user/essinfo/home ### Request Body - **auth_key** (string) - Required - The authentication key. ### Request Example { "auth_key": "67567d76-0c83-11ea-8a59-d84fb802005a" } ### Response #### Success Response (200) - **statistics** (object) - Contains energy-related statistics. - **pcs_pv_total_power** (string) - Total PV power. - **batconv_power** (string) - Battery conversion power. - **bat_use** (string) - Battery usage indicator. - **bat_status** (string) - Battery status. - **bat_user_soc** (string) - Battery state of charge. - **load_power** (string) - Load power. - **load_today** (string) - Today's load energy. - **grid_power** (string) - Grid power. - **current_day_self_consumption** (string) - Current day self-consumption percentage. - **current_pv_generation_sum** (string) - Total PV generation for the current day. - **current_grid_feed_in_energy** (string) - Current grid feed-in energy. - **direction** (object) - Indicates the direction of energy flow. - **is_direct_consuming_** (string) - Whether directly consuming. - **is_battery_charging_** (string) - Whether battery is charging. - **is_battery_discharging_** (string) - Whether battery is discharging. - **is_grid_selling_** (string) - Whether selling to the grid. - **is_grid_buying_** (string) - Whether buying from the grid. - **is_charging_from_grid_** (string) - Whether charging from the grid. - **operation** (object) - Operational status. - **status** (string) - Operation status. - **mode** (string) - Operation mode. - **wintermode** (object) - Winter mode status. - **winter_status** (string) - Winter mode status. - **pcs_fault** (object) - PCS fault status. - **pcs_status** (string) - PCS status. #### Response Example { "statistics": { "pcs_pv_total_power": "0", "batconv_power": "372", "bat_use": "1", "bat_status": "2", "bat_user_soc": "14.58333", "load_power": "361", "load_today": "0.0", "grid_power": "11", "current_day_self_consumption": "94.8", "current_pv_generation_sum": "7415", "current_grid_feed_in_energy": "385" }, "direction": { "is_direct_consuming_": "0", "is_battery_charging_": "0", "is_battery_discharging_": "1", "is_grid_selling_": "0", "is_grid_buying_": "0", "is_charging_from_grid_": "0" }, "operation": { "status": "start", "mode": "1" }, "wintermode": { "winter_status": "on" }, "pcs_fault": { "pcs_status": "pcs_ok" } } ``` -------------------------------- ### Get ESS Home Information (Invalid Auth Key) Source: https://github.com/openwb/core/blob/master/packages/modules/devices/lg/lg/JSON-Beispiele.txt Attempts to retrieve ESS home information with an invalid authentication key. ```APIDOC ## POST /v1/user/essinfo/home (Invalid Auth Key) ### Description Retrieves ESS home information. This example shows the response when an invalid auth_key is provided. ### Method POST ### Endpoint https://192.168.0.248/v1/user/essinfo/home ### Request Body - **auth_key** (string) - Required - The authentication key. ### Request Example { "auth_key": "a7df86bc-092c-11ea-8a59-d84fb802005a" } ### Response #### Error Response (401) - **auth** (string) - Indicates an authentication failure. #### Response Example { "auth": "auth_key failed" } ``` -------------------------------- ### Initialize System Info Display Source: https://github.com/openwb/core/blob/master/web/maintenance/systeminfo.html Sets up interval for data fetching, initializes history storage, loads Chart.js, and prepares chart containers. It defines functions to update historical data and display current system metrics. ```javascript const fetchInterval = 5000; // 5 Sekunden const maxHistoryLength = 60; // z.B. 5 Minuten bei 5s Intervall // Verlaufsspeicher für alle Daten const history = {}; // Chart.js laden const chartJsScript = document.createElement("script"); chartJsScript.src = "chart.umd.min.js"; document.head.appendChild(chartJsScript); // Warten bis Chart.js geladen ist function onChartJsReady(cb) { if (window.Chart) cb(); else chartJsScript.onload = cb; } // Diagramm-Container const charts = {}; // Nur für diese Abschnitte werden Diagramme erstellt: const chartSections = ["cpuLoad", "memory", "storage"]; ``` -------------------------------- ### Binding and Updating Configuration Values Source: https://github.com/openwb/core/wiki/Einstellungs-Seite erstellen Use these lines to correctly associate settings with their respective topics in the broker. The setting name must exactly match the name defined in `config.py`. A help text can be added after the `