Pārlūkot izejas kodu

docs: update all documentation for v2.4.0

- README.md: correct HA min version (2023.6), fix entity names to match
  real API values (Output Source Priority, Charger Source Priority, etc.),
  update automation/card examples, update badges, add Conexo Casa attribution
- CHANGELOG.md: clean up duplicated entries, add v2.4.0 section
- INSTALLATION.md: correct HA min version, correct repo URL, add upgrade note
- QUICKSTART.md: rewrite to reflect User ID auth (not IOT token), clean steps
- CONTROL_FEATURES.md: correct all entity names, API keys, option values
Conexo Casa 4 mēneši atpakaļ
vecāks
revīzija
96e40f0715
5 mainītis faili ar 378 papildinājumiem un 1458 dzēšanām
  1. 86 248
      CHANGELOG.md
  2. 85 566
      CONTROL_FEATURES.md
  3. 64 209
      INSTALLATION.md
  4. 50 86
      QUICKSTART.md
  5. 93 349
      README.md

+ 86 - 248
CHANGELOG.md

@@ -1,25 +1,3 @@
-## [2.3.3] - 2026-03-07
-
-### Fixed
-- **404 Not Found on device settings**: The settings endpoints `/api/device/settings/v1`
-  and `/api/device/settings/update/v1` do not exist on `solar.siseli.com`. Replaced with the
-  correct remote-config API endpoints discovered from the live portal JS bundle:
-  - **Read**: `POST /apis/remote/device/configs/cache/get?deviceId=<id>` (plain `IOT-Token` header)
-  - **Write**: `POST /apis/remote/device/config/write?deviceId=<id>` (body `{deviceId, key, value}`)
-
-### Changed
-- `select.py` — **Operating Mode** select now uses real API key `outputSourcePrioritySetting`
-  with options `Utility First (USO)` / `Solar First (SUB)` / `Solar+Battery First (SBU)`.
-- `select.py` — **Battery Priority** select now uses real API key `chargerSourcePrioritySetting`
-  with options `Solar + Utility (CSO)` / `Solar First (SNU)` / `Solar Only (OSO)`.
-- `switch.py` — **Grid Feed-In** switch maps to `batteryPowerLimitingSetting` (0=OFF, 1=ON).
-- `switch.py` — **Grid Charging** switch maps to `acInputRangeSetting` (0=Appliance/ON, 1=UPS/OFF).
-- `switch.py` — **Backup Mode** switch maps to `outputSourcePrioritySetting` SBU=2 (ON) / SUB=1 (OFF).
-- `api.py` — `get_device_settings` / `fetch_settings` now POST to the correct URL with query
-  parameter and plain `IOT-Token` header (no IOT-Open signing required for this endpoint).
-- `api.py` — `_write_setting` helper added; `set_*` control methods updated with correct
-  API key names and integer value mappings (no longer sending arbitrary string names).
-
 # Changelog
 
 All notable changes to this project will be documented in this file.
@@ -27,272 +5,132 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
-## [2.3.2] - 2026-03-07
+---
 
-### Fixed
-- **`fetch_settings` AttributeError** -- `__init__.py` called `api.fetch_settings()`
-  but `api.py` only exposed `get_device_settings()`. Added `fetch_settings` as a
-  class-level alias so both names work.
-- **Missing control helper methods** -- `select.py` and `switch.py` called five
-  methods that did not exist on `SolarOfThingsAPI`:
-  `set_operating_mode`, `set_battery_priority`, `set_grid_charging`,
-  `set_grid_feed_in`, `set_backup_mode`. All five are now implemented as thin
-  wrappers over `update_device_settings`.
+## [2.4.0] - 2026-05-30
 
-## [2.3.1] - 2026-03-07
+### Added
+- **HACS-compliant directory structure** — all integration files now live under
+  `custom_components/solar_of_things/` as required by HACS. Installing via HACS
+  or manual copy now works without any path adjustments.
+- **Brand asset** — `brand/icon.png` added so the integration displays an icon
+  in the HACS store and HA Integrations page.
+- **Sensor translation keys** — all 14 sensors now use `translation_key` +
+  `has_entity_name = True`, enabling future multi-language support and aligning
+  with HA quality-scale best practices.
 
 ### Fixed
-- **Correct production AppID and server** -- the IOT Open Platform AppID has been
-  corrected to `rBrTRfAPXz` (production) targeting `https://solar.siseli.com`.
-  The previous release used the test-environment AppID (`JO4DAiNeys`) which was
-  only accepted by `test.solar.siseli.com`, causing "account error" (code 20007)
-  for every real user account.
-- **Password is now MD5-hashed before transmission** -- the Siseli portal sends
-  `MD5(plaintext_password)` (lowercase hex) in the login payload. Sending plain
-  text returned code 7 "password error" even with valid credentials. The login
-  method now applies `hashlib.md5(password).hexdigest()` before building the
-  JSON body, matching the portal behaviour confirmed by live API testing.
+- **Missing API methods crash** — `number.py` called `api.set_battery_charge_limit()`,
+  `api.set_battery_discharge_limit()`, and `api.set_grid_charge_limit()` which did not
+  exist in `api.py`. Interacting with any number slider raised an `AttributeError`.
+  All three methods are now implemented.
+- **Select entity state mismatch** — `strings.json` defined state keys
+  (`self_use`, `time_of_use`, `backup`, `grid_tie`, `off_grid`) that did not match
+  the actual API option strings (`Utility First (USO)`, `Solar First (SUB)`, etc.).
+  State translations now match the real API values exactly.
+- **Device registry duplicates** — sensors used `(DOMAIN, station_id, device_id)`
+  as the device identifier while switches, selects, and numbers used the same tuple
+  but in a different evaluation path. All device-level entities now use
+  `(DOMAIN, device_id)` and station-level entities use `(DOMAIN, station_id)`,
+  eliminating duplicate device entries in the device registry.
+- **Re-auth crash on HA 2024.x** — `async_step_reauth` declared `entry_data` as
+  a required argument; HA 2024+ calls it with no argument. Made the parameter
+  optional (`entry_data: dict | None = None`).
 
 ### Changed
-- `API_AUTH_BASE_URL` changed from `https://test.solar.siseli.com` to `https://solar.siseli.com`.
-- `IOT_APP_ID` changed from `JO4DAiNeys` to `rBrTRfAPXz`.
-- `IOT_APP_SECRET_ENC` updated to the production-AppID encrypted secret.
+- `manifest.json`: added `integration_type: hub` (required since HA 2023.6),
+  set `homeassistant: "2023.6.0"` minimum version, updated `codeowners`.
+- `hacs.json`: updated `homeassistant` minimum to `2023.6.0`, removed legacy
+  `zip_release` / `filename` / `domains` fields incompatible with the new layout.
+- `strings.json` / `translations/en.json`: corrected select state keys; added
+  full sensor translation entries (previously absent).
+- `.gitignore`: added `graphify-out/` to exclude local knowledge-graph cache.
 
-## [2.3.0] - 2026-03-07
+---
 
-### Changed
-- **Authentication now uses User ID / Account** instead of email address.
-  The `CONF_EMAIL` config key is replaced by `CONF_USER_ID` (`user_id`).
-  The login payload now sends `{"account": ..., "password": ...}` matching
-  the Siseli portal's account-login flow.
+## [2.3.3] - 2026-03-07
 
 ### Fixed
-- **Fully working IOT Open Platform request signing** — reverse-engineered the
-  complete signing algorithm from the portal `umi.js` bundle:
-  - Secret decryption: `AES-128-CBC(base64(enc_secret), key=MD5(appID)[:16], iv=MD5(appID)[16:])`.
-  - Signature: `MD5(HMAC-SHA256(base64(sorted_qs_headers), decrypted_secret))`.
-  - The algorithm was **live-tested** against `test.solar.siseli.com/apis/login/account`
-    and confirmed to return code `20007` (invalid credentials) rather than the
-    previous code `44` (sign error) — proving the signing is now accepted by the server.
-- **Correct API base URLs**:
-  - Auth/login endpoints: `https://test.solar.siseli.com` (as hardcoded in portal JS).
-  - Data endpoints: `https://solar.siseli.com` (unchanged).
-  - Login path fixed from `/login/account` (404) → `/apis/login/account` (200).
+- **404 Not Found on device settings** — replaced incorrect settings endpoints with
+  the correct remote-config API endpoints discovered from the live portal JS bundle:
+  - **Read**: `POST /apis/remote/device/configs/cache/get?deviceId=<id>`
+  - **Write**: `POST /apis/remote/device/config/write?deviceId=<id>`
+- `select.py` — Operating Mode and Battery Priority selects now use real API keys
+  (`outputSourcePrioritySetting`, `chargerSourcePrioritySetting`) with correct
+  integer value mappings (USO/SUB/SBU, CSO/SNU/OSO).
+- `switch.py` — all three switches map to correct API setting keys.
 
-### Added
-- `API_AUTH_BASE_URL`, `IOT_APP_ID`, `IOT_APP_SECRET_ENC` constants in `const.py`.
-- `_decrypt_app_secret()`, `_compute_iot_sign()`, `_make_signed_headers()` helpers in `api.py`.
-- `pycryptodome>=3.9.0` added to `manifest.json` requirements for AES decryption.
+---
 
-### Migration note
-Existing entries that used `email` for auth will need to re-authenticate:
-Home Assistant will show a re-auth prompt where you enter your **User ID** and password.
-## [2.2.0] - 2026-03-06
+## [2.3.2] - 2026-03-07
 
-### Added
-- **Email + Password authentication** (recommended) — the integration now logs in with Siseli portal credentials (`email`, `password`) and handles the full token lifecycle automatically. Users no longer need to copy IOT tokens from DevTools.
-- **Automatic token refresh** — `SolarOfThingsAPI._ensure_token_valid()` proactively refreshes the access token 5 minutes before expiry using `POST /login/refresh/access/token` (mirroring the portal JS behaviour). Falls back to re-login with stored credentials if the refresh token has also expired.
-- **HA re-auth flow** — if all refresh strategies fail, coordinators call `entry.async_start_reauth()` so HA displays a notification and the user is guided through re-authentication without losing their config.
-- **`on_token_refreshed` callback** — fresh tokens are persisted back to the config entry after every refresh, so the integration survives HA restarts without a new login.
-- **Legacy IOT-token mode preserved** — users who prefer not to store credentials can still paste a token manually; re-auth is triggered when it expires.
-- New `const.py` keys: `CONF_EMAIL`, `CONF_PASSWORD`, `CONF_REFRESH_TOKEN`, `CONF_ACCESS_TOKEN_EXPIRES`, `CONF_REFRESH_TOKEN_EXPIRES`, `API_LOGIN`, `API_REFRESH_TOKEN`, `TOKEN_REFRESH_LEAD_SECONDS`.
-- New config-flow steps: `password`, `token`, `reauth_confirm` (step `user` now offers a mode selector).
-- `TokenExpiredError` and `AuthenticationError` custom exceptions in `api.py`.
+### Fixed
+- `fetch_settings` AttributeError — added class-level alias so both `get_device_settings`
+  and `fetch_settings` work.
+- Five missing control helper methods on `SolarOfThingsAPI` added
+  (`set_operating_mode`, `set_battery_priority`, `set_grid_charging`,
+  `set_grid_feed_in`, `set_backup_mode`).
 
-### Changed
-- `SolarOfThingsAPI.__init__` signature updated: keyword-only arguments (`email`, `password`, `iot_token`, `refresh_token`, etc.).
-- `__init__.py` coordinators now catch `TokenExpiredError` and trigger re-auth instead of silently failing.
-- `strings.json` / `translations/en.json` updated for new flow steps and error messages.
-- `manifest.json` version bumped to **2.2.0** (`config_flow` version bumped to **3**).
+---
 
-### Known issues
-- The `loginType` field value and exact shape of the `/login/account` response are inferred from portal JS analysis; tested against live API but may need adjustment for non-email login types.
+## [2.3.1] - 2026-03-07
 
+### Fixed
+- Correct production AppID `rBrTRfAPXz` targeting `https://solar.siseli.com`.
+  Previous release used the test AppID, causing "account error" for all real users.
+- Password now MD5-hashed before transmission, matching portal behaviour.
 
-## [2.2.0] - 2026-03-06
+---
 
-### Added
-- **Email + Password authentication** (recommended) — logs in automatically; no manual token copying needed.
-- **Automatic token refresh** — proactively refreshes access token 5 min before expiry via `POST /login/refresh/access/token`; falls back to re-login with stored credentials.
-- **HA re-auth flow** — on total token failure, coordinators call `entry.async_start_reauth()` to prompt user without losing config.
-- **`on_token_refreshed` callback** — fresh tokens persisted to config entry after every refresh (survives HA restarts).
-- **Legacy IOT-token mode preserved** — paste-a-token still works; re-auth triggered on expiry.
-- New constants: `CONF_EMAIL`, `CONF_PASSWORD`, `CONF_REFRESH_TOKEN`, `CONF_ACCESS_TOKEN_EXPIRES`, `CONF_REFRESH_TOKEN_EXPIRES`, `API_LOGIN`, `API_REFRESH_TOKEN`, `TOKEN_REFRESH_LEAD_SECONDS`.
-- New config-flow steps: `password`, `token`, `reauth_confirm`; step `user` is now a mode selector.
-- `TokenExpiredError` and `AuthenticationError` custom exceptions in `api.py`.
+## [2.3.0] - 2026-03-07
 
 ### Changed
-- `SolarOfThingsAPI.__init__` uses keyword-only arguments.
-- Coordinators catch `TokenExpiredError` and trigger re-auth.
-- `strings.json`/`translations/en.json` updated for new flow steps.
-- `manifest.json` version **2.2.0**, config flow `VERSION = 3`.
+- Authentication now uses **User ID / Account** instead of email address.
 
-## [2.1.1] - 2026-03-05
-
-### Added
-- `.github/PULL_REQUEST_TEMPLATE.md` — standardised PR template for HACS default submission.
+### Fixed
+- Fully working IOT Open Platform request signing (AES-128-CBC + HMAC-SHA256 + MD5).
+- Correct API base URLs and login path.
 
-### Changed
-- `hacs.json` updated: added all integration platforms (`sensor`, `number`, `select`, `switch`), enabled `zip_release: true`, and set `filename: solar-of-things-ha.zip` so HACS fetches the correct release asset.
-- `manifest.json` version bumped to 2.1.1.
+---
 
-## [2.1.0] - 2026-02-26
+## [2.2.0] - 2026-03-06
 
 ### Added
-- Auto-discover all device IDs under a station using `POST /apis/device/list` (no need to manually enter deviceId).
-- Config flow support for optional `device_id`:
-  - Leave blank to create entities for *all* devices found under the station.
-  - Provide a `device_id` to restrict HA entities to a single device.
+- Email + Password authentication with automatic token refresh.
+- HA re-auth flow on token expiry.
+- `on_token_refreshed` callback persists tokens to config entry.
+- Legacy IOT-token mode preserved.
 
-### Changed
-- Manifest metadata updated (documentation/issue tracker URLs) and integration version bumped to 2.1.0.
+---
 
-## [2.0.0] - 2024-02-10
+## [2.1.1] - 2026-03-05
 
 ### Added
-- **Control Features**: Full system control capabilities
-  - Number entities for battery charge/discharge limits (0-100%)
-  - Number entity for grid charge power limit (0-5000W)
-  - Select entity for operating mode (Self-Use, Time-of-Use, Backup, Grid-Tie, Off-Grid)
-  - Select entity for battery priority (Solar First, Battery First, Grid First)
-  - Switch entity for grid charging enable/disable
-  - Switch entity for grid feed-in enable/disable
-  - Switch entity for backup mode enable/disable
-- Settings API integration for reading and updating device configuration
-- Comprehensive control documentation (CONTROL_FEATURES.md)
-- Automation examples for time-of-use optimization
-- Weather-based battery management examples
-- Emergency backup preparation automations
-- Dashboard control panel examples
+- PR template for HACS default submission.
 
 ### Changed
-- Updated coordinator to fetch device settings
-- Enhanced API client with control methods
-- Updated README with control features documentation
-- Extended translations for new entities
-
-### Technical Details
-- New platforms: Number, Select, Switch
-- API endpoints: `/api/device/settings/v1`, `/api/device/settings/update/v1`
-- Immediate coordinator refresh after control changes
-- Proper error handling for control operations
-
-## [1.0.0] - 2024-02-10
-
-### Added
-- Initial release of Solar of Things integration
-- Real-time sensor monitoring via API
-- Support for multiple stations/devices configuration
-- Config flow for easy setup via UI
-- Comprehensive sensor suite:
-  - PV Input Power
-  - AC Output Power
-  - Battery Discharge/Charge Current
-  - Battery Voltage
-  - Battery State of Charge
-  - Battery Power (calculated)
-  - Grid Feed-in Power
-  - Grid Import Power (calculated)
-  - Load Power
-  - Monthly PV Generation (when station ID provided)
-- Auto-calculated metrics for battery power and grid usage
-- 5-minute update interval with configurable options
-- Home Assistant Energy Dashboard compatibility
-- Device information for each configured station
-- Proper device classes and state classes for all sensors
-- Error handling and connection validation
-- Support for IOT-Token authentication
-- Multi-station support through multiple config entries
-- Comprehensive documentation and examples
-
-### Technical Details
-- API integration with Solar of Things (Siseli) platform
-- Uses time-series and monthly summary API endpoints
-- Automatic data fetching via coordinator pattern
-- Proper unit conversions (W, A, V, kWh, %)
-- Timezone handling (GMT+8)
-- Request throttling and error recovery
-
-## [Unreleased]
-
-### Planned Features
-- Historical data import for energy statistics
-- Configurable calculation methods for derived sensors
-- Additional monthly statistics sensors
-- Support for multiple devices per station
-- Advanced battery cycle tracking
-- Cost calculation sensors
-- Solar forecast integration
-- Customizable sensor polling rates per sensor
-- Support for additional inverter models
-- Webhook support for real-time updates
-- MQTT integration option
-- RESTful sensor alternatives
-- Diagnostic sensors for API health
-- Binary sensors for status alerts
-
-### Known Issues
-- Grid import calculation may not exactly match utility bills
-- Monthly API doesn't track grid import/export (always returns 0)
-- Timezone hardcoded to Asia/Manila (GMT+8)
-- Token expiration requires manual renewal
-- No retry logic for failed API calls (handled by coordinator)
-
-### Considerations for Future Versions
-- Add support for custom timezone configuration
-- Implement automatic token refresh mechanism
-- Add support for historical data backfill
-- Create services for on-demand data refresh
-- Add diagnostic mode for troubleshooting
-- Support for multiple simultaneous time ranges
-- Caching layer for API responses
-- Rate limiting protection
-- Support for alternative authentication methods
+- `hacs.json` and `manifest.json` metadata updates.
 
 ---
 
-## Version History
-
-### How to Upgrade
-
-To upgrade to a new version:
-
-1. **Via HACS**:
-   - Go to HACS → Integrations
-   - Find "Solar of Things"
-   - Click "Update"
-   - Restart Home Assistant
-
-2. **Manual**:
-   - Download the new version
-   - Replace files in `/config/custom_components/solar_of_things/`
-   - Restart Home Assistant
-
-### Breaking Changes
-
-None yet (version 1.0.0)
-
-### Migration Guide
+## [2.1.0] - 2026-02-26
 
-None required for version 1.0.0
+### Added
+- Auto-discover all device IDs under a station via `POST /apis/device/list`.
+- Optional `device_id` in config flow (blank = auto-discover all devices).
 
 ---
 
-## Release Notes Format
+## [2.0.0] - 2024-02-10
 
-Each release includes:
-- **Added**: New features
-- **Changed**: Changes in existing functionality
-- **Deprecated**: Soon-to-be removed features
-- **Removed**: Removed features
-- **Fixed**: Bug fixes
-- **Security**: Security improvements
+### Added
+- Full system control: number sliders, select dropdowns, switches.
+- Settings API integration.
 
 ---
 
-## Support
+## [1.0.0] - 2024-02-10
 
-For questions about changes or upgrade issues:
-- Check the [README](README.md)
-- Review [INSTALLATION.md](INSTALLATION.md)
-- Open an issue on GitHub
+### Added
+- Initial release — monitoring sensors, config flow, multi-station support,
+  Energy Dashboard compatibility.

+ 85 - 566
CONTROL_FEATURES.md

@@ -1,617 +1,136 @@
-# Solar System Control Features
+# Control Features
 
-## Overview
+This integration exposes 8 control entities that write directly to your inverter
+via the Siseli remote-config API.
 
-The Solar of Things integration now supports **full control** of your solar system settings through Home Assistant. You can adjust battery limits, change operating modes, and control grid interactions directly from your dashboard or automations.
+> Controls require your device and Siseli account to support the settings API.
+> Read settings are fetched every 5 minutes alongside telemetry.
 
 ---
 
-## 🎛️ Control Entities
+## Number Entities (Sliders)
 
-### Number Entities (Sliders)
+### Battery Charge Limit
+**Entity:** `number.{device}_battery_charge_limit`  
+**API key:** `batteryChargeLimit`  
+**Range:** 0 – 100 %  
+Sets the maximum State of Charge the inverter will charge the battery to.
 
-#### 1. **Battery Charge Limit**
-- **Type**: Number (0-100%)
-- **Description**: Maximum battery charge level
-- **Use Case**: Preserve battery health by limiting charge to 90%
-- **Entity**: `number.solar_station_xxxxx_battery_charge_limit`
+### Battery Discharge Limit
+**Entity:** `number.{device}_battery_discharge_limit`  
+**API key:** `batteryDischargeLimit`  
+**Range:** 0 – 100 %  
+Sets the minimum SOC at which the inverter stops discharging the battery.
+Acts as a floor for battery protection.
 
-```yaml
-# Set battery charge limit to 90%
-service: number.set_value
-target:
-  entity_id: number.solar_station_xxxxx_battery_charge_limit
-data:
-  value: 90
-```
-
-#### 2. **Battery Discharge Limit**
-- **Type**: Number (0-100%)
-- **Description**: Minimum battery level before stopping discharge
-- **Use Case**: Keep battery reserve for emergencies
-- **Entity**: `number.solar_station_xxxxx_battery_discharge_limit`
-
-```yaml
-# Don't discharge below 20%
-service: number.set_value
-target:
-  entity_id: number.solar_station_xxxxx_battery_discharge_limit
-data:
-  value: 20
-```
-
-#### 3. **Grid Charge Limit**
-- **Type**: Number (0-5000W)
-- **Description**: Maximum power to draw from grid for battery charging
-- **Use Case**: Charge from grid during off-peak hours
-- **Entity**: `number.solar_station_xxxxx_grid_charge_limit`
-
-```yaml
-# Allow 2000W grid charging
-service: number.set_value
-target:
-  entity_id: number.solar_station_xxxxx_grid_charge_limit
-data:
-  value: 2000
-```
-
----
-
-### Select Entities (Dropdowns)
-
-#### 1. **Operating Mode**
-- **Type**: Select
-- **Options**:
-  - **Self-Use**: Maximize self-consumption
-  - **Time-of-Use**: Optimize for electricity rates
-  - **Backup**: Prioritize battery reserve
-  - **Grid-Tie**: Prioritize grid export
-  - **Off-Grid**: Independent operation
-- **Entity**: `select.solar_station_xxxxx_operating_mode`
-
-```yaml
-# Switch to Time-of-Use mode
-service: select.select_option
-target:
-  entity_id: select.solar_station_xxxxx_operating_mode
-data:
-  option: "Time-of-Use"
-```
-
-#### 2. **Battery Priority**
-- **Type**: Select
-- **Options**:
-  - **Solar First**: Use solar before battery
-  - **Battery First**: Use battery before solar
-  - **Grid First**: Use grid before battery/solar
-- **Entity**: `select.solar_station_xxxxx_battery_priority`
-
-```yaml
-# Prioritize solar energy
-service: select.select_option
-target:
-  entity_id: select.solar_station_xxxxx_battery_priority
-data:
-  option: "Solar First"
-```
+### Grid Charge Limit
+**Entity:** `number.{device}_grid_charge_limit`  
+**API key:** `gridChargeLimit`  
+**Range:** 0 – 5000 W, step 100 W  
+Maximum grid power the inverter is allowed to use for battery charging.
+Set to 0 to disable grid charging via this limit.
 
 ---
 
-### Switch Entities (On/Off)
+## Select Entities (Dropdowns)
 
-#### 1. **Grid Charging**
-- **Type**: Switch
-- **Description**: Allow battery charging from grid
-- **Use Case**: Enable during cheap electricity periods
-- **Entity**: `switch.solar_station_xxxxx_grid_charging`
+### Output Source Priority
+**Entity:** `select.{device}_output_source_priority`  
+**API key:** `outputSourcePrioritySetting`
 
-```yaml
-# Enable grid charging
-service: switch.turn_on
-target:
-  entity_id: switch.solar_station_xxxxx_grid_charging
-```
-
-#### 2. **Grid Feed-In**
-- **Type**: Switch
-- **Description**: Allow exporting excess power to grid
-- **Use Case**: Disable when grid feed-in is not compensated
-- **Entity**: `switch.solar_station_xxxxx_grid_feed_in`
+| Option | API value | Description |
+|---|---|---|
+| Utility First (USO) | 0 | Grid is the primary power source; solar and battery supplement |
+| Solar First (SUB) | 1 | Solar is primary; grid fills the gap; battery charges from surplus |
+| Solar+Battery First (SBU) | 2 | Solar and battery power the load; grid only as last resort |
 
-```yaml
-# Disable grid export
-service: switch.turn_off
-target:
-  entity_id: switch.solar_station_xxxxx_grid_feed_in
-```
+### Charger Source Priority
+**Entity:** `select.{device}_charger_source_priority`  
+**API key:** `chargerSourcePrioritySetting`
 
-#### 3. **Backup Mode**
-- **Type**: Switch
-- **Description**: Reserve battery for emergencies
-- **Use Case**: Prepare for expected power outage
-- **Entity**: `switch.solar_station_xxxxx_backup_mode`
-
-```yaml
-# Enable backup reserve
-service: switch.turn_on
-target:
-  entity_id: switch.solar_station_xxxxx_backup_mode
-```
+| Option | API value | Description |
+|---|---|---|
+| Solar + Utility (CSO) | 0 | Both solar and grid charge the battery; utility has priority |
+| Solar First (SNU) | 1 | Solar charges the battery first; grid fills the shortfall |
+| Solar Only (OSO) | 2 | Only solar charges the battery; no grid charging |
 
 ---
 
-## 🤖 Automation Examples
-
-### 1. Time-of-Use Optimization
-
-Charge from grid during cheap hours, discharge during peak hours:
-
-```yaml
-automation:
-  # Charge from grid during cheap period (midnight-6am)
-  - alias: "Solar: Charge from Grid (Off-Peak)"
-    trigger:
-      - platform: time
-        at: "00:00:00"
-    action:
-      - service: switch.turn_on
-        target:
-          entity_id: switch.solar_station_xxxxx_grid_charging
-      - service: number.set_value
-        target:
-          entity_id: number.solar_station_xxxxx_grid_charge_limit
-        data:
-          value: 3000  # 3kW charging
-
-  # Stop grid charging after cheap period
-  - alias: "Solar: Stop Grid Charging (Peak)"
-    trigger:
-      - platform: time
-        at: "06:00:00"
-    action:
-      - service: switch.turn_off
-        target:
-          entity_id: switch.solar_station_xxxxx_grid_charging
-      - service: number.set_value
-        target:
-          entity_id: number.solar_station_xxxxx_grid_charge_limit
-        data:
-          value: 0
-```
+## Switch Entities
 
-### 2. Weather-Based Battery Management
+### Grid Charging (AC Input Range)
+**Entity:** `switch.{device}_grid_charging_ac_input_range`  
+**API key:** `acInputRangeSetting`
 
-Adjust battery limits based on weather forecast:
+| State | API value | Behaviour |
+|---|---|---|
+| ON | 0 | **Appliance mode** — wide voltage range, grid charging allowed |
+| OFF | 1 | **UPS mode** — narrow voltage range, stricter bypass |
 
-```yaml
-automation:
-  - alias: "Solar: Adjust for Cloudy Weather"
-    trigger:
-      - platform: state
-        entity_id: weather.home
-        attribute: condition
-        to: "cloudy"
-    action:
-      # Lower discharge limit on cloudy days
-      - service: number.set_value
-        target:
-          entity_id: number.solar_station_xxxxx_battery_discharge_limit
-        data:
-          value: 40  # Keep 40% reserve
-      
-      # Enable grid charging if needed
-      - service: switch.turn_on
-        target:
-          entity_id: switch.solar_station_xxxxx_grid_charging
+### Grid Feed-In
+**Entity:** `switch.{device}_grid_feed_in`  
+**API key:** `batteryPowerLimitingSetting`
 
-  - alias: "Solar: Adjust for Sunny Weather"
-    trigger:
-      - platform: state
-        entity_id: weather.home
-        attribute: condition
-        to: "sunny"
-    action:
-      # Normal discharge limit on sunny days
-      - service: number.set_value
-        target:
-          entity_id: number.solar_station_xxxxx_battery_discharge_limit
-        data:
-          value: 10
-      
-      # Disable grid charging (solar is sufficient)
-      - service: switch.turn_off
-        target:
-          entity_id: switch.solar_station_xxxxx_grid_charging
-```
+| State | API value | Behaviour |
+|---|---|---|
+| ON | 1 | Grid switch enabled — excess power exported to grid |
+| OFF | 0 | Grid switch disabled — no feed-in |
 
-### 3. Emergency Backup Preparation
+### Backup Mode (SBU Priority)
+**Entity:** `switch.{device}_backup_mode_sbu_priority`  
+**API key:** `outputSourcePrioritySetting`
 
-Prepare for storms or power outages:
+| State | API value | Behaviour |
+|---|---|---|
+| ON | 2 (SBU) | Solar+Battery first — battery reserved for outages |
+| OFF | 1 (SUB) | Solar first — grid supplements when solar is insufficient |
 
-```yaml
-automation:
-  - alias: "Solar: Storm Preparation"
-    trigger:
-      - platform: state
-        entity_id: sensor.weather_alert
-        to: "storm_warning"
-    action:
-      # Enable backup mode
-      - service: switch.turn_on
-        target:
-          entity_id: switch.solar_station_xxxxx_backup_mode
-      
-      # Set high charge limit
-      - service: number.set_value
-        target:
-          entity_id: number.solar_station_xxxxx_battery_charge_limit
-        data:
-          value: 100
-      
-      # Set high discharge limit (preserve battery)
-      - service: number.set_value
-        target:
-          entity_id: number.solar_station_xxxxx_battery_discharge_limit
-        data:
-          value: 50
-      
-      # Enable grid charging to top up
-      - service: switch.turn_on
-        target:
-          entity_id: switch.solar_station_xxxxx_grid_charging
-      
-      # Notify user
-      - service: notify.mobile_app
-        data:
-          title: "Solar System: Storm Preparation"
-          message: "Battery is being prepared for potential outage"
-```
+> **Note:** Backup Mode and Output Source Priority share the same API key.
+> Turning Backup Mode ON changes Output Source Priority to SBU, and vice versa.
 
-### 4. Dynamic Operating Mode
+---
 
-Switch modes based on electricity prices:
+## Automation Examples
 
+### Maximise self-consumption during the day
 ```yaml
 automation:
-  - alias: "Solar: Peak Price Mode"
+  - alias: "Solar — Solar First during daylight"
     trigger:
-      - platform: numeric_state
-        entity_id: sensor.electricity_price
-        above: 0.25  # High price threshold
+      - platform: sun
+        event: sunrise
     action:
       - service: select.select_option
         target:
-          entity_id: select.solar_station_xxxxx_operating_mode
+          entity_id: select.1_inverter_output_source_priority
         data:
-          option: "Time-of-Use"
-      
-      # Maximize battery usage during peak
-      - service: select.select_option
-        target:
-          entity_id: select.solar_station_xxxxx_battery_priority
-        data:
-          option: "Battery First"
+          option: "Solar First (SUB)"
 
-  - alias: "Solar: Off-Peak Mode"
+  - alias: "Solar — Utility First at night"
     trigger:
-      - platform: numeric_state
-        entity_id: sensor.electricity_price
-        below: 0.10  # Low price threshold
+      - platform: sun
+        event: sunset
     action:
       - service: select.select_option
         target:
-          entity_id: select.solar_station_xxxxx_operating_mode
+          entity_id: select.1_inverter_output_source_priority
         data:
-          option: "Self-Use"
-      
-      # Prioritize solar during off-peak
-      - service: select.select_option
-        target:
-          entity_id: select.solar_station_xxxxx_battery_priority
-        data:
-          option: "Solar First"
+          option: "Utility First (USO)"
 ```
 
-### 5. Battery Health Protection
-
-Extend battery life with charge cycling:
-
+### Protect battery on cloudy days
 ```yaml
 automation:
-  - alias: "Solar: Weekly Battery Calibration"
+  - alias: "Solar — Raise discharge floor on low solar"
     trigger:
-      - platform: time
-        at: "02:00:00"
-    condition:
-      - condition: time
-        weekday:
-          - sun  # Every Sunday
+      - platform: numeric_state
+        entity_id: sensor.1_inverter_pv_input_power
+        below: 50
+        for: "00:30:00"
     action:
-      # Full charge cycle
       - service: number.set_value
         target:
-          entity_id: number.solar_station_xxxxx_battery_charge_limit
+          entity_id: number.1_inverter_battery_discharge_limit
         data:
-          value: 100
-      
-      - delay:
-          hours: 6
-      
-      # Return to normal (90% max)
-      - service: number.set_value
-        target:
-          entity_id: number.solar_station_xxxxx_battery_charge_limit
-        data:
-          value: 90
-```
-
----
-
-## 📊 Dashboard Examples
-
-### Control Panel Card
-
-```yaml
-type: entities
-title: Solar System Controls
-entities:
-  - entity: select.solar_station_xxxxx_operating_mode
-    name: Operating Mode
-  
-  - entity: select.solar_station_xxxxx_battery_priority
-    name: Battery Priority
-  
-  - type: divider
-  
-  - entity: number.solar_station_xxxxx_battery_charge_limit
-    name: Charge Limit
-  
-  - entity: number.solar_station_xxxxx_battery_discharge_limit
-    name: Discharge Limit
-  
-  - entity: number.solar_station_xxxxx_grid_charge_limit
-    name: Grid Charge Power
-  
-  - type: divider
-  
-  - entity: switch.solar_station_xxxxx_grid_charging
-    name: Grid Charging
-  
-  - entity: switch.solar_station_xxxxx_grid_feed_in
-    name: Grid Feed-In
-  
-  - entity: switch.solar_station_xxxxx_backup_mode
-    name: Backup Mode
-```
-
-### Battery Management Card
-
-```yaml
-type: vertical-stack
-cards:
-  - type: gauge
-    entity: sensor.solar_station_xxxxx_battery_state_of_charge
-    name: Battery Level
-    min: 0
-    max: 100
-    needle: true
-    segments:
-      - from: 0
-        color: "#db4437"
-      - from: 20
-        color: "#ff9800"
-      - from: 50
-        color: "#ffc107"
-      - from: 80
-        color: "#0f9d58"
-  
-  - type: entities
-    title: Battery Controls
-    entities:
-      - entity: number.solar_station_xxxxx_battery_charge_limit
-        name: Max Charge
-      - entity: number.solar_station_xxxxx_battery_discharge_limit
-        name: Min Discharge
-      - entity: switch.solar_station_xxxxx_backup_mode
-        name: Backup Reserve
-```
-
-### Quick Actions Card
-
-```yaml
-type: horizontal-stack
-cards:
-  - type: button
-    name: Self-Use Mode
-    icon: mdi:solar-power
-    tap_action:
-      action: call-service
-      service: select.select_option
-      target:
-        entity_id: select.solar_station_xxxxx_operating_mode
-      data:
-        option: "Self-Use"
-  
-  - type: button
-    name: Backup Mode
-    icon: mdi:battery-lock
-    tap_action:
-      action: call-service
-      service: switch.turn_on
-      target:
-        entity_id: switch.solar_station_xxxxx_backup_mode
-  
-  - type: button
-    name: Grid Export
-    icon: mdi:transmission-tower-export
-    tap_action:
-      action: call-service
-      service: switch.toggle
-      target:
-        entity_id: switch.solar_station_xxxxx_grid_feed_in
+          value: 30
 ```
-
----
-
-## ⚠️ Important Notes
-
-### API Limitations
-
-**Note**: The control API endpoints (`/api/device/settings/v1` and `/api/device/settings/update/v1`) are **assumed endpoints** based on common IoT patterns. You will need to:
-
-1. **Verify** these endpoints exist in the actual Solar of Things API
-2. **Test** with your device to confirm functionality
-3. **Adjust** the API implementation based on actual response formats
-
-### Finding Actual Control Endpoints
-
-To find the real control endpoints:
-
-1. Open https://solar.siseli.com
-2. Go to settings/control page on the web interface
-3. Open browser Developer Tools (F12) → Network tab
-4. Make a settings change (e.g., adjust battery limit)
-5. Find the API request in the Network tab
-6. Note the:
-   - Endpoint URL
-   - Request method (POST/PUT)
-   - Payload format
-   - Response format
-
-Then update `api.py` with the correct endpoints and formats.
-
-### Safety Considerations
-
-⚠️ **Always test control features carefully:**
-
-- Start with non-critical settings
-- Monitor system behavior after changes
-- Keep battery discharge limits reasonable (don't go below 10-20%)
-- Don't exceed manufacturer specifications
-- Have manual override capability
-
-### Permissions
-
-Some settings may require:
-- Admin/installer level access
-- Special authentication
-- Firmware version requirements
-
-Check your Solar of Things account permissions.
-
----
-
-## 🔧 Troubleshooting
-
-### Settings Not Changing
-
-1. **Check logs**: Settings → System → Logs
-2. **Verify device_id**: Must be correct for control operations
-3. **Test API**: Try changing settings on solar.siseli.com web interface
-4. **Check permissions**: Account may not have control access
-
-### Control Entities Not Appearing
-
-1. **Check device_id**: Required for control entities
-2. **Restart HA**: After integration update
-3. **Check coordinator**: Ensure settings are being fetched
-4. **Review logs**: Look for error messages
-
-### Values Not Updating
-
-- Wait 5 minutes for next coordinator refresh
-- Or restart Home Assistant to force update
-- Check if web interface shows updated values
-
----
-
-## 📝 Customization
-
-You can customize available options by editing the integration files:
-
-**Operating Modes** (`select.py`):
-```python
-OPERATING_MODES = [
-    "Self-Use",
-    "Time-of-Use",
-    "Backup",
-    "Grid-Tie",
-    "Off-Grid",
-    # Add more modes here
-]
-```
-
-**Battery Priority** (`select.py`):
-```python
-BATTERY_PRIORITY_MODES = [
-    "Solar First",
-    "Battery First",
-    "Grid First",
-    # Add more priorities here
-]
-```
-
----
-
-## 🚀 Advanced Usage
-
-### Script for Quick Mode Switching
-
-```yaml
-script:
-  solar_storm_mode:
-    alias: "Solar: Storm Mode"
-    sequence:
-      - service: switch.turn_on
-        target:
-          entity_id: switch.solar_station_xxxxx_backup_mode
-      - service: number.set_value
-        target:
-          entity_id: number.solar_station_xxxxx_battery_discharge_limit
-        data:
-          value: 50
-      - service: switch.turn_on
-        target:
-          entity_id: switch.solar_station_xxxxx_grid_charging
-      - service: notify.mobile_app
-        data:
-          message: "Solar system in storm protection mode"
-  
-  solar_normal_mode:
-    alias: "Solar: Normal Mode"
-    sequence:
-      - service: switch.turn_off
-        target:
-          entity_id: switch.solar_station_xxxxx_backup_mode
-      - service: number.set_value
-        target:
-          entity_id: number.solar_station_xxxxx_battery_discharge_limit
-        data:
-          value: 10
-      - service: select.select_option
-        target:
-          entity_id: select.solar_station_xxxxx_operating_mode
-        data:
-          option: "Self-Use"
-```
-
-### Scene Integration
-
-```yaml
-scene:
-  - name: Solar Economy Mode
-    entities:
-      select.solar_station_xxxxx_operating_mode: "Time-of-Use"
-      select.solar_station_xxxxx_battery_priority: "Grid First"
-      switch.solar_station_xxxxx_grid_feed_in: "on"
-  
-  - name: Solar Backup Mode
-    entities:
-      select.solar_station_xxxxx_operating_mode: "Backup"
-      switch.solar_station_xxxxx_backup_mode: "on"
-      number.solar_station_xxxxx_battery_discharge_limit: 50
-```
-
----
-
-**Full control of your solar system is now at your fingertips!** 🎉

+ 64 - 209
INSTALLATION.md

@@ -1,244 +1,99 @@
 # Installation Guide
 
-## Prerequisites
-
-- Home Assistant (2023.1 or newer recommended)
-- Access to your Home Assistant configuration directory
-- Solar of Things account with at least one configured station
-
-## Step-by-Step Installation
-
-### Method 1: HACS Installation (Recommended)
-
-1. **Install HACS** (if not already installed)
-   - Follow the official HACS installation guide: https://hacs.xyz/docs/setup/download
-
-2. **Add Custom Repository**
-   - Open HACS in your Home Assistant interface
-   - Click on "Integrations"
-   - Click the three dots (⋮) in the top right corner
-   - Select "Custom repositories"
-   - Add repository URL: `https://github.com/conexocasa/solar-of-things-ha`
-   - Category: Integration
-   - Click "Add"
-
-3. **Install the Integration**
-   - Find "Solar of Things" in HACS
-   - Click "Download"
-   - Restart Home Assistant
-
-4. **Configure the Integration**
-   - Go to Settings → Devices & Services
-   - Click "+ Add Integration"
-   - Search for "Solar of Things"
-   - Follow the configuration steps
-
-### Method 2: Manual Installation
-
-1. **Download the Integration**
-   ```bash
-   # SSH into your Home Assistant instance or use the File Editor add-on
-   cd /config/custom_components/
-   git clone https://github.com/conexocasa/solar-of-things-ha.git solar_of_things
-   ```
-
-   Or download and extract the ZIP file:
-   - Download the latest release from GitHub
-   - Extract the `solar_of_things` folder
-   - Copy it to `/config/custom_components/`
-
-2. **Verify Installation**
-   Your directory structure should look like:
-   ```
-   /config/
-   └── custom_components/
-       └── solar_of_things/
-           ├── __init__.py
-           ├── api.py
-           ├── config_flow.py
-           ├── const.py
-           ├── manifest.json
-           ├── sensor.py
-           ├── strings.json
-           └── translations/
-               └── en.json
-   ```
-
-3. **Restart Home Assistant**
-   - Go to Settings → System → Restart
-   - Or use the command: `ha core restart`
-
-4. **Add the Integration**
-   - Go to Settings → Devices & Services
-   - Click "+ Add Integration"
-   - Search for "Solar of Things"
-   - Enter your credentials
-
-## Finding Your Credentials
-
-### IOT Token
+## Requirements
 
-1. Open https://solar.siseli.com in your browser
-2. Log in to your account
-3. Press `F12` to open Developer Tools
-4. Click on the **Network** tab
-5. Refresh the page (`Ctrl+R` or `Cmd+R`)
-6. Look for API requests (you can filter by typing "api" in the filter box)
-7. Click on any request and look at the **Request Headers** section
-8. Find `IOT-Token` and copy its value
+- Home Assistant **2023.6** or newer
+- Active account at [solar.siseli.com](https://solar.siseli.com)
+- Network access from HA to `https://solar.siseli.com`
 
-**Example:**
-```
-IOT-Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
-```
+---
 
-### Device ID and Station ID
+## Method 1: HACS (Recommended)
 
-While still in the Network tab:
+1. **Install HACS** if not already installed → [hacs.xyz](https://hacs.xyz)
 
-1. Look for requests to endpoints like:
-   - `/apis/device/list`
-   - `/apis/deviceState/simple/attribute/keys/history/v1`
-   - `/apis/stationOverView/stateAttributeSummary/category/yearly`
+2. Open **HACS → Integrations** in the HA sidebar.
 
-2. Click on a request and look at the **Payload** or **Request** section
+3. Click **⋮** (top-right) → **Custom repositories**.
 
-3. Find values like:
-   ```json
-   {
-     "deviceId": "123456789012345678",
-     "stationId": "987654321098765432"
-   }
+4. Add:
+   ```
+   https://github.com/Conexo-Casa/solar-of-things-ha
    ```
+   Category: **Integration** → **Add**.
 
-**Note:** These are 18-digit numbers. Make sure to copy them exactly!
+5. Search **Solar of Things** → **Download**.
 
-## Configuration Options
+6. **Restart Home Assistant.**
 
-When adding the integration, you'll be prompted for:
+7. Go to **Settings → Devices & Services → + Add Integration** → search **Solar of Things**.
 
-### Required:
-- **IOT Token**: Your authentication token from the Siseli portal
+---
 
-### Required:
-- **Station ID**: Required (used to auto-discover your device IDs)
+## Method 2: Manual
 
-### Optional:
-- **Device ID**: Optional; set it only if you want to restrict Home Assistant entities to a single device under the station
+1. Download the latest release ZIP from:
+   **[github.com/Conexo-Casa/solar-of-things-ha/releases/latest](https://github.com/Conexo-Casa/solar-of-things-ha/releases/latest)**
 
-### Update Interval:
-- Default: 5 minutes
-- Can be changed in integration options (Settings → Devices & Services → Solar of Things → Configure)
-- Recommended range: 1-60 minutes
+2. Extract and copy the `solar_of_things` folder to your HA config directory:
+   ```
+   /config/custom_components/solar_of_things/
+   ```
 
-## Adding Multiple Stations
+   The final structure must be:
+   ```
+   /config/custom_components/solar_of_things/
+   ├── __init__.py
+   ├── api.py
+   ├── config_flow.py
+   ├── const.py
+   ├── manifest.json
+   ├── number.py
+   ├── select.py
+   ├── sensor.py
+   ├── strings.json
+   ├── switch.py
+   └── translations/
+       └── en.json
+   ```
 
-If you have multiple solar stations:
+3. **Restart Home Assistant.**
 
-1. Add the integration once for the first station
-2. Go back to Settings → Devices & Services
-3. Click "+ Add Integration" again
-4. Search for "Solar of Things"
-5. Enter the credentials for your second station
-6. Repeat for each additional station
+4. Go to **Settings → Devices & Services → + Add Integration** → search **Solar of Things**.
 
-Each station will appear as a separate device in Home Assistant.
+---
 
 ## Verifying Installation
 
-After installation and configuration:
-
-1. Go to **Settings** → **Devices & Services**
-2. Find "Solar of Things" in the integrations list
-3. Click on it to see your configured stations
-4. Click on a station to see all available sensors
-5. Sensors should start showing data within 5-10 minutes
-
-### Expected Sensors
+After restarting, go to **Settings → System → Logs**. If you see a line like:
 
-For each configured station, you should see:
-
-**Real-time sensors** (if Device ID provided):
-- PV Input Power
-- AC Output Power
-- Battery Discharge Current
-- Battery Charging Current
-- Battery Voltage
-- Battery Power
-- Battery State of Charge
-- Grid Feed-in Power
-- Grid Import Power
-- Load Power
-
-**Monthly sensors** (if Station ID provided):
-- Monthly PV Generated
-
-## Troubleshooting Installation
-
-### Integration Not Showing Up
-
-1. **Check file structure**: Ensure all files are in `/config/custom_components/solar_of_things/`
-2. **Check file permissions**: Files should be readable by the Home Assistant user
-3. **Check logs**: Go to Settings → System → Logs and search for "solar_of_things"
-4. **Clear browser cache**: Sometimes the UI needs a hard refresh (`Ctrl+Shift+R`)
-
-### "Cannot Connect" Error
-
-- Verify your IOT Token hasn't expired (tokens may expire after some time)
-- Check your Device ID and Station ID are correct (18-digit numbers)
-- Ensure Home Assistant can reach https://solar.siseli.com (check firewall/network)
-- Get a fresh IOT Token from the Siseli portal
-
-### Sensors Not Updating
-
-1. Wait at least 5-10 minutes after initial configuration
-2. Check if your solar system is online at solar.siseli.com
-3. Verify the update interval in integration options
-4. Check Home Assistant logs for errors
-
-### Permission Denied Errors
-
-If you see permission errors in logs:
-```bash
-# SSH into Home Assistant
-cd /config/custom_components/
-chmod -R 755 solar_of_things/
-chown -R homeassistant:homeassistant solar_of_things/
+```
+Setting up custom_components.solar_of_things
 ```
 
-## Uninstalling
-
-To remove the integration:
-
-1. Go to Settings → Devices & Services
-2. Find "Solar of Things"
-3. Click the three dots (⋮) next to the integration
-4. Select "Delete"
-5. Confirm deletion
+with no errors, the component loaded correctly.
 
-To completely remove the files:
-```bash
-rm -rf /config/custom_components/solar_of_things/
-```
+---
 
-Then restart Home Assistant.
+## Upgrading
 
-## Next Steps
+### Via HACS
+1. HACS → Integrations → find Solar of Things → **Update**.
+2. Restart Home Assistant.
 
-After successful installation:
+### Manual
+1. Download the new release ZIP.
+2. Replace the contents of `/config/custom_components/solar_of_things/`.
+3. Restart Home Assistant.
 
-1. [Configure Energy Dashboard](README.md#energy-dashboard)
-2. [Create automations](README.md#automation-example)
-3. [Add Lovelace cards](README.md#lovelace-card-example)
-4. Set up notifications for low battery or high solar production
+> **Note:** When upgrading from v2.3.x or earlier, the config entry will be
+> automatically migrated. No re-authentication is needed if you already use
+> User ID + Password auth.
 
-## Getting Help
+---
 
-If you encounter issues:
+## Uninstalling
 
-1. Check the [Troubleshooting section](README.md#troubleshooting) in README
-2. Review Home Assistant logs for error messages
-3. Open an issue on GitHub with:
-   - Your Home Assistant version
-   - Error messages from logs
-   - Steps to reproduce the problem
+1. **Settings → Devices & Services → Solar of Things → Delete**.
+2. Remove `/config/custom_components/solar_of_things/` from your HA filesystem.
+3. Restart Home Assistant.

+ 50 - 86
QUICKSTART.md

@@ -1,106 +1,70 @@
 # Quick Start Guide
 
-Get your Solar of Things integration running in 5 minutes!
+Get Solar of Things running in Home Assistant in under 5 minutes.
 
 ## Prerequisites
 
-- ✅ Home Assistant installed (2023.1+)
-- ✅ Access to https://solar.siseli.com
-- ✅ At least one solar station configured
+- ✅ Home Assistant 2023.6+
+- ✅ Active account at [solar.siseli.com](https://solar.siseli.com)
 
-## Step 1: Get Your Credentials (2 minutes)
+---
+
+## Step 1 — Find Your Station ID (2 min)
 
-1. Open https://solar.siseli.com in your browser
-2. Login to your account
-3. Press **F12** to open Developer Tools
-4. Click the **Network** tab
-5. Refresh the page (**Ctrl+R** or **Cmd+R**)
-6. Click on any API request
-7. Copy these values:
-   - **IOT-Token** from Request Headers
-   - **deviceId** from Request Payload (18 digits)
-   - **stationId** from Request Payload (18 digits)
+1. Open [https://solar.siseli.com](https://solar.siseli.com) and log in.
+2. Press **F12** → **Network** tab → refresh the page (**Ctrl+R**).
+3. Click any request to `solar.siseli.com`.
+4. In the **Payload** tab, find `stationId` — it's an 18-digit number.
 
-![Finding Credentials](https://via.placeholder.com/600x300?text=See+INSTALLATION.md+for+detailed+screenshots)
+> Your **User ID** is your login account name (not an email address).
+> Your **Station ID** looks like `423564214316007425`.
+
+---
 
-## Step 2: Install Integration (1 minute)
+## Step 2 — Install (1 min)
 
-### Option A: HACS (Recommended)
-1. Open HACS → Integrations
-2. Click ⋮ → Custom repositories
-3. Add: `https://github.com/conexocasa/solar-of-things-ha`
-4. Install "Solar of Things"
+### Option A: HACS
+1. HACS → Integrations → **⋮** → Custom repositories
+2. Add `https://github.com/Conexo-Casa/solar-of-things-ha` → Integration
+3. Search **Solar of Things** → Download
+4. Restart Home Assistant
 
 ### Option B: Manual
-1. Download this repository
-2. Copy `solar_of_things` folder to `/config/custom_components/`
+1. Download the ZIP from [Releases](https://github.com/Conexo-Casa/solar-of-things-ha/releases/latest)
+2. Extract `solar_of_things/` → copy to `/config/custom_components/`
 3. Restart Home Assistant
 
-## Step 3: Configure (2 minutes)
-
-1. Go to **Settings** → **Devices & Services**
-2. Click **+ Add Integration**
-3. Search for **"Solar of Things"**
-4. Enter your credentials:
-   ```
-   IOT Token:  [paste your token]
-   Station ID: [your 18-digit station ID]
-   Device ID:  [optional; leave blank to auto-discover all devices]
-   ```
-5. Click **Submit**
-
-## Step 4: Verify (30 seconds)
-
-1. Go to **Settings** → **Devices & Services**
-2. Find your "Solar Station" device
-3. You should see sensors like:
-   - ✅ PV Input Power
-   - ✅ Battery State of Charge
-   - ✅ Grid Import Power
-   - ✅ Load Power
-
-## Step 5: Add to Dashboard (Optional)
-
-### Quick Dashboard Card
-
-```yaml
-type: entities
-title: My Solar System
-entities:
-  - sensor.solar_station_xxxxx_pv_input_power
-  - sensor.solar_station_xxxxx_battery_state_of_charge
-  - sensor.solar_station_xxxxx_load_power
-```
-
-See [EXAMPLES.md](EXAMPLES.md) for more advanced cards!
-
-## Troubleshooting
-
-### "Cannot Connect" Error
-- ❌ Token expired → Get fresh token from solar.siseli.com
-- ❌ Wrong Device/Station ID → Verify 18-digit numbers
-- ❌ Network issue → Check firewall/internet
-
-### No Sensors Showing
-- ⏱️ Wait 5-10 minutes for first update
-- 🔍 Check logs: Settings → System → Logs
-- 🌐 Verify device online at solar.siseli.com
-
-### Need Help?
-- 📖 [Full Documentation](README.md)
-- 🛠️ [Installation Guide](INSTALLATION.md)
-- 💡 [Examples](EXAMPLES.md)
-- 🐛 [Report Issue](https://github.com/conexocasa/solar-of-things-ha/issues)
+---
 
-## Next Steps
+## Step 3 — Configure (2 min)
 
-- [ ] Add to Energy Dashboard
-- [ ] Create automations for low battery alerts
-- [ ] Set up notifications for high solar production
-- [ ] Explore template sensors for custom calculations
+1. **Settings → Devices & Services → + Add Integration**
+2. Search **Solar of Things**
+3. Select **User ID + Password** (recommended)
+4. Enter your **User ID**, **Password**, and **Station ID**
+5. Leave Device ID blank (auto-discovers all inverters)
+6. Click **Submit**
 
-See [EXAMPLES.md](EXAMPLES.md) for ideas!
+---
+
+## Step 4 — Done ✅
+
+Go to **Settings → Devices & Services → Solar of Things**.
+
+You should see your inverter device with:
+- ☀️ 10 real-time power sensors
+- 🔋 3 battery control sliders
+- 🔽 2 operating mode dropdowns
+- 🔘 3 grid/backup switches
+- 📊 4 monthly energy sensors
+
+> Sensors show **Unknown** for the first 5 minutes — this is normal while the first poll runs.
 
 ---
 
-**🎉 Congratulations!** You're now monitoring your solar system in Home Assistant!
+## Next Steps
+
+- [Energy Dashboard setup](README.md#energy-dashboard)
+- [Automation examples](README.md#automation-examples)
+- [Troubleshooting](README.md#troubleshooting)
+- [Full documentation](README.md)

+ 93 - 349
README.md

@@ -1,20 +1,17 @@
 # ☀️ Solar of Things — Home Assistant Integration
 
 <p align="center">
-  <a href="https://github.com/conexocasa/solar-of-things-ha/releases/latest">
-    <img src="https://img.shields.io/github/v/release/conexocasa/solar-of-things-ha?style=for-the-badge&label=Latest%20Release&color=orange" alt="Latest Release">
+  <a href="https://github.com/Conexo-Casa/solar-of-things-ha/releases/latest">
+    <img src="https://img.shields.io/github/v/release/Conexo-Casa/solar-of-things-ha?style=for-the-badge&label=Latest%20Release&color=orange" alt="Latest Release">
   </a>
   <a href="https://github.com/custom-components/hacs">
     <img src="https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge" alt="HACS Custom">
   </a>
   <a href="https://www.home-assistant.io/">
-    <img src="https://img.shields.io/badge/Home%20Assistant-2023.1%2B-41BDF5?style=for-the-badge&logo=home-assistant" alt="Home Assistant">
+    <img src="https://img.shields.io/badge/Home%20Assistant-2023.6%2B-41BDF5?style=for-the-badge&logo=home-assistant" alt="Home Assistant">
   </a>
   <a href="LICENSE">
-    <img src="https://img.shields.io/github/license/conexocasa/solar-of-things-ha?style=for-the-badge" alt="MIT License">
-  </a>
-  <a href="https://github.com/conexocasa/solar-of-things-ha/actions/workflows/validate.yml">
-    <img src="https://img.shields.io/github/actions/workflow/status/conexocasa/solar-of-things-ha/validate.yml?branch=main&style=for-the-badge&label=CI" alt="CI Status">
+    <img src="https://img.shields.io/github/license/Conexo-Casa/solar-of-things-ha?style=for-the-badge" alt="MIT License">
   </a>
 </p>
 
@@ -33,22 +30,13 @@
 - [Control Entities](#control-entities)
 - [Requirements](#requirements)
 - [Installation](#installation)
-  - [HACS (Recommended)](#hacs-recommended)
-  - [Manual Installation](#manual-installation)
 - [Configuration](#configuration)
-  - [Step 1 — Find Your Credentials](#step-1--find-your-credentials)
-  - [Step 2 — Add the Integration](#step-2--add-the-integration)
-  - [Step 3 — Verify Entities](#step-3--verify-entities)
-  - [Multiple Stations](#multiple-stations)
-- [Screenshots](#screenshots)
 - [Energy Dashboard](#energy-dashboard)
 - [Automation Examples](#automation-examples)
-- [Dashboard Card Examples](#dashboard-card-examples)
+- [Dashboard Cards](#dashboard-cards)
 - [Troubleshooting](#troubleshooting)
-- [API Reference](#api-reference)
 - [Contributing](#contributing)
 - [Changelog](#changelog)
-- [License](#license)
 
 ---
 
@@ -57,18 +45,14 @@
 The **Solar of Things** integration connects Home Assistant to the
 [Siseli solar portal](https://solar.siseli.com) and provides:
 
-- **Auto-discovery** of every inverter device under your station — enter your
-  Station ID once and Home Assistant finds all your devices automatically.
-- **10+ real-time sensors** for power, battery, grid and load data, updated
-  every 5 minutes.
+- **Auto-discovery** of every inverter under your station — enter your Station ID once and Home Assistant finds all devices automatically.
+- **10+ real-time sensors** updated every 5 minutes.
 - **4 monthly summary sensors** for energy totals and solar coverage.
-- **8 control entities** (sliders, dropdowns, switches) to manage battery
-  limits, operating modes and grid settings directly from HA.
-- Full compatibility with the **Home Assistant Energy Dashboard**.
+- **8 control entities** (sliders, dropdowns, switches) to manage battery limits, operating modes, and grid settings from HA.
+- Full **Home Assistant Energy Dashboard** compatibility.
 - **Multi-station support** — add the integration once per station.
 
-> API behavior is based on the Siseli web portal and the reference CLI client
-> at [Hyllesen/solar-of-things-solar-usage](https://github.com/Hyllesen/solar-of-things-solar-usage).
+> **Developed by [Conexo Casa](https://conexocasa.org)** — building accessible technology for people with neurocognitive impairments and the elderly.
 
 ---
 
@@ -82,7 +66,7 @@ The **Solar of Things** integration connects Home Assistant to the
 | 🎛️ **System control** | 8 control entities (battery limits, modes, grid switches) |
 | ⚡ **Energy Dashboard** | All power and energy sensors are dashboard-ready |
 | 🏠 **Multi-station** | Unlimited stations via multiple config entries |
-| 🔒 **Secure auth** | User ID + Password login with automatic token refresh (no manual token copying) |
+| 🔒 **Secure auth** | User ID + Password with automatic token refresh |
 | 🌏 **Timezone-aware** | Configurable `IOT-Time-Zone` header per integration |
 | 🔄 **Auto-retry** | HA coordinator pattern with automatic retry on failure |
 
@@ -100,10 +84,10 @@ The **Solar of Things** integration connects Home Assistant to the
 | `{device} Battery Charging Current` | A | `current` | Current flowing into battery |
 | `{device} Battery Discharge Current` | A | `current` | Current flowing out of battery |
 | `{device} Battery Voltage` | V | `voltage` | Battery bank terminal voltage |
-| `{device} Battery Power` | W | `power` | Net battery power (calculated: discharge − charge × voltage) |
+| `{device} Battery Power` | W | `power` | Net battery power (discharge − charge × voltage) |
 | `{device} Battery State of Charge` | % | `battery` | Battery charge level |
 | `{device} Grid Feed-in Power` | W | `power` | Power exported to the utility grid |
-| `{device} Grid Import Power` | W | `power` | Power imported from the utility grid (calculated) |
+| `{device} Grid Import Power` | W | `power` | Power imported from the utility grid |
 | `{device} Load Power` | W | `power` | Total household / load consumption |
 
 ### Monthly Station Sensors
@@ -120,9 +104,8 @@ The **Solar of Things** integration connects Home Assistant to the
 
 ## Control Entities
 
-> Control entities require your device firmware/account to support the
-> settings API. If controls are unresponsive, see
-> [TROUBLESHOOTING.md](TROUBLESHOOTING.md).
+> Controls require your device firmware/account to support the settings API.
+> If unresponsive, see [Troubleshooting](#troubleshooting).
 
 ### Number Entities (Sliders)
 
@@ -136,16 +119,16 @@ The **Solar of Things** integration connects Home Assistant to the
 
 | Entity | Options | Description |
 |---|---|---|
-| `{device} Operating Mode` | Self-Use · Time-of-Use · Backup · Grid-Tie · Off-Grid | System operating strategy |
-| `{device} Battery Priority` | Solar First · Battery First · Grid First | Energy source priority order |
+| `{device} Output Source Priority` | Utility First (USO) · Solar First (SUB) · Solar+Battery First (SBU) | System power source priority |
+| `{device} Charger Source Priority` | Solar + Utility (CSO) · Solar First (SNU) · Solar Only (OSO) | Battery charging source priority |
 
 ### Switch Entities
 
 | Entity | Description |
 |---|---|
-| `{device} Grid Charging` | Allow/deny battery charging from the grid |
+| `{device} Grid Charging (AC Input Range)` | Allow/deny battery charging from the grid (Appliance vs UPS mode) |
 | `{device} Grid Feed-In` | Allow/deny exporting excess power to the grid |
-| `{device} Backup Mode` | Reserve battery capacity for power outages |
+| `{device} Backup Mode (SBU Priority)` | Reserve battery capacity for power outages (SBU vs SUB priority) |
 
 ---
 
@@ -153,11 +136,10 @@ The **Solar of Things** integration connects Home Assistant to the
 
 | Requirement | Details |
 |---|---|
-| Home Assistant | 2023.1 or newer |
+| Home Assistant | **2023.6** or newer |
 | Siseli account | Active account at [solar.siseli.com](https://solar.siseli.com) |
-| IOT-Token | Retrieved from browser DevTools (see [Configuration](#configuration)) |
 | Station ID | 18-digit ID from the Siseli portal |
-| Network | Home Assistant must be able to reach `https://solar.siseli.com` |
+| Network | HA must reach `https://solar.siseli.com` |
 
 ---
 
@@ -165,57 +147,24 @@ The **Solar of Things** integration connects Home Assistant to the
 
 ### HACS (Recommended)
 
-> HACS is the easiest way to install and keep the integration up to date.
-
-1. Open **HACS** in your Home Assistant sidebar.
-2. Click **Integrations**.
-3. Click the three-dot menu **⋮** (top-right) → **Custom repositories**.
-4. Add the repository:
+1. Open **HACS** in the HA sidebar → **Integrations**.
+2. Click **⋮** (top-right) → **Custom repositories**.
+3. Enter:
    ```
-   https://github.com/conexocasa/solar-of-things-ha
+   https://github.com/Conexo-Casa/solar-of-things-ha
    ```
-   Category: **Integration**
-5. Click **Add**, then search for **Solar of Things**.
-6. Click **Download** and confirm.
-7. **Restart Home Assistant.**
-
-> After restarting, continue to [Configuration](#configuration).
-
----
-
-### Manual Installation
+   Category: **Integration** → **Add**.
+4. Search **Solar of Things** → **Download**.
+5. **Restart Home Assistant.**
 
-1. Download the latest release asset:
-   **[solar-of-things-ha.zip](https://github.com/conexocasa/solar-of-things-ha/releases/latest)**
+### Manual
 
-2. Extract the ZIP. Inside you will find:
-   ```
-   custom_components/
-   └── solar_of_things/
-       ├── __init__.py
-       ├── api.py
-       ├── config_flow.py
-       ├── const.py
-       ├── manifest.json
-       ├── number.py
-       ├── select.py
-       ├── sensor.py
-       ├── strings.json
-       ├── switch.py
-       └── translations/
-           └── en.json
-   ```
-
-3. Copy the **`solar_of_things`** folder into your HA config directory:
+1. Download the latest release ZIP from the [Releases page](https://github.com/Conexo-Casa/solar-of-things-ha/releases/latest).
+2. Extract and copy the `solar_of_things` folder to:
    ```
    /config/custom_components/solar_of_things/
    ```
-
-4. **Restart Home Assistant.**
-
-> Verify the folder is in the right place: go to
-> **Settings → System → Logs** and look for `solar_of_things`.
-> No errors means the component loaded correctly.
+3. **Restart Home Assistant.**
 
 ---
 
@@ -223,164 +172,56 @@ The **Solar of Things** integration connects Home Assistant to the
 
 ### Step 1 — Find Your Credentials
 
-You need three values from the Siseli portal.
-All three are visible in the browser's Network tab — no third-party tools needed.
-
 1. Open [https://solar.siseli.com](https://solar.siseli.com) and log in.
-2. Press **F12** (or **Cmd + Option + I** on macOS) to open DevTools.
-3. Click the **Network** tab.
-4. Press **Ctrl + R** (or **Cmd + R**) to refresh the page.
-5. Click any request that goes to `solar.siseli.com` and look at:
-
-| Value | Where to find it | Example |
-|---|---|---|
-| **IOT-Token** | Request **Headers** tab → `IOT-Token` | `CA49A160DBFFE7A827...` |
-| **Station ID** | Request **Payload** tab → `stationId` | `423564214316007425` |
-| **Device ID** | Request **Payload** tab → `deviceId` | `423564214341173249` |
+2. Note your **User ID** (login account name) and **password**.
+3. Press **F12** → **Network** tab → refresh the page.
+4. Click any request to `solar.siseli.com` and find `stationId` in the **Payload** tab.
 
-> **Tip:** Filter the Network tab by typing `device/list` or `history` to find
-> the relevant requests faster.
-
-> **Security:** Your IOT-Token is session-based and may expire.
-> If the integration stops working, re-copy a fresh token from the portal.
-
----
+| Value | Where to find it |
+|---|---|
+| **User ID** | Your account login name on solar.siseli.com |
+| **Password** | Your account password |
+| **Station ID** | `stationId` field in any API request payload |
 
 ### Step 2 — Add the Integration
 
-1. In Home Assistant go to **Settings → Devices & Services**.
-2. Click **+ Add Integration** (bottom-right).
-3. Search for **Solar of Things** and select it.
-4. Fill in the configuration form:
+1. **Settings → Devices & Services → + Add Integration**.
+2. Search **Solar of Things**.
+3. Choose **User ID + Password** (recommended) and fill in:
 
    | Field | Required | Description |
    |---|---|---|
-   | **IOT Token** | ✅ Yes | Paste your `IOT-Token` header value |
-   | **Station ID** | ✅ Yes | 18-digit Station ID |
-   | **Device ID** | ⬜ Optional | Leave blank to auto-discover ALL devices |
-   | **Time zone** | ⬜ Optional | Default: `Asia/Manila`. Set to your local tz (e.g. `Europe/Berlin`) |
-
-5. Click **Submit**. The integration will:
-   - Validate your token by calling the Siseli API.
-   - Auto-discover all device IDs under the station.
-   - Create HA entities for every discovered device.
-
-> **Device ID is optional.** If you leave it blank, Home Assistant will call
-> `POST /apis/device/list` and create entities for every inverter under your
-> station automatically. Set `Device ID` only if you want to restrict entities
-> to a single device.
-
----
+   | **User ID** | ✅ | Your Siseli account login name |
+   | **Password** | ✅ | Your Siseli account password |
+   | **Station ID** | ✅ | 18-digit Station ID |
+   | **Device ID** | Optional | Leave blank to auto-discover all devices |
+   | **Time zone** | Optional | Default: `Asia/Manila` |
 
-### Step 3 — Verify Entities
+4. Click **Submit**. The integration logs in, discovers devices, and creates all entities.
 
-After adding the integration, go to
-**Settings → Devices & Services → Solar of Things** and click your station.
+> **IOT Token mode** is also available for advanced users who prefer not to store credentials. Tokens expire and require re-entry when they do.
 
-You should see:
+### Step 3 — Verify
 
-- ☀️ Sensor entities (PV power, battery, grid, load)
-- 🔢 Number sliders (battery charge/discharge limits, grid charge limit)
-- 🔽 Select dropdowns (operating mode, battery priority)
-- 🔘 Switches (grid charging, grid feed-in, backup mode)
-- 📊 Monthly energy summary sensors (if station ID is set)
+Go to **Settings → Devices & Services → Solar of Things** and confirm your devices appear with sensors, controls, and monthly sensors populated.
 
-> Entities may show **Unknown** for the first 5 minutes while the coordinator
-> fetches the first data update.
-
----
-
-### Multiple Stations
-
-To monitor more than one station:
-
-1. Go to **Settings → Devices & Services**.
-2. Click **+ Add Integration** again.
-3. Search for **Solar of Things** and add it with the credentials for your
-   second station.
-4. Repeat for every additional station.
-
-Each station appears as a separate device group in Home Assistant with its own
-set of sensors and control entities.
-
----
-
-## Screenshots
-
-> The screenshots below show typical HA entity cards for this integration.
-> Your entity names will include your device name (e.g. `1_Inverter`) instead
-> of the placeholder shown.
-
-### Device sensors in Entities view
-```
-┌─────────────────────────────────────────────────────┐
-│  1_Inverter · Siseli Solar Inverter                 │
-├─────────────────────────────────────────────────────┤
-│  ☀️  PV Input Power              22 W               │
-│  🔌  AC Output Power            324 W               │
-│  🔋  Battery State of Charge     76 %               │
-│  🔋  Battery Voltage           27.2 V               │
-│  ⬆️  Battery Charging Current   1.2 A               │
-│  ⬇️  Battery Discharge Current  0.0 A               │
-│  ⚡  Battery Power             32.6 W               │
-│  🏠  Load Power                324 W               │
-│  📤  Grid Feed-in Power          0 W               │
-│  📥  Grid Import Power           0 W               │
-├─────────────────────────────────────────────────────┤
-│  🎛️  Battery Charge Limit       ████░░░░  80 %      │
-│  🎛️  Battery Discharge Limit    █░░░░░░░  10 %      │
-│  🎛️  Grid Charge Limit          ░░░░░░░░   0 W      │
-│  🔽  Operating Mode             Self-Use            │
-│  🔽  Battery Priority           Solar First         │
-│  🔘  Grid Charging              OFF                 │
-│  🔘  Grid Feed-In               ON                  │
-│  🔘  Backup Mode                OFF                 │
-└─────────────────────────────────────────────────────┘
-```
-
-### Monthly station summary sensors
-```
-┌─────────────────────────────────────────────────────┐
-│  Solar Station 423564214316007425                   │
-├─────────────────────────────────────────────────────┤
-│  📊  Monthly PV Generated      95.45 kWh            │
-│  📊  Monthly Grid Import        0.00 kWh            │
-│  📊  Monthly Total Consumption  0.00 kWh            │
-│  📊  Monthly Solar Coverage       — %               │
-└─────────────────────────────────────────────────────┘
-```
-
-### Energy Dashboard configuration
-```
-  Solar production  ──▶  sensor.1_inverter_pv_input_power
-  Grid consumption  ──▶  sensor.1_inverter_grid_import_power
-  Return to grid    ──▶  sensor.1_inverter_grid_feed_in_power
-  Battery charge    ──▶  sensor.1_inverter_battery_charging_current
-  Battery discharge ──▶  sensor.1_inverter_battery_discharge_current
-```
+> Entities show **Unknown** for the first 5 minutes while the first coordinator poll runs.
 
 ---
 
 ## Energy Dashboard
 
-This integration is fully compatible with the HA Energy Dashboard.
+Go to **Settings → Dashboards → Energy** and configure:
 
-Go to **Settings → Dashboards → Energy** and add:
-
-| Dashboard slot | Entity to use |
+| Dashboard slot | Entity |
 |---|---|
 | Solar production | `sensor.{device}_pv_input_power` |
 | Grid consumption | `sensor.{device}_grid_import_power` |
 | Return to grid | `sensor.{device}_grid_feed_in_power` |
 | Battery charge | `sensor.{device}_battery_charging_current` |
 | Battery discharge | `sensor.{device}_battery_discharge_current` |
-
-For monthly totals use the station-level sensors:
-
-| Dashboard slot | Entity to use |
-|---|---|
-| Solar production (monthly) | `sensor.station_{id}_monthly_pv_generated` |
-| Grid import (monthly) | `sensor.station_{id}_monthly_grid_import` |
+| Monthly solar (production) | `sensor.station_{id}_monthly_pv_generated` |
+| Monthly grid import | `sensor.station_{id}_monthly_grid_import` |
 
 ---
 
@@ -401,10 +242,9 @@ automation:
           message: >
             Battery is at
             {{ states('sensor.1_inverter_battery_state_of_charge') }}%.
-            Consider reducing load or enabling grid charging.
 ```
 
-### Auto-enable grid charging at night
+### Enable grid charging at night
 ```yaml
 automation:
   - alias: "Solar — Enable Grid Charging at Night"
@@ -414,7 +254,7 @@ automation:
     action:
       - service: switch.turn_on
         target:
-          entity_id: switch.1_inverter_grid_charging
+          entity_id: switch.1_inverter_grid_charging_ac_input_range
 ```
 
 ### Switch to backup mode before a storm
@@ -432,7 +272,7 @@ automation:
     action:
       - service: switch.turn_on
         target:
-          entity_id: switch.1_inverter_backup_mode
+          entity_id: switch.1_inverter_backup_mode_sbu_priority
       - service: number.set_value
         target:
           entity_id: number.1_inverter_battery_charge_limit
@@ -440,202 +280,106 @@ automation:
           value: 95
 ```
 
-### Time-of-use mode during peak hours
-```yaml
-automation:
-  - alias: "Solar — TOU Mode During Peak Hours"
-    trigger:
-      - platform: time
-        at: "17:00:00"
-    action:
-      - service: select.select_option
-        target:
-          entity_id: select.1_inverter_operating_mode
-        data:
-          option: "Time-of-Use"
-  - alias: "Solar — Self-Use Mode After Peak"
-    trigger:
-      - platform: time
-        at: "21:00:00"
-    action:
-      - service: select.select_option
-        target:
-          entity_id: select.1_inverter_operating_mode
-        data:
-          option: "Self-Use"
-```
-
 ---
 
-## Dashboard Card Examples
+## Dashboard Cards
 
-### Entities card — quick status overview
+### Quick status overview
 ```yaml
 type: entities
 title: ☀️ Solar System
 entities:
   - entity: sensor.1_inverter_pv_input_power
     name: Solar Generation
-    icon: mdi:solar-power
   - entity: sensor.1_inverter_battery_state_of_charge
     name: Battery Level
-    icon: mdi:battery
   - entity: sensor.1_inverter_load_power
     name: Home Load
-    icon: mdi:home-lightning-bolt
   - entity: sensor.1_inverter_grid_import_power
     name: Grid Import
-    icon: mdi:transmission-tower-import
   - entity: sensor.1_inverter_grid_feed_in_power
     name: Grid Feed-In
-    icon: mdi:transmission-tower-export
 ```
 
-### Glance card — at-a-glance numbers
-```yaml
-type: glance
-title: Solar At a Glance
-entities:
-  - entity: sensor.1_inverter_pv_input_power
-    name: PV
-  - entity: sensor.1_inverter_battery_state_of_charge
-    name: Battery
-  - entity: sensor.1_inverter_load_power
-    name: Load
-  - entity: sensor.1_inverter_grid_import_power
-    name: Grid In
-  - entity: sensor.1_inverter_grid_feed_in_power
-    name: Grid Out
-```
-
-### Control panel card
+### Control panel
 ```yaml
 type: entities
 title: 🎛️ Solar Controls
 entities:
-  - entity: select.1_inverter_operating_mode
-    name: Operating Mode
-  - entity: select.1_inverter_battery_priority
-    name: Battery Priority
+  - entity: select.1_inverter_output_source_priority
+    name: Output Mode
+  - entity: select.1_inverter_charger_source_priority
+    name: Charger Priority
   - entity: number.1_inverter_battery_charge_limit
-    name: Charge Limit
   - entity: number.1_inverter_battery_discharge_limit
-    name: Discharge Limit
   - entity: number.1_inverter_grid_charge_limit
-    name: Grid Charge Limit
   - type: divider
-  - entity: switch.1_inverter_grid_charging
-    name: Grid Charging
+  - entity: switch.1_inverter_grid_charging_ac_input_range
   - entity: switch.1_inverter_grid_feed_in
-    name: Grid Feed-In
-  - entity: switch.1_inverter_backup_mode
-    name: Backup Mode
+  - entity: switch.1_inverter_backup_mode_sbu_priority
 ```
 
 ---
 
 ## Troubleshooting
 
-See the full guide: **[TROUBLESHOOTING.md](TROUBLESHOOTING.md)**
-
-Quick reference for the most common issues:
-
-| Symptom | Most likely cause | Fix |
+| Symptom | Cause | Fix |
 |---|---|---|
-| "Cannot Connect" on setup | Expired or wrong IOT-Token | Re-copy fresh token from portal DevTools |
-| No devices discovered | Wrong Station ID | Verify 18-digit stationId in portal Network tab |
-| Entities show "Unavailable" | Token expired or portal unreachable | Check HA logs + re-enter token |
-| Sensors always "Unknown" | API returns null for that field | Normal for unsupported sensors on your model |
-| Controls do nothing | Settings endpoint varies by firmware | Check HA logs for endpoint + HTTP status |
-| Integration not in search | Files not installed correctly | Verify `/config/custom_components/solar_of_things/` exists |
+| "Cannot Connect" on setup | Wrong credentials or network | Check User ID / password and HA network access to solar.siseli.com |
+| No devices discovered | Wrong Station ID | Verify 18-digit stationId in the portal Network tab |
+| Entities show "Unavailable" | Token expired or portal unreachable | HA will prompt re-auth automatically; check logs |
+| Sensors always "Unknown" | API returns null for that field | Normal for sensors not supported by your inverter model |
+| Controls do nothing | Settings endpoint varies by firmware | Check HA logs for HTTP status codes |
+| Integration not in search | Files in wrong location | Verify `/config/custom_components/solar_of_things/` exists |
 
 ### Enable debug logging
-Add to `configuration.yaml`:
 ```yaml
 logger:
   default: info
   logs:
     custom_components.solar_of_things: debug
 ```
-Restart HA, reproduce the problem, then check **Settings → System → Logs**.
-
----
-
-## API Reference
-
-This integration targets the same endpoints used by the Siseli web portal.
-
-| Endpoint | Method | Purpose |
-|---|---|---|
-| `/apis/device/list` | POST | Discover all device IDs under a station |
-| `/apis/deviceState/simple/attribute/keys/history/v1` | POST | Real-time time-series telemetry per device |
-| `/apis/stationOverView/stateAttributeSummary/category/yearly` | POST | Monthly energy summary per station |
-
-### Required request headers
-
-| Header | Value |
-|---|---|
-| `IOT-Token` | Your authentication token |
-| `IOT-Time-Zone` | Your timezone string (e.g. `Asia/Manila`) |
-| `Content-Type` | `application/json; charset=utf-8` |
-| `Origin` | `https://solar.siseli.com` |
-
-> Reference client (Node.js CLI with same API behavior):
-> [Hyllesen/solar-of-things-solar-usage](https://github.com/Hyllesen/solar-of-things-solar-usage)
+Restart HA, reproduce the issue, then check **Settings → System → Logs**.
 
 ---
 
 ## Contributing
 
-Contributions are very welcome!
-
-1. Fork the repository.
-2. Create a feature branch: `git checkout -b feature/my-improvement`
-3. Make your changes and add tests if applicable.
-4. Run the validation workflow locally:
+1. Fork the repo and create a feature branch.
+2. Make changes and ensure Python syntax is valid:
    ```bash
-   python3 -m py_compile __init__.py api.py config_flow.py \
-     const.py sensor.py number.py select.py switch.py
+   python3 -m py_compile custom_components/solar_of_things/*.py
    ```
-5. Commit with a clear message and open a Pull Request.
+3. Open a Pull Request with a clear description.
 
-Bug reports and feature requests → use the **GitHub Issues** templates:
-[github.com/conexocasa/solar-of-things-ha/issues/new/choose](https://github.com/conexocasa/solar-of-things-ha/issues/new/choose)
+Bug reports and feature requests: [GitHub Issues](https://github.com/Conexo-Casa/solar-of-things-ha/issues)
 
 ---
 
 ## Changelog
 
-See **[CHANGELOG.md](CHANGELOG.md)** for a full history.
+See **[CHANGELOG.md](CHANGELOG.md)** for full history.
 
 | Version | Highlights |
 |---|---|
-| **v2.3.0** | User ID/Account auth, working IOT-Open signing (AES+HMAC+MD5), correct login endpoint |
-| **v2.2.0** | Email + Password auth, automatic token refresh 5 min before expiry, HA re-auth flow |
-| **v2.1.1** | HACS metadata, GitHub Actions CI/CD, issue templates, release script |
-| **v2.1.0** | Station-based device auto-discovery (`/apis/device/list`) |
-| **v2.0.0** | Control entities (battery limits, operating modes, grid switches) |
-| **v1.0.0** | Initial release — monitoring sensors, config flow, multi-station |
+| **v2.4.0** | HACS structure, brand icon, missing API methods fixed, translation keys, device registry fix |
+| **v2.3.3** | Correct settings API endpoints from live portal |
+| **v2.3.0** | User ID auth, working IOT-Open signing |
+| **v2.2.0** | Auto token refresh, HA re-auth flow |
+| **v2.0.0** | Control entities (battery, modes, grid) |
+| **v1.0.0** | Initial release — monitoring sensors |
 
 ---
 
 ## License
 
-This project is licensed under the **MIT License** — see [LICENSE](LICENSE) for details.
-
----
-
-## Disclaimer
-
-This is an **unofficial** community integration and is not affiliated with,
-endorsed by, or supported by Siseli or Solar of Things.
-Use at your own risk. The API may change without notice.
+MIT — see [LICENSE](LICENSE) for details.
 
 ---
 
 <p align="center">
-  Made with ☀️ for the Home Assistant community<br>
-  <a href="https://github.com/conexocasa/solar-of-things-ha/issues">Report a Bug</a> ·
-  <a href="https://github.com/conexocasa/solar-of-things-ha/issues">Request a Feature</a> ·
+  Built by <a href="https://conexocasa.org">Conexo Casa</a> — accessible technology for everyone<br>
+  <a href="https://github.com/Conexo-Casa/solar-of-things-ha/issues">Report a Bug</a> ·
+  <a href="https://github.com/Conexo-Casa/solar-of-things-ha/issues">Request a Feature</a> ·
   <a href="https://community.home-assistant.io">HA Community Forum</a>
 </p>