diff --git a/CHANGELOG.md b/CHANGELOG.md index 01a5ac1f..58f4bcec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -259,6 +259,16 @@ hardware. readings now come from the vendor maps, and the ECU's 0xFFFFFFFF "no meter" value stays nil. +### alphaess 1.1.2, kstar 1.1.2, solax 1.1.2, varta 1.1.2 + +These four declare `read_only = true` and say why in their new `DRIVER` +table: no control code has been written for them. Their `driver_command` +only logs and refuses, yet the signed channel shipped them as controlling, +because it counts any `driver_command` as control. FTW then offered control +that could not work. Reading is unchanged. Their channel artifacts change: +the generated header now marks them read-only and drops their write +permissions. + ### zaptec_cloud 0.2.1 The stand-down now acts only after FTW has written a current in this run. diff --git a/README.md b/README.md index 4f3502c4..1178906d 100644 --- a/README.md +++ b/README.md @@ -120,10 +120,16 @@ promoted with `gh workflow run ftw-drivers-release.yml --ref main -f channel=stable`; it accepts only the exact commit `drivers-beta` carries, and serves installs that read the stable channel. -The channel contains every catalog driver as its own signed Lua asset. A driver -the catalog marks `control: true` keeps its control path; every other one is -read-only. Refreshing the signed catalog never installs or activates code. -FTW keeps its own safety, activation, rollback and bundled copies. +The channel contains every catalog driver as its own signed Lua asset. A +driver that can command its device ships with control: its `driver_command` +writes to the device. A driver that cannot declares `read_only = true` in its +`DRIVER` table and says why in its description, and ships read-only. A +`driver_command` that only logs and refuses does not count as control. The +manifest's `control:` field states the same, and `make check` fails when it +disagrees with the code or when a stub ships as control. The catalog page +shows each driver's answer. Refreshing the signed catalog never installs or +activates code. FTW keeps its own safety, activation, rollback and bundled +copies. Each asset name contains the driver ID, semantic version and source hash. FTW downloads only the selected driver. The release workflow never replaces a diff --git a/SUPPORT_STATUS.md b/SUPPORT_STATUS.md index 8b87f684..919402fd 100644 --- a/SUPPORT_STATUS.md +++ b/SUPPORT_STATUS.md @@ -20,8 +20,8 @@ Catalog source is not proof that a target can install or run a driver. | acuvim | 0.4.3 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | alfen | 1.1.1 | ftw-core | not_assessed | — | not_recorded | not_assessed | | alfen | 1.1.1 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | -| alphaess | 1.1.1 | ftw-core | not_assessed | — | not_recorded | not_assessed | -| alphaess | 1.1.1 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | +| alphaess | 1.1.2 | ftw-core | not_assessed | — | not_recorded | not_assessed | +| alphaess | 1.1.2 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | ambibox | 1.2.0 | ftw-core | not_assessed | — | not_recorded | not_assessed | | ambibox | 1.2.0 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | ambibox_v2x | 1.1.1 | ftw-core | not_assessed | — | not_recorded | not_assessed | @@ -90,8 +90,8 @@ Catalog source is not proof that a target can install or run a driver. | konja-261-svk | 0.3.2 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | kostal | 2.1.2 | ftw-core | not_assessed | — | not_recorded | not_assessed | | kostal | 2.1.2 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | -| kstar | 1.1.1 | ftw-core | not_assessed | — | not_recorded | not_assessed | -| kstar | 1.1.1 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | +| kstar | 1.1.2 | ftw-core | not_assessed | — | not_recorded | not_assessed | +| kstar | 1.1.2 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | mennekes | 1.1.1 | ftw-core | not_assessed | — | not_recorded | not_assessed | | mennekes | 1.1.1 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | myuplink | 1.2.4 | ftw-core | not_assessed | — | not_recorded | not_assessed | @@ -148,8 +148,8 @@ Catalog source is not proof that a target can install or run a driver. | solaredge_legacy | 0.3.3 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | solaredge_pv | 1.2.2 | ftw-core | not_assessed | — | not_recorded | not_assessed | | solaredge_pv | 1.2.2 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | -| solax | 1.1.1 | ftw-core | not_assessed | — | not_recorded | not_assessed | -| solax | 1.1.1 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | +| solax | 1.1.2 | ftw-core | not_assessed | — | not_recorded | not_assessed | +| solax | 1.1.2 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | solinteg | 1.1.1 | ftw-core | not_assessed | — | not_recorded | not_assessed | | solinteg | 1.1.1 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | solis | 2.1.1 | ftw-core | not_assessed | — | not_recorded | not_assessed | @@ -172,8 +172,8 @@ Catalog source is not proof that a target can install or run a driver. | tibber | 1.1.2 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | vag_vehicle | 0.3.0 | ftw-core | not_assessed | — | not_recorded | not_assessed | | vag_vehicle | 0.3.0 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | -| varta | 1.1.1 | ftw-core | not_assessed | — | not_recorded | not_assessed | -| varta | 1.1.1 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | +| varta | 1.1.2 | ftw-core | not_assessed | — | not_recorded | not_assessed | +| varta | 1.1.2 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | victron | 2.1.2 | ftw-core | not_assessed | — | not_recorded | not_assessed | | victron | 2.1.2 | blixt-l1 | not_assessed | — | not_recorded | not_assessed | | victron_mqtt | 1.0.3 | ftw-core | not_assessed | — | not_recorded | not_assessed | diff --git a/devices.yaml b/devices.yaml index 49a8959b..9b3679db 100644 --- a/devices.yaml +++ b/devices.yaml @@ -135,7 +135,7 @@ manufacturers: protocols: - protocol: modbus driver: "alphaess" - version: "1.1.1" + version: "1.1.2" ders: [pv, battery, meter] control: false firmware_versions: "" @@ -146,7 +146,7 @@ manufacturers: protocols: - protocol: modbus driver: "alphaess" - version: "1.1.1" + version: "1.1.2" ders: [pv, battery, meter] control: false firmware_versions: "" @@ -259,7 +259,7 @@ manufacturers: driver: "deye" version: "2.1.1" ders: [battery, meter, pv] - control: false + control: true firmware_versions: "" notes: "Single-phase hybrid with LV battery" - name: "SUN String (Grid-Tie)" @@ -270,7 +270,7 @@ manufacturers: driver: "deye" version: "2.1.1" ders: [battery, meter, pv] - control: false + control: true firmware_versions: "" notes: "Three-phase grid-tie string inverter (PV + meter only)" - name: "SUN Three-Phase HV Hybrid" @@ -281,7 +281,7 @@ manufacturers: driver: "deye" version: "2.1.1" ders: [battery, meter, pv] - control: false + control: true firmware_versions: "" notes: "Three-phase hybrid with HV battery" - name: "SUN Three-Phase Hybrid" @@ -292,7 +292,7 @@ manufacturers: driver: "deye" version: "2.1.1" ders: [battery, meter, pv] - control: false + control: true firmware_versions: "" notes: "Three-phase hybrid, supports LV and HV variants with runtime detection" - name: "SUN-xK-SG0xLP3 / HP3 hybrid" @@ -761,7 +761,7 @@ manufacturers: protocols: - protocol: modbus driver: "kstar" - version: "1.1.1" + version: "1.1.2" ders: [pv, battery, meter] control: false firmware_versions: "" @@ -772,7 +772,7 @@ manufacturers: protocols: - protocol: modbus driver: "kstar" - version: "1.1.1" + version: "1.1.2" ders: [pv, battery, meter] control: false firmware_versions: "" @@ -1047,7 +1047,7 @@ manufacturers: driver: "pixii" version: "2.1.9" ders: [battery, meter] - control: false + control: true firmware_versions: "" notes: "" - name: "Remne Technologies" @@ -1511,7 +1511,7 @@ manufacturers: protocols: - protocol: modbus driver: "solax" - version: "1.1.1" + version: "1.1.2" ders: [pv, battery, meter] control: false firmware_versions: "" @@ -1522,7 +1522,7 @@ manufacturers: protocols: - protocol: modbus driver: "solax" - version: "1.1.1" + version: "1.1.2" ders: [pv, battery, meter] control: false firmware_versions: "" @@ -1533,7 +1533,7 @@ manufacturers: protocols: - protocol: modbus driver: "solax" - version: "1.1.1" + version: "1.1.2" ders: [pv, battery, meter] control: false firmware_versions: "" @@ -1544,7 +1544,7 @@ manufacturers: protocols: - protocol: modbus driver: "solax" - version: "1.1.1" + version: "1.1.2" ders: [pv, battery, meter] control: false firmware_versions: "" @@ -1559,7 +1559,7 @@ manufacturers: driver: "solaredge" version: "2.1.1" ders: [meter, pv] - control: false + control: true firmware_versions: "" notes: "Single-phase string inverters, port 1502" - name: "SE Series (Three-Phase)" @@ -1570,7 +1570,7 @@ manufacturers: driver: "solaredge" version: "2.1.1" ders: [meter, pv] - control: false + control: true firmware_versions: "" notes: "Three-phase string inverters, port 1502" - name: "SolarEdge Home" @@ -1581,7 +1581,7 @@ manufacturers: driver: "solaredge" version: "2.1.1" ders: [meter, pv] - control: false + control: true firmware_versions: "" notes: "Residential single-phase series" - name: "SolarEdge inverter (PV only)" @@ -1614,7 +1614,7 @@ manufacturers: driver: "solaredge" version: "2.1.1" ders: [meter, pv] - control: false + control: true firmware_versions: "" notes: "Hybrid inverters with battery support" - name: "Solinteg" @@ -1889,7 +1889,7 @@ manufacturers: protocols: - protocol: modbus driver: "varta" - version: "1.1.1" + version: "1.1.2" ders: [battery, meter] control: false firmware_versions: "" @@ -1900,7 +1900,7 @@ manufacturers: protocols: - protocol: modbus driver: "varta" - version: "1.1.1" + version: "1.1.2" ders: [battery, meter] control: false firmware_versions: "" @@ -1911,7 +1911,7 @@ manufacturers: protocols: - protocol: modbus driver: "varta" - version: "1.1.1" + version: "1.1.2" ders: [battery, meter] control: false firmware_versions: "" diff --git a/drivers/lua/alphaess.lua b/drivers/lua/alphaess.lua index e58b6db7..18b13d46 100644 --- a/drivers/lua/alphaess.lua +++ b/drivers/lua/alphaess.lua @@ -6,6 +6,22 @@ -- Register map from AlphaESS Modbus protocol v1.30 -- Hex addresses converted to decimal +-- No control code has been written for this inverter yet: driver_command +-- only refuses. It says read_only so FTW and the catalog tell the owner +-- plainly, instead of offering control that cannot work. +DRIVER = { + host_api_min = 1, + host_api_max = 1, + id = "alphaess", + name = "AlphaESS inverter", + manufacturer = "AlphaESS", + version = "1.1.2", + protocols = { "modbus" }, + capabilities = { "pv", "battery", "meter" }, + read_only = true, + description = "AlphaESS Smile and G2 series inverters via Modbus TCP. Read-only: no control code has been written for it yet, so FTW reads it but cannot charge or discharge the battery.", +} + PROTOCOL = "modbus" -- A register the inverter never answers costs a failed read on every poll for diff --git a/drivers/lua/kstar.lua b/drivers/lua/kstar.lua index 09c976bd..c231164b 100644 --- a/drivers/lua/kstar.lua +++ b/drivers/lua/kstar.lua @@ -4,6 +4,22 @@ -- Port: 502 -- Community tier (untested) +-- No control code has been written for this inverter yet: driver_command +-- only refuses. It says read_only so FTW and the catalog tell the owner +-- plainly, instead of offering control that cannot work. +DRIVER = { + host_api_min = 1, + host_api_max = 1, + id = "kstar", + name = "KSTAR inverter", + manufacturer = "KSTAR", + version = "1.1.2", + protocols = { "modbus" }, + capabilities = { "pv", "battery", "meter" }, + read_only = true, + description = "KSTAR KSE and BluE-S series inverters via Modbus TCP. Read-only: no control code has been written for it yet, so FTW reads it but cannot charge or discharge the battery.", +} + PROTOCOL = "modbus" -- Reading a register the device does not have costs a failed read on every diff --git a/drivers/lua/solax.lua b/drivers/lua/solax.lua index 3723cd79..45f48c73 100644 --- a/drivers/lua/solax.lua +++ b/drivers/lua/solax.lua @@ -5,6 +5,22 @@ -- Port: 502 -- Community tier (untested) +-- No control code has been written for this inverter yet: driver_command +-- only refuses. It says read_only so FTW and the catalog tell the owner +-- plainly, instead of offering control that cannot work. +DRIVER = { + host_api_min = 1, + host_api_max = 1, + id = "solax", + name = "SolaX X1/X3 inverter", + manufacturer = "SolaX", + version = "1.1.2", + protocols = { "modbus" }, + capabilities = { "pv", "battery", "meter" }, + read_only = true, + description = "SolaX X1 and X3 hybrid and string inverters via Modbus TCP. Read-only: no control code has been written for it yet, so FTW reads it but cannot charge or discharge the battery.", +} + PROTOCOL = "modbus" -- Reading a register the device does not have costs a failed read on every diff --git a/drivers/lua/varta.lua b/drivers/lua/varta.lua index 44faffef..3e7bed4a 100644 --- a/drivers/lua/varta.lua +++ b/drivers/lua/varta.lua @@ -5,6 +5,22 @@ -- Port: 502 -- Community tier (untested) +-- No control code has been written for this storage yet: driver_command +-- only refuses. It says read_only so FTW and the catalog tell the owner +-- plainly, instead of offering control that cannot work. +DRIVER = { + host_api_min = 1, + host_api_max = 1, + id = "varta", + name = "VARTA storage", + manufacturer = "VARTA", + version = "1.1.2", + protocols = { "modbus" }, + capabilities = { "battery", "meter" }, + read_only = true, + description = "VARTA pulse neo, element and link storage via Modbus TCP. Read-only: no control code has been written for it yet, so FTW reads it but cannot charge or discharge the battery.", +} + PROTOCOL = "modbus" -- The host counts every failed modbus_read against the poll whether or not diff --git a/index.yaml b/index.yaml index e3bb580c..5b7c4348 100644 --- a/index.yaml +++ b/index.yaml @@ -75,14 +75,14 @@ drivers: size_bytes: 23895 sha256: "e38da421ba6e5d3ceed2e9c6b7fdd620537b34e63ca48da14ac1e42080b133d0" - name: "alphaess" - version: "1.1.1" + version: "1.1.2" tier: community protocol: modbus connectivity: local ders: [pv, battery, meter] control: false - size_bytes: 4031 - sha256: "eb76e0ff3be764a001b110a82a58f75ad967d4610d866eeb37e99802624fc07d" + size_bytes: 4704 + sha256: "a7721ee771ad5d818df1e870e3556d34b553405d122693d731aea7685647a1aa" - name: "ambibox" version: "1.2.0" tier: core @@ -182,7 +182,7 @@ drivers: protocol: modbus connectivity: local ders: [battery, meter, pv] - control: false + control: true size_bytes: 23467 sha256: "5fdc1acd72f881ff02696e765df0528a68f300fa9ca557a4fba068874f0129df" - name: "easee_cloud" @@ -403,14 +403,14 @@ drivers: size_bytes: 11222 sha256: "d85eabff2e1cb3076c27c0d980bd93c4c26df3d27a4801310baec30fda96c127" - name: "kstar" - version: "1.1.1" + version: "1.1.2" tier: community protocol: modbus connectivity: local ders: [pv, battery, meter] control: false - size_bytes: 3615 - sha256: "c6e41381f5a59f197b8e9899a770c32acd1e49c4c70a9faa3fec6b43f291d862" + size_bytes: 4278 + sha256: "77442a239ebdc41832c86cc39f5186cd5f74d782a7c9c455743a2c7f6c0f59f1" - name: "mennekes" version: "1.1.1" tier: community @@ -513,7 +513,7 @@ drivers: protocol: modbus connectivity: local ders: [battery, meter] - control: false + control: true size_bytes: 32519 sha256: "77e233e2d24e970ebff8eaacd67967f57b651677d25ce7b57a1f97c3eaeb71fe" - name: "pixii_pv" @@ -652,7 +652,7 @@ drivers: protocol: modbus connectivity: local ders: [meter, pv] - control: false + control: true size_bytes: 21555 sha256: "94b5f18fb42c1413540d7321bca47ed755c8a0a9b069f8d51dbac4384910c496" - name: "solaredge_legacy" @@ -674,14 +674,14 @@ drivers: size_bytes: 12121 sha256: "50d0d07dd92d14f93d3a4ba123fa7e036762437eee450e2caea6556d3b770582" - name: "solax" - version: "1.1.1" + version: "1.1.2" tier: community protocol: modbus connectivity: local ders: [pv, battery, meter] control: false - size_bytes: 5110 - sha256: "b5f07776c959d4891a0487c23a3bc7e29b8c9c063eaaef754b98f0572cc547b2" + size_bytes: 5785 + sha256: "f52388cbe300dc8af699baac59ce52ffe1c489b4303409926d4d694ee82198af" - name: "solinteg" version: "1.1.1" tier: community @@ -788,14 +788,14 @@ drivers: size_bytes: 47864 sha256: "fcaa4a44ce26438f3c89d26e8ed3056ea4a195a3516a9ca9ed698c4eca42c5d3" - name: "varta" - version: "1.1.1" + version: "1.1.2" tier: community protocol: modbus connectivity: local ders: [battery, meter] control: false - size_bytes: 2794 - sha256: "68eb714ff41551437e50ac0a1e9bca4e4d70eca8a43006c7481cfc8761fdf60d" + size_bytes: 3453 + sha256: "198a19deb76ee9ebc3b693922240ceafe61f32b7ce467bbc142a0b0f7b7f9e77" - name: "victron" version: "2.1.2" tier: community diff --git a/manifests/alphaess.yaml b/manifests/alphaess.yaml index ecab864e..c970f3a7 100644 --- a/manifests/alphaess.yaml +++ b/manifests/alphaess.yaml @@ -1,5 +1,5 @@ name: "alphaess" -version: "1.1.1" +version: "1.1.2" tier: community author: "Sourceful Labs AB" protocol: modbus @@ -22,9 +22,9 @@ tested_devices: notes: "Community driver, untested" min_driver_version: "1.0.0" min_host_version: "2.0.0" -size_bytes: 4031 +size_bytes: 4704 dkb_id: "" -sha256: "eb76e0ff3be764a001b110a82a58f75ad967d4610d866eeb37e99802624fc07d" +sha256: "a7721ee771ad5d818df1e870e3556d34b553405d122693d731aea7685647a1aa" signature: "" bytecode_sha256: "" diff --git a/manifests/deye.yaml b/manifests/deye.yaml index 2211f2a2..811b01be 100644 --- a/manifests/deye.yaml +++ b/manifests/deye.yaml @@ -5,7 +5,7 @@ author: "Sourceful Labs AB" protocol: modbus connectivity: local ders: [battery, meter, pv] -control: false +control: true tested_devices: - manufacturer: "Deye" model_family: "SUN Single-Phase Hybrid (LV)" diff --git a/manifests/kstar.yaml b/manifests/kstar.yaml index d61c05ca..750c8791 100644 --- a/manifests/kstar.yaml +++ b/manifests/kstar.yaml @@ -1,5 +1,5 @@ name: "kstar" -version: "1.1.1" +version: "1.1.2" tier: community author: "Sourceful Labs AB" protocol: modbus @@ -22,9 +22,9 @@ tested_devices: notes: "Community driver, untested" min_driver_version: "1.0.0" min_host_version: "2.0.0" -size_bytes: 3615 +size_bytes: 4278 dkb_id: "" -sha256: "c6e41381f5a59f197b8e9899a770c32acd1e49c4c70a9faa3fec6b43f291d862" +sha256: "77442a239ebdc41832c86cc39f5186cd5f74d782a7c9c455743a2c7f6c0f59f1" signature: "" bytecode_sha256: "" diff --git a/manifests/pixii.yaml b/manifests/pixii.yaml index c8a20883..083a6fc6 100644 --- a/manifests/pixii.yaml +++ b/manifests/pixii.yaml @@ -5,7 +5,7 @@ author: "Sourceful Labs AB and community contributors" protocol: modbus connectivity: local ders: [battery, meter] -control: false +control: true tested_devices: - manufacturer: "Pixii" model_family: "PowerShaper" diff --git a/manifests/solaredge.yaml b/manifests/solaredge.yaml index 992acb86..ebfae807 100644 --- a/manifests/solaredge.yaml +++ b/manifests/solaredge.yaml @@ -5,7 +5,7 @@ author: "Sourceful Labs AB" protocol: modbus connectivity: local ders: [meter, pv] -control: false +control: true tested_devices: - manufacturer: "SolarEdge" model_family: "SE Series (Single-Phase)" diff --git a/manifests/solax.yaml b/manifests/solax.yaml index de5f487c..bb6a818a 100644 --- a/manifests/solax.yaml +++ b/manifests/solax.yaml @@ -1,5 +1,5 @@ name: "solax" -version: "1.1.1" +version: "1.1.2" tier: community author: "Sourceful Labs AB" protocol: modbus @@ -36,9 +36,9 @@ tested_devices: notes: "Community driver, untested" min_driver_version: "1.0.0" min_host_version: "2.0.0" -size_bytes: 5110 +size_bytes: 5785 dkb_id: "" -sha256: "b5f07776c959d4891a0487c23a3bc7e29b8c9c063eaaef754b98f0572cc547b2" +sha256: "f52388cbe300dc8af699baac59ce52ffe1c489b4303409926d4d694ee82198af" signature: "" bytecode_sha256: "" diff --git a/manifests/varta.yaml b/manifests/varta.yaml index 887ba9c7..57a298be 100644 --- a/manifests/varta.yaml +++ b/manifests/varta.yaml @@ -1,5 +1,5 @@ name: "varta" -version: "1.1.1" +version: "1.1.2" tier: community author: "Sourceful Labs AB" protocol: modbus @@ -29,9 +29,9 @@ tested_devices: notes: "Community driver, untested" min_driver_version: "1.0.0" min_host_version: "2.0.0" -size_bytes: 2794 +size_bytes: 3453 dkb_id: "" -sha256: "68eb714ff41551437e50ac0a1e9bca4e4d70eca8a43006c7481cfc8761fdf60d" +sha256: "198a19deb76ee9ebc3b693922240ceafe61f32b7ce467bbc142a0b0f7b7f9e77" signature: "" bytecode_sha256: "" diff --git a/spec/manifest-v2.md b/spec/manifest-v2.md index cf1bc8f8..ab097b61 100644 --- a/spec/manifest-v2.md +++ b/spec/manifest-v2.md @@ -14,7 +14,7 @@ Each driver has a YAML manifest in `manifests/` that describes its metadata, cap | `connectivity` | string | Yes | `local` or `cloud` — where the driver talks while running | | `setup` | list | No | What a human must obtain before it connects (see below) | | `ders` | list | Yes | DER types the driver covers (see below) | -| `control` | bool | Yes | Whether the driver supports EMS control commands | +| `control` | bool | Yes | Whether FTW can command the device through this driver: `driver_command` writes to it and the `DRIVER` table does not declare `read_only = true`. A stub that only refuses is `false` and declares `read_only` | | `tested_devices` | list | No | Devices tested against (see below) | | `upstream_docs` | list | No | Vendor reference documents to watch for register/protocol changes (see below) | | `min_host_version` | string | No | Minimum gateway firmware version required | diff --git a/support-status.json b/support-status.json index 53a611d1..1028c435 100644 --- a/support-status.json +++ b/support-status.json @@ -170,7 +170,7 @@ }, { "catalog_source": true, - "catalog_version": "1.1.1", + "catalog_version": "1.1.2", "driver_id": "alphaess", "targets": { "blixt-l1": { @@ -905,7 +905,7 @@ }, { "catalog_source": true, - "catalog_version": "1.1.1", + "catalog_version": "1.1.2", "driver_id": "kstar", "targets": { "blixt-l1": { @@ -1514,7 +1514,7 @@ }, { "catalog_source": true, - "catalog_version": "1.1.1", + "catalog_version": "1.1.2", "driver_id": "solax", "targets": { "blixt-l1": { @@ -1766,7 +1766,7 @@ }, { "catalog_source": true, - "catalog_version": "1.1.1", + "catalog_version": "1.1.2", "driver_id": "varta", "targets": { "blixt-l1": { diff --git a/tests/test_control_claims.py b/tests/test_control_claims.py index c15e7a03..8b18f2bb 100644 --- a/tests/test_control_claims.py +++ b/tests/test_control_claims.py @@ -18,9 +18,13 @@ from __future__ import annotations import re +import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / "tools")) + +from ftw_repository import driver_controls # noqa: E402 # Keywords that open a Lua block, for balancing against `end`. OPENERS = re.compile(r"\b(function|if|for|while|do)\b") @@ -28,6 +32,10 @@ ELSEIF = re.compile(r"\belseif\b") CALL = re.compile(r"\b([A-Za-z_][A-Za-z_0-9.]*)\s*\(") NOT_A_CALL = {"function", "if", "while", "for", "return", "and", "or", "not"} +# Calls that cannot reach the device. A stub that logs "not yet implemented" +# and refuses is still a refusal: alphaess, kstar, solax and varta shipped as +# controlling that way. +CANNOT_ACTUATE = {"host.log", "tostring", "tonumber", "type"} def control_flag(manifest: Path) -> str: @@ -66,7 +74,8 @@ def is_inert(body: str) -> bool: # signature, not a call, and counting it made every body look busy. lines = re.sub(r"--.*$", "", body, flags=re.M).split("\n")[1:] code = "\n".join(line for line in lines if line.strip()) - calls = [c for c in CALL.findall(code) if c not in NOT_A_CALL] + calls = [c for c in CALL.findall(code) + if c not in NOT_A_CALL and c not in CANNOT_ACTUATE] return not calls @@ -116,8 +125,52 @@ def test_a_refusal_stub_is_recognised_as_inert() -> None: ' if action == "init" or action == "deinit" then return true end\n' " return false\n" "end") + # Logging the refusal does not make it a control path. + assert is_inert( + "function driver_command(action, power_w, cmd)\n" + ' host.log("AlphaESS control not yet implemented: " .. action)\n' + " return false\n" + "end") # Reaching any call at all is not. assert not is_inert( "function driver_command(action, value)\n" " return host.modbus_write(40001, value)\n" "end") + + +def test_the_manifest_control_flag_matches_the_code() -> None: + """`control:` in a manifest says what the signed channel ships. + + The channel decides control from the code (`driver_controls`), and + index.yaml and devices.yaml copy the manifest's flag. Seven manifests said + control: false for drivers the channel shipped with control, so those two + files told a reader less than FTW would do. A driver that gains or loses + its control path changes this flag in the same pull request. + """ + wrong = [] + for manifest in sorted((ROOT / "manifests").glob("*.yaml")): + source = ROOT / "drivers" / "lua" / f"{manifest.stem}.lua" + code = driver_controls(source.read_text(encoding="utf-8")) + if (control_flag(manifest) == "true") is not code: + wrong.append(f"{manifest.stem} (manifest {control_flag(manifest)}, code {str(code).lower()})") + assert not wrong, "control: disagrees with the driver code: " + ", ".join(wrong) + + +def test_a_logging_stub_cannot_be_published_as_control() -> None: + """A driver whose driver_command only logs and refuses must say read_only. + + The channel counts any driver_command as control, so a stub without + read_only = true ships as controlling and the catalog says so. Every such + driver has to declare read_only, which keeps its manifest at control: + false through the agreement check above. + """ + stubs = [] + for source in sorted((ROOT / "drivers" / "lua").glob("*.lua")): + text = source.read_text(encoding="utf-8") + body = function_source(text, "driver_command") + if body is not None and is_inert(body) and driver_controls(text): + stubs.append(source.stem) + assert not stubs, ( + "these drivers ship as controlling but their driver_command only " + f"refuses: {stubs}. Declare read_only = true in the DRIVER table and " + "say why in its description.") diff --git a/tests/test_ftw_repository.py b/tests/test_ftw_repository.py index 79510f1a..de041dca 100644 --- a/tests/test_ftw_repository.py +++ b/tests/test_ftw_repository.py @@ -176,10 +176,12 @@ def test_publication_contains_the_full_read_only_catalog( # driver_command, and publishing them unable to use it was the whole # problem: the same file could drive a battery bundled and not downloaded. controlling = {d["id"] for d in manifest["drivers"] if d["control_enabled"]} - assert {"sungrow", "pixii", "alphaess", "ferroamp"} <= controlling + assert {"sungrow", "pixii", "deye", "ferroamp"} <= controlling # And a driver that declares read_only in its own DRIVER table stays a - # meter, whatever anything else says. - assert not ({"sdm630", "zap", "esphome_dsmr", "myuplink"} & controlling) + # meter, whatever anything else says. alphaess, kstar, solax and varta + # declare it because their driver_command only refuses. + assert not ({"sdm630", "zap", "esphome_dsmr", "myuplink", + "alphaess", "kstar", "solax", "varta"} & controlling) # nibe_local dropped read_only for its opt-in Solar PV surplus feed and # declares write_capabilities, so the channel must publish it as control. assert "nibe_local" in controlling diff --git a/tests/test_site.py b/tests/test_site.py index d4888977..d2bebbd3 100644 --- a/tests/test_site.py +++ b/tests/test_site.py @@ -24,6 +24,7 @@ sys.path.insert(0, str(ROOT / "tools")) import generate_site # noqa: E402 +from ftw_repository import _load_channel # noqa: E402 from manifest_parser import parse_upstream_docs, parse_yaml_simple # noqa: E402 @@ -58,7 +59,6 @@ def test_versions_match_the_manifests(catalog: dict) -> None: (ROOT / "manifests" / f"{driver['id']}.yaml").read_text(encoding="utf-8")) assert driver["version"] == manifest.get("version"), driver["id"] assert driver["tier"] == manifest.get("tier", "community"), driver["id"] - assert driver["control"] == bool(manifest.get("control", False)), driver["id"] def test_hardware_claims_come_only_from_the_driver_source(catalog: dict) -> None: @@ -196,3 +196,106 @@ def test_page_lists_every_driver_without_javascript(rendered: Path) -> None: noscript = html[html.index("")] for driver_id in sorted(manifest_ids()): assert driver_id in noscript, f"{driver_id} is missing from the noscript list" + + +def test_control_is_what_the_signed_channel_publishes(catalog: dict) -> None: + """The page says a driver controls only when the channel ships it so. + + A Zaptec Go owner read nothing that said FTW would only watch the charger. + The manifest's control field had drifted from the code before, so the page + takes the answer from the same rule the channel build uses. + """ + published = { + entry["id"]: entry["controls"] + for entry in _load_channel(ROOT / "ftw-channel.json", ROOT) + } + for driver in catalog["drivers"]: + assert driver["control"] is published[driver["id"]], driver["id"] + assert (driver["control_state"] == "controls") is driver["control"], driver["id"] + + +def test_every_driver_says_what_ftw_can_do(catalog: dict) -> None: + """One of three answers, each in words, for every driver.""" + for driver in catalog["drivers"]: + state = driver["control_state"] + assert state in generate_site.CONTROL_STATES, driver["id"] + assert driver["control_label"] == generate_site.CONTROL_STATES[state] + assert driver["control_note"].strip(), driver["id"] + if state == "telemetry": + # Only a meter or PV driver may be quietly read-only. + assert driver["ders"], driver["id"] + assert set(driver["ders"]) <= generate_site.TELEMETRY_DERS, driver["id"] + if state == "reads_only": + assert "cannot control" in driver["control_note"], driver["id"] + if state == "controls" and not driver["hardware_verified"]: + assert "Experimental" in driver["control_note"], driver["id"] + if state != "reads_only": + assert not driver["control_reason"], driver["id"] + + +def test_a_read_only_charger_says_why(catalog: dict) -> None: + """A charger FTW cannot steer says so, with the driver's own reason. + + zaptec_cloud started this: it read the charger and never said why it did + not control. It controls now, as an experiment until a field report, and + tesla_wall_connector is the charger that cannot, because Tesla offers no + way to set its current. + """ + by_id = {d["id"]: d for d in catalog["drivers"]} + zaptec = by_id["zaptec_cloud"] + assert zaptec["control_state"] == "controls" + assert "Experimental" in zaptec["control_note"] + wall = by_id["tesla_wall_connector"] + assert wall["control_state"] == "reads_only" + assert "turns its control off" in wall["control_note"] + assert wall["control_reason"].startswith("Tesla offers no way"), ( + "the reason must not repeat the note it follows") + assert len(wall["control_reason"]) <= generate_site.MAX_REASON_CHARS + 1 + + +def test_a_reason_that_only_repeats_the_note_is_dropped(catalog: dict) -> None: + """sonnen's "Read-only." and zap's "never writes" add nothing to the note.""" + by_id = {d["id"]: d for d in catalog["drivers"]} + assert by_id["sonnen"]["control_state"] == "reads_only" + assert by_id["sonnen"]["control_reason"] == "" + assert by_id["zap"]["control_reason"] == "" + for driver in catalog["drivers"]: + reason = driver["control_reason"] + assert not generate_site.REASON_LEAD_IN.match(reason), driver["id"] + assert not reason or reason[0].isupper() or not reason[0].isalpha(), driver["id"] + # The four stub drivers now say why in their own description. + for driver_id in ("alphaess", "kstar", "solax", "varta"): + assert by_id[driver_id]["control_state"] == "reads_only", driver_id + assert by_id[driver_id]["control_reason"].startswith( + "No control code has been written"), driver_id + + +def test_a_product_description_is_not_a_reason() -> None: + """Text that never mentions reading or control is left out.""" + assert generate_site.read_only_reason( + "Zaptec Go / Go 2 / Pro via Zaptec Cloud.", ["Community driver, untested"], + ["Wallbox Commander 2 EV Charger Driver", "Emits: V2X Charger (READ-ONLY)"]) == "" + assert generate_site.read_only_reason( + "Huawei SUN2000 via Modbus TCP. Read-only until a held-zero command is verified.", + [], []) == "Read-only until a held-zero command is verified." + + +def test_the_card_and_device_view_render_the_control_state() -> None: + """Guard the rendering, as for the documents.""" + script = generate_site.SCRIPT + card = script[script.index("function driverCard"): + script.index("function manufacturerView")] + assert "d.control_label" in card and "d.control_note" in card + assert "d.control_reason" in card and "controlNote +" in card + devices = script[script.index("function manufacturerView"): + script.index("function render()")] + assert "row.driver.control_label" in devices + + +def test_page_says_what_ftw_can_do_without_javascript(rendered: Path, catalog: dict) -> None: + html = (rendered / "index.html").read_text(encoding="utf-8") + noscript = html[html.index("")] + for driver in catalog["drivers"]: + row = re.search(rf"
' + + "" + esc(d.control_label) + "" + esc(d.control_note) + + (d.control_reason + ? 'In the driver’s words: ' + esc(d.control_reason) + "" : "") + + "
"; var reach = d.connectivity ? '' + (d.connectivity === "cloud" ? "Cloud" : "Local") + "" @@ -724,6 +881,7 @@ def embed_json(payload: dict) -> str: "" + '' + esc(d.description) + "
" : "") + + controlNote + sourceNote + verified + modelsTable(d) + @@ -760,7 +918,8 @@ def embed_json(payload: dict) -> str: (row.dev.notes ? '{totals['drivers']} drivers
@@ -1008,7 +1168,7 @@ def render_html(catalog: dict) -> str: