You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: trust HA Ingress auth and build proper climate payload for hvac overrides
Two HA add-on fixes:
- Web UI mutations (label edits, .cbz/XML imports) now work on a default
add-on install with no web_api_key. Requests proxied through Home
Assistant Ingress are already authenticated by HA, so the
Supervisor-injected X-Ingress-Path header is trusted, but only when the
server runs in ingress mode (basePath set) so a spoofed header can't
bypass auth on a directly-exposed port. A configured web_api_key still
takes precedence.
- A per-group "hvac" type override now publishes a full climate entity
(temperature/mode topics) via _createHvacDiscovery instead of a broken
generic payload, and the climate config topic is tracked for stale
cleanup. Docs clarify that only Lighting (56) is discovered by default
and how to reclassify lighting-app groups via type_overrides.
Copy file name to clipboardExpand all lines: README.md
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,13 +119,14 @@ When enabled, `cgateweb` queries the C-Gate network structure (`TREEXML`) and pu
119
119
Supported Device Types:
120
120
121
121
***Lights:** C-Bus Lighting Application groups (typically App ID 56) are discovered as Home Assistant `light` entities, supporting on/off and brightness control.
122
-
***Covers:** Devices using the configured `ha_discovery_cover_app_id` (default: `203`) are discovered as `cover` entities (device class `shutter`), supporting:
122
+
***Covers:** Devices using the configured `ha_discovery_cover_app_id` (default: `null` — disabled; commonly set to `203`for Enable Control) are discovered as `cover` entities (device class `shutter`), supporting:
123
123
- **Position control:** Set position 0-100% (0=closed, 100=fully open)
124
124
- **Stop:** Stop the cover at its current position
125
125
- **Open/Close:** Basic open/close commands
126
126
***Switches:** Devices using the configured `ha_discovery_switch_app_id` (default: `null`) are discovered as `switch` entities.
127
127
***Relays:** Devices using the configured `ha_discovery_relay_app_id` (default: `null`) are discovered as `switch` entities with device class `outlet`.
128
128
***PIR Motion Sensors:** Devices using the configured `ha_discovery_pir_app_id` (default: `null`) are discovered as `binary_sensor` entities with device class `motion`.
129
+
***HVAC / Climate:** Devices using the configured `ha_discovery_hvac_app_id` (default: `null` — disabled; commonly Air Conditioning App `201`) are discovered as `climate` entities.
129
130
130
131
**Configuration (`settings.js`):**
131
132
@@ -138,11 +139,14 @@ module.exports = {
138
139
ha_discovery_prefix: 'homeassistant', // Default HA discovery topic prefix
139
140
ha_discovery_networks: ['254'], // List C-Bus network IDs to scan (e.g., ['254', '200'])
140
141
141
-
// Application IDs for specific device types (MUST match your C-Bus project configuration)
142
-
ha_discovery_cover_app_id: '203', // App ID for Covers (e.g., Enable Control)
142
+
// Application IDs for specific device types (MUST match your C-Bus project configuration).
143
+
// All of these default to `null` (disabled). Only the Lighting application (56) is
144
+
// discovered out of the box, and every Lighting group is published as a `light`.
145
+
ha_discovery_cover_app_id: '203', // App ID for Covers (e.g., Enable Control) - null to disable (default)
143
146
ha_discovery_switch_app_id: null, // App ID for Switches (e.g., Enable Control, Trigger Control) - null to disable
144
147
ha_discovery_relay_app_id: null, // App ID for Relays (e.g., Enable Control) - null to disable
145
-
ha_discovery_pir_app_id: null // App ID for PIR Motion Sensors (e.g., Trigger Control) - null to disable
148
+
ha_discovery_pir_app_id: null, // App ID for PIR Motion Sensors (e.g., Trigger Control) - null to disable
149
+
ha_discovery_hvac_app_id: null // App ID for HVAC/climate zones (e.g., Air Conditioning 201) - null to disable
146
150
};
147
151
```
148
152
@@ -159,7 +163,8 @@ The crucial step is setting the correct `ha_discovery_*_app_id` values to match
159
163
160
164
**Important Notes:**
161
165
162
-
* Discovery forSwitches, Relays, and PIRs is **disabled by default** (`null`). You *must* set the corresponding `ha_discovery_*_app_id`in`settings.js` to the correct C-Bus Application ID to enable discovery for these types.
166
+
* Discovery forCovers, Switches, Relays, PIRs, and HVAC is **disabled by default** (`null`). Only the Lighting application (56) is discovered automatically, and **every** Lighting group is published as a `light`. You *must* set the corresponding `ha_discovery_*_app_id`in`settings.js` to the correct C-Bus Application ID to enable the other types.
167
+
***Devices that live on the Lighting application (56) but are not lights** — e.g. shutter-relay units (blinds use lighting group addresses) or a thermostat exposed on app 56 — will appear as `light` entities because classification is purely by Application ID. To reclassify an individual group, add a per-group `type_overrides` entry in your labels file (`"<net>/<app>/<group>": "cover"|"switch"|"relay"|"pir"|"hvac"`) or via the web UI; this is the only way to change the type of a group that shares the Lighting application with real lights.
163
168
* If multiple discovery types (e.g., Cover and Switch) are configured with the *same* Application ID, `cgateweb` prioritizes discovery in this order: Cover > Switch > Relay > PIR. Only the first matching type will be discovered for a given C-Bus group using that Application ID.
164
169
* For more technical details, see `docs/project-homeassistant-discovery.md`.
| `web_api_key` | password | (empty) | API key required for write operations (`PUT/PATCH/POST`) on label-management endpoints. |
162
-
| `web_allow_unauthenticated_mutations` | boolean | `false` | Unsafe override to allow write operations without API key authentication. |
161
+
| `web_api_key` | password | (empty) | API key required for write operations (`PUT/PATCH/POST`) on label-management endpoints when accessed **directly** (not via Ingress). Requests through Home Assistant Ingress are already authenticated by HA and do not need this key. |
162
+
| `web_allow_unauthenticated_mutations` | boolean | `false` | Unsafe override to allow write operations without authentication on the **directly-exposed** port. Not needed for the Ingress UI. |
163
163
| `web_allowed_origins` | list | `[]` | Optional CORS allowlist of browser origins (e.g. `https://ha.example.com`). Empty disables cross-origin access. |
@@ -360,11 +360,11 @@ Set `ha_discovery_hvac_app_id: 201` to enable HVAC discovery. Use `ha_hvac_tempe
360
360
361
361
This add-on runs with `host_network: false`.
362
362
363
-
- Ingress is enabled and routes the label editor UI through Home Assistant.
363
+
- Ingress is enabled and routes the label editor UI through Home Assistant. Requests arriving via Ingress are already authenticated by Home Assistant (the Supervisor injects an `X-Ingress-Path` header), so label edits and `.cbz`/XML imports work out of the box with no `web_api_key`.
364
364
- Port `8080/tcp` is exposed by the add-on for direct access if needed.
365
365
- Outbound connections to remote C-Gate and MQTT still work normally from the add-on container.
366
366
367
-
If you expose `8080`, set `web_api_key` and keep `web_allow_unauthenticated_mutations: false`.
367
+
If you expose `8080` for direct (non-Ingress) access, set `web_api_key` and keep `web_allow_unauthenticated_mutations: false`. Direct requests never carry the Ingress header, so they always require the key.
0 commit comments