Skip to content

External Generator: own sub-device with dependency-driven availability - #2285

Open
Bl00d-B0b wants to merge 4 commits into
wills106:mainfrom
Bl00d-B0b:feat/external-generator-subdevice
Open

External Generator: own sub-device with dependency-driven availability#2285
Bl00d-B0b wants to merge 4 commits into
wills106:mainfrom
Bl00d-B0b:feat/external-generator-subdevice

Conversation

@Bl00d-B0b

Copy link
Copy Markdown
Contributor

Stacked on #2279 (sub-device infrastructure). Review the last commit only — the diff includes the parent until it merges.

The 33 generator entities were gated by the Dry Contact Box option, which is a different feature — in the SolaX app the external generator is its own tree. They move to a <hub> External Generator device behind a new External Generator Support option (read_gen, off by default, translated in all shipped languages), and each entity only exists while its parent in that tree is active:

External Generator (0xC7): Disabled | ATS Control | Dry Contact
  Start Gen Method (0xE3): only with Dry Contact
    Switch On SoC (0xE4) / Switch Off SoC (0xE5): only with Reference SOC
  Max Run Time (0xE6), Max Rest Time (0xE7), Hold Min Power (0x10E)
  Allow Work Start Time (0xE8) / Allow Work Stop Time (0xE9)
  Max Charge (0xC8)
  Charge Battery from Generator (0x109 Gen4, 0x10C Gen5/Gen6)
    Charge Battery To (0x10A Gen4, 0x10D Gen5/Gen6)
  Schedule 2 (0x104 Gen4, 0x107 Gen5/Gen6)
    unlocks the second Charge Period / Allowed Discharge Period pair

Names follow the cloud app now that the device provides the context: Generator Max ChargeMax Charge (in kW, 0.01 scale, 0–300 kW instead of a raw 10 W register), Generator ChargeCharge Battery from Generator, Generator Min PowerHold Min Power, Generator Time 2Schedule 2, Generator Charge SOCCharge Battery To. Keys and entity ids are unchanged.

Every register mapping was verified live on an X3-Hybrid-G4 15 kW by changing each setting in the SolaX app and tracking the readbacks.

…ptions dialog

Energy Dashboard: the refresh only marked sensors inactive when a feature
switch was turned off - the entity stayed alive and its registry entry was
never removed, so the device accumulated sensors stuck at unavailable
(grid-to-battery, home-consumption and PV-variant sensors). They are now
removed and their registry entries purged.

Generic sub-device infrastructure, used by follow-up PRs that move the
EPS, Parallel, External Generator and Dry Contact families into their own
devices: entity descriptions gain device_group (assigns the entity to a
named sub-device linked to the inverter with via_device, the same pattern
as the battery pack devices) and active_when ({sensor_key: allowed values}
evaluated against polled hub.data; keys not polled on a model never block
availability). The hub tracks gated entities and adds or removes them as
conditions change, with a two-poll hysteresis so a stale readback right
after a write cannot make entities flicker. A sub-device whose option is
switched off is removed from the registry instead of lingering. Switch and
number writes publish the written value immediately, as selects and times
already did. Numbers gain max_key, letting a sensor value override
native_max_value. The number, select, switch, time and sensor platforms
honour all of it. No entities move in this PR.

The options dialog no longer shows feature switches the selected plugin
does not implement, and all feature options now default to off for new
entries, including the Energy Dashboard virtual device.
The 36 EPS entities were mixed into the main inverter device, which on a
hybrid means hundreds of entities in one list. They now use device_group
and appear under "<hub> EPS", linked to the inverter with via_device - the
same pattern the battery pack devices already use. The redundant EPS
prefix is dropped from the names, which the device now provides. Keys and
entity ids are unchanged.

With the Emergency Power Option (EPS) switched off the entities are not
created and the device is removed from the registry instead of lingering
forever.

EPS Mute becomes a switch (write 0x43, readback 0xB7) instead of a
read-only sensor, matching the cloud app.

Stacked on the sub-device infrastructure PR.
The 54 parallel-mode entities move from the main inverter device to
"<hub> Parallel", linked to the inverter with via_device. The redundant
PM prefix is dropped from the names, which the device now provides. Keys
and entity ids are unchanged.

With Parallel Mode (Master-Slave) switched off the entities are not
created and the device is removed from the registry.

Stacked on the sub-device infrastructure PR.
The 33 generator entities were gated by the Dry Contact Box option, which
is a different feature - in the SolaX app the external generator is its
own tree. They move to a "<hub> External Generator" device behind a new
"External Generator Support" option (read_gen, off by default, translated
in all shipped languages), and each entity only exists while its parent in
that tree is active:

  External Generator (0xC7): Disabled | ATS Control | Dry Contact
    Start Gen Method (0xE3): only with Dry Contact
      Switch On/Off SoC (0xE4/0xE5): only with Reference SOC
    Max Run Time (0xE6), Max Rest Time (0xE7), Hold Min Power (0x10E)
    Allow Work Start/Stop Time (0xE8/0xE9), Max Charge (0xC8)
    Charge Battery from Generator (0x109 on Gen4, 0x10C on Gen5/Gen6)
      Charge Battery To (0x10A on Gen4, 0x10D on Gen5/Gen6)
    Schedule 2 (0x104 on Gen4, 0x107 on Gen5/Gen6): unlocks the second
    Charge Period and Allowed Discharge Period time pair

Names follow the cloud app now that the device provides the context, with
keys and entity ids unchanged: Generator Max Charge -> Max Charge (in kW,
0.01 scale, 0-300 kW instead of a raw 10 W register), Generator Charge ->
Charge Battery from Generator, Generator Min Power -> Hold Min Power,
Generator Time 2 -> Schedule 2, Generator Charge SOC -> Charge Battery To.

Verified live on an X3-Hybrid-G4 15kW by changing each setting in the
SolaX app and tracking the readbacks.

Stacked on the sub-device infrastructure PR.
@Bl00d-B0b
Bl00d-B0b force-pushed the feat/external-generator-subdevice branch from 7b74812 to 856376e Compare August 20, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant