Skip to content

Latest commit

 

History

History
662 lines (536 loc) · 63.7 KB

developer_doc.md

File metadata and controls

662 lines (536 loc) · 63.7 KB

Developer changelog

Detailed, technical changelog for developers. End-user-facing release notes live in changelog.md as concise one-liners; this file keeps the full rationale and implementation detail for each release.

v1.7.11

The energy counters keep their value across a restart

MpvEnergySensor.native_value returns _last_value, which __init__ sets to 0 and only async_update copied from the integral (_state). Core's IntegrationSensor.async_added_to_hass restores _state, but the first state was written right after it, before the first poll: 0 for about ten seconds, then the real counter (#61). A total counter going 0 -> 492 kWh is new consumption for a utility meter. async_added_to_hass now sets _last_value from the restored _state; without a stored state it stays 0. Covers the daily and monthly counters too.

v1.7.10

Documentation only. README installs through the Marketplace, which reads only README.md at the installed or latest release, so info.md is removed.

v1.7.9

A refused connect is retried

Firmware a0023006 answers with Connection: close and refuses the next TCP connect for a few milliseconds; setup.jsn, data.jsn and control.html are sent back to back and always hit that window (#60). _retry_refused wraps every request (mypv_dev.jsn in open(), _request, the auth.jsn login and the HTTPS send) and retries a ClientConnectorError whose os_error is a ConnectionRefusedError up to _REFUSED_RETRIES (5) times, _REFUSED_DELAY (0.2 s) apart. Any other connect error fails at once.

The retry runs inside _request's try, so the mode-0 HTTPS fallback from #54 only triggers once a refusal outlasts the retries; a brief refusal no longer flips an HTTP device to HTTPS. A device that only speaks HTTPS pays about one second once before the fallback.

Initialisation failures are logged

_open_and_init returned (None, None) on a MyPVConnectionError without a trace, so the log only showed "No myPV device responded". It now logs a warning with describe_error(err).

v1.7.8

IntegrationSensor takes a required device_class on 2026.11

Core 2026.11 added a device class option to the integral sensor (home-assistant/core#174545) as a required keyword-only device_class argument, so constructing MpvEnergySensor raised a TypeError and the whole entry failed to set up (#58). integration_sensor_args now passes device_class=None when the installed signature has the parameter (_INTEGRATION_SENSOR_TAKES_DEVICE_CLASS), next to the existing hass switch from 2026.8. None keeps the earlier behaviour: core derives the device class from the source sensor, so a power source still yields energy. Passing ENERGY outright would only skip that derivation, and passing it unconditionally would break every core before 2026.11. The frozen-signature test now covers 2026.7, 2026.8 and 2026.11.

v1.7.7

The energy meters stay in kWh, whatever the power sensor displays

MpvEnergySensor builds on core's IntegrationSensor, constructed with unit_prefix="k" over a power source declared in watts. The unit is not taken from that declaration, though: _derive_and_set_attributes_from_state reads ATTR_UNIT_OF_MEASUREMENT off the source's state, and for a sensor with device_class: power that attribute is whatever unit the user picked in the entity settings -- SensorEntity.unit_of_measurement gives _sensor_option_unit_of_measurement the highest priority. Switching the power sensor to kW therefore fed "kW" into _calculate_unit, which appends the time unit and prefixes the "k": "kkWh".

The reading was not wrong -- _update_integral divides by the same prefix, so "kkWh" means exactly what it says -- but Home Assistant cannot convert that unit, so the long-term statistics of a meter that had been recording kWh stopped with "The unit has changed" (issue #55). It only ever showed up on an installation where someone had changed that display unit, which is why it was not reproducible here.

_calculate_unit is now overridden: for a source in W or kW it returns UnitOfEnergy.KILO_WATT_HOUR and sets _unit_prefix to the divisor that belongs to it (1000 or 1), so value and unit are corrected together rather than the label being patched over a wrong number. Any other source unit falls through to core's heuristic instead of being mislabelled. The divisor is set inside _calculate_unit rather than in _derive_and_set_attributes_from_state so that core's own device-class and icon handling -- both derived from the returned unit -- keep working untouched.

v1.7.6

Bug fixes

  • volt_L2 and volt_L3 were plain sensors on an AC-THOR 9s, while volt_mains (L1) was diagnostic (#56, by @vaterlangen). Both keys join _DIAGNOSTIC_DISABLED_KEYS, so MpvSensor.__init__ gives them EntityCategory.DIAGNOSTIC and entity_registry_enabled_default = False like the L1 voltage. Only a 9s is affected -- single-phase devices never report the two keys. On an existing installation the entities keep their registry entry and stay enabled, since entity_registry_enabled_default is read at first creation only; they merely move into the diagnostics section. A fresh setup gets them disabled.

v1.7.5

ptarget as a number entity

The setpoint measured in v1.7.4 is now settable: MpvGridTargetControl in number.py, wired through SETUP_TYPES["ptarget"] with its own grid_target kind so it does not inherit MpvSetupControl's tenths scaling -- setup.jsn carries ptarget in plain watts (ptarget -50 parked an AC ELWA 2 at ~77 W of reported surplus, -500 at ~531 W). Written via set_number, and like the power controls it only adopts the value once the device has taken the write.

The entity exists only where setup.jsn actually carries the key, which the SETUP_TYPES loop already handles -- the Solthor fixture has no ptarget and gets no entity, which the translation-coverage test walks.

Range is -1000..1000 W, step 10 -- the useful envelope rather than the writable one, which setup.jsn does not expose. A target further from zero than a kilowatt has no purpose: it only parks that much of the surplus unused (or draws that much continuously), and the device's own regulation happens well inside that band. ptarget2 is still unmapped.

One write path instead of seven

set_number, set_power, set_control_mode, set_pid_power, switch, activate_boost and firmware_command were ~120 lines of the same try / except MyPVAuthenticationError -> _start_reauth / except _COMM_ERRORS -> warn / return True, copied seven times. They are now one-line callers of _write(device, label, path, params).

The endpoint decides the rest, and that is not a simplification imposed on the code -- it is what all seven were already doing. /setup.jsn writes get send() (password-carrying POST) and a request_setup_refresh(); /control.html writes get command() and have their answer parsed into state_dict for _check_http_control. Every previous method matched that split except for one detail, which turned out to be dead code -- see below.

get_state_dict after a setup.jsn write was dead

set_number and switch parsed the write's response into state_dict; set_control_mode, activate_boost and firmware_command did not. Checked against the hardware (AC ELWA 2, sec_level 2, firmware e0002500): a POST /setup.jsn answers Content-Type: application/json with the entire setup, 4773 bytes over 244 lines, and not one = in the body. get_state_dict looks for key=value lines, so it extracted exactly zero entries -- verified by running it over the captured response. Only control.html returns that status block. The call is gone from the setup path.

Not purely cosmetic: the parser splits any line containing =, so a setting whose value happens to carry one (an SSID, say) would have injected a junk key into state_dict, which is what _check_http_control reads.

setup.jsn writes are not authenticated (AC ELWA 2, e0002500)

Found while checking the above, and the reason the dead call went unnoticed: POST /setup.jsn is accepted and applied with a wrong password, and with no pw field at all -- on a device in sec_level 2, the mode whose whole point is that the config is password-protected.

Measured with every Home Assistant instance on the network shut down, so no session of another client could have been carrying the write: tout was moved 60 -> 61 with no credentials, read back as 61, and restored to 60. All 243 setup keys verified back at their original values afterwards.

Repeated three times -- right after the instances were disabled, later, and again after 25 minutes without a single login attempt from anyone -- because a time-limited session opened by another client's successful login would explain the first result just as well. It went through every time; no device holds a login open for half an hour of silence. The answer to an unauthenticated write is byte-identical to an authenticated one (HTTP 200, the whole setup as JSON), which is why "the device took it" and "the device ignored it" cannot be told apart from the response -- only a read-back distinguishes them.

/auth.jsn is the only endpoint that checks the password. It is what the web UI logs in with, and it rejects a wrong one ({"auth":0,"wait":2}).

Do not take this as licence to stop sending the password on writes. It is one model on one firmware; other devices or later firmware may well enforce it, and a write that silently stops working would be far worse than a redundant field.

One number class instead of three

MpvSetupControl, MpvToutControl and MpvGridTargetControl differed only in bounds, step, unit and whether the device stores tenths -- but each carried its own _handle_coordinator_update and async_set_native_value, and they had drifted: only the timeout survived a missing key, only the grid target checked whether the write arrived before adopting the value. They are now one MpvSetupControl driven by SETUP_NUMBERS, so both behaviours apply to all four settings, and ptarget no longer needs a grid_target kind of its own.

_displayed() converts stored -> shown for the poll and the write alike, so a written value cannot change shape ("50" -> "50.0") at the next poll -- the wart MpvPowerControl documents.

tout keeps being created for every non-Solthor device whether or not the device reports it (some only send it once written), so it is built directly rather than through the SETUP_TYPES loop.

init_entities dispatches through a table

Adding grid_target made the if/elif desc.kind == ... chains in MpyDevice.init_entities the sixteenth branch and took its McCabe complexity to 23, against a repo limit of 25. The kind is now looked up in two dicts mapping it to (collection, class) -- one for data.jsn, one for setup.jsn -- so a key that stands for exactly one entity is a table row rather than a branch. The three that stand for several keep real code, moved into _add_binary_sensor (the AC-THOR 9s relay split), _add_boost_buttons (the start/stop pair) and _add_power_controls (both controls, the reading and its three energy meters). The repeated "is there a usable value" test is _reports().

Complexity 23 -> 11. Two things fell out of the restructuring rather than being aimed at: the allow-list tuples of kinds are gone (the table keys are the allow-list, so a kind can no longer be listed as allowed while having no branch, which "button"/"control" were in the setup loop), and data_keys is gone with them (_reports() covers the absent case, so the list and its O(n) lookup per key were redundant).

Verified as a refactor, not by the suite alone: the entity id, name, translation key and unique id of every entity were dumped for all three fixture models before and after, and the sets are identical.

v1.7.4

Comes out of issue #54, where the reporter feeds his own grid measurement to control.html?pid_power= from a REST command at 1 Hz rather than through the integration. Asked why, he pointed at issue #25: he had tried the entity and it "simply didn't work". Both reasons are in number.py and both are still there.

What pid_power actually is

Measured, not deduced: writing control.html?pid_power=1234 makes the device report a surplus of 1234. So the value is neither a setpoint nor the "upper power bound" README.md and info.md claimed -- it is a measurement of the power at the grid connection point that the device adopts as its surplus and regulates on. Everything else lines up with that: the reporter in #54 sends a signed value (-sensor.vz_power) and the device accepts both signs, the entity's range is ±8388607 rather than 0..9000, and setup.jsn carries ptarget/ ptarget2 -- a target power at the grid, which presupposes a grid measurement. Its purpose is a meter myPV does not support natively: Home Assistant reads it and passes it on, and the control loop stays on the device. Both docs corrected accordingly.

The single write that produced only ~1 W of output was the very start of the rise. Measured afterwards on an AC ELWA 2 (sec_level 2, ptarget -50, tout 60) with the --pid / --simulate modes added to dev_probe.py:

  • Open loop, constant value: the output runs away. A constant 500 W surplus drove the output from 0 to the device maximum (3516 W against 3500 W nominal) and kept it there; 250 W reached the same maximum within 2 s. Nothing in the fed value bounds the output -- the error never disappears, so the controller integrates without limit. This is the trap for anyone who reads the control as a setpoint and parks a fixed number in it.
  • Closed loop: it settles. Writing available - output every 2 s, which is what a meter would report, parks the device at 723 W for 800 W of simulated surplus and at 265 W for 300 W, reached in about five write cycles.
  • The step response is derivative-dominated. A step to 300 W drove the output to 733 W for exactly one cycle and back to 265 W in the next, well below saturation, where a proportional term of that gain would have held the level for as long as the error stood.
  • The residual is the setpoint, not an unintegrated error. With ptarget -50 the loop parks at ~77 W of reported surplus, with ptarget -500 at ~531 W, flat within ±2 W over three minutes. The device regulates the grid power to ptarget and leaves that much of the surplus unused. The offset is not constant across operating points, though: at 300 W fed it was 35 W rather than 77 W.

Together this also answers the write-rate question that runs through #54: the device reacts within one write interval and corrects a step in the cycle after it is reported, so the write interval is the reaction time. README.md and info.md now carry the user-facing half of this.

PID Power is still misleading as an entity name; a rename changes the friendly name for everyone but the entity id only for new installs, so old and new installations would diverge -- deliberately deferred.

Bug fixes

  • KeyError: 'Control State' in MpvPidPowerControl.async_set_native_value -- the traceback from #25, verbatim. device.state_dict is filled by get_state_dict() from a control.html body, so the key does not exist until that endpoint has been read successfully once. Now .get(), and a missing key is treated as unknown, not as not in HTTP control: only a key that is present and not "HTTP" is evidence of anything.
  • The unbounded retry loop is gone. The old code polled the control state and looped set_pid_power() + asyncio.sleep(1) until it read "HTTP", so a single number.set_value could run for the lifetime of the entry. An automation writing at a fixed interval hits this in one of two ways: in mode single every subsequent run is skipped (the "didn't work" of #25), in queued/parallel the loops stack, each adding a request per second. The loop also could not reach its own goal -- the control type is a setup.jsn value (ctrl, exposed as the "Enable HTTP" switch), and no number of control.html writes changes it. One request per call now.

Behaviour

  • _check_http_control() in MpvPowerControl, used by both controls. A device outside HTTP control answers a control.html write normally and discards the value; nothing distinguished that from a working write. The control page arrives in the write's own response and get_state_dict() parses it there, so the check costs no request. _reported_no_http limits it to one warning per mode change -- at 1 Hz, per-write logging would be its own defect. The plain power control never had the KeyError or the loop, because it never looked at the control state at all, but it discards values just as silently, so it gets the same report.
  • The optimistic value is only adopted once the write succeeded. set_power() / set_pid_power() return False on a communication error and neither return was checked, so a failed write still left the requested value on the entity. For power the next poll corrected it from data.jsn; for pid_power nothing ever did -- the device echoes the PID input nowhere (the Power= line of the control page is the output power), so that entity is necessarily optimistic and a failed write would have shown a value the device never saw until the next successful one.
  • async_write_ha_state() after a successful write. MpvEntity is a CoordinatorEntity, hence should_poll is False, and helpers/service.py:829 only re-reads state for polling entities. Both controls assigned _attr_native_value without publishing it, so a written value stayed invisible until the next coordinator update (up to 10 s).
  • The integer that was sent is the value shown. Both writes send int(value) while the entity kept the float, so the state read 2500.0 after a write and 2500 after the next poll.

Tests

test_pid_power_set_value passed throughout, because the fake device serves Control State=HTTP -- neither crash path was reachable from the suite. Added in test_actions.py: a control page without a Control State line (exactly one request, no exception), a device in Modbus control (one request rather than an endless series, warning once and not on the second write), immediate publication of the written value, and a failed write leaving the previous value in place.

Not changed

  • device.pid_power / pid_power_set are read nowhere outside MpvPidPowerControl, and the counter only delays the reset-to-zero by two cycles. Cleanup, not a fix; left for its own commit.
  • MpvSetupControl / MpvToutControl share the optimistic-value question, but they write setup.jsn and trigger request_setup_refresh(), so the next poll corrects them within ~10 s.
  • A failed write still does not raise. HomeAssistantError would make it visible to automations, but on the reporter's device -- refused connections at 1 Hz -- it would turn a silently-continuing automation into a failing one, and test_number_set_value_handles_command_error pins the current contract. That is a deliberate behaviour change, not a bug fix.

v1.7.3

Follow-up on issue #54: 1.7.2 made the cause visible, and it was not the one its three changes addressed. The reporter's new log read MyPVConnectionError <- ClientConnectorError: Cannot connect to host 192.168.21.75:80 <- ConnectionRefusedError.

Diagnosis

  • Refused, not timed out, and on port 80. The integration only sends data.jsn and control.html over plain HTTP (_HTTP_IN_SEC0), and only when sec_level == 0. Our own field data (see the v1.6.6 section) records the converse: a refusal on port 80 is the signature of encryption mode 1/2. So the device behaves like mode 1/2 while we believe it is in mode 0.
  • It is the HTTPS connection. A MyPVConnectionError with a chained cause can only come from the except ... raise ... from exc path, i.e. an open session whose request failed. An HTTP-only entry would already have failed in open(), which returns False and produced a cause-less error. That also explains the persistence the reporter saw: with sec_level 0 on an HTTPS connection the port-80 request fails on every poll, forever.
  • It does retry. DataUpdateCoordinator logs a failure only while last_update_success is still true (update_coordinator.py:438), and the control.html backoff drops to debug after three tries -- hence three lines and then silence, which read as "it gave up".

Fixes

  • The HTTP downgrade is no longer trusted blindly. A ClientConnectorError on a downgraded path sets _http_refused, and the request is retried over the connection's own protocol; _downgrades_to_http() then skips the downgrade for the rest of the connection's life. The HTTPS server runs in every mode, so the fallback is safe, and it heals without a reload. Not reset on recovery: HTTPS works in mode 0 too, so there is nothing to gain by downgrading again.
  • MyPVConnectionError now carries the URL and the reported mode (_connection_error()), replacing every bare raise. The mismatch that took a round trip with the reporter to establish is now in the first log line: http://…:80 … (sec_level 0).
  • describe_error() can no longer raise. ClientConnectorError.__str__ dereferences self._conn_key, which is not always populated -- found by the new tests, where a synthetic instance made the formatter throw. Since it runs inside except handlers, that would have turned a handled connection error into a crash: a defect introduced by 1.7.2 itself.

Open question

Whether sec_level really reads 0 on the reporter's device decides the root fix: if it does, the downgrade rule is wrong and _HTTP_IN_SEC0 should go entirely; if it does not, our stored value went stale and that is where the bug lives. The "Encryption" diagnostic sensor shows the value directly. The fallback is correct either way, which is why it shipped without waiting for the answer.

v1.7.2

Prompted by issue #54 ("All entities reported as unavailable"), whose two log excerpts both ended at the colon with nothing after it.

Bug fixes

  • MyPVConnectionError is raised bare, so %s logged nothing -- the reported symptom, and the reason the report could not identify its own cause. TimeoutError, ClientConnectionError, ClientOSError and ClientPayloadError all stringify to "" as well, so even passing the original through would have logged an empty line for the common cases. New describe_error() in connection.py names the type and walks __cause__ (cycle-guarded), and every _COMM_ERRORS log site in communicate.py now routes through it. The transport already chained the real error via raise MyPVConnectionError from exc; only the formatting discarded it.

Behaviour

  • A single failed poll no longer blanks every entity. MpvEntity is a plain CoordinatorEntity, so last_update_success = False made all of them unavailable at once -- the sawtooth in the reporter's graph. _async_update_data now tolerates _POLL_FAILURES_TOLERATED (3, ~30 s) consecutive failures, keeping the last values, and only then raises UpdateFailed. Guarded by _had_poll_success so a device that never answers still fails setup instead of appearing to work.
  • setup.jsn is no longer read every cycle. Per poll and device the integration issued three sequential requests (data.jsn, setup.jsn, control.html) against a web server that serves one connection at a time, with a 5 s request timeout at a 10 s interval. setup.jsn backs eight entities, all of them settings (devmode, bstmode, ww1target, ww1boost, ctrl twice, tout, sec_level) -- no measurement, so throttling it costs no resolution. Now read every _SETUP_REFRESH_CYCLES (12, ~2 min) via MpyDevice.setup_skip, cutting the request load by a third.
    • request_setup_refresh() resets the counter after every write that touches /setup.jsn (set_number, set_control_mode, switch, activate_boost), so a user's own change is still confirmed on the next poll.
    • A failed poll also resets it: sec_level selects HTTP vs HTTPS per endpoint at runtime, and it is visible only in setup.jsn. An encryption-mode change at the device would otherwise keep every other endpoint failing against the wrong protocol until the throttle elapsed.

Tests

  • describe_error over the silent error types, the cause chain and a self-referential cause.
  • The tolerance both ways: a short dropout keeps last_update_success true and the budget resets on recovery; a lasting one still fails.
  • The setup.jsn cadence asserted as a property (at most one read per window while every poll reads data.jsn), not as an exact count -- the counter is already part-elapsed when a test starts.

v1.7.1

Bug fixes

  • The capability half of supports_remote_install() locked out the AC.THOR (issue #52, fix contributed by @marmer1 in #53). The check required upd_percentage, which I had generalised from exactly two AC ELWA 2 captures (e0002410 without it, e0002500 with). An AC.THOR on a0022401 reports no percentage at all and counts remaining files instead (upd_files_left), so the update entity offered PROGRESS only and the install stayed unavailable -- even though a0020000, the minimum for that series, is the one value taken from my-PV's own library config rather than inferred. The version gate was right; the extra safeguard built for the guessed e-series threshold was what blocked the family with the documented one.
  • The second key is now named _FILES_LEFT_KEY alongside _PROGRESS_KEY, with the family difference recorded next to it.

Tests

  • test_remote_install_needs_a_progress_indicator is parametrized over both families and both bare cases; verified to fail for the AC.THOR case with the fix reverted.

v1.7.0

Promotion of v1.7.0b2, code unchanged. The two beta sections below stay as the record of how the version gate got fixed.

Verified on hardware

  • The version gate: the reporter's AC ELWA 2 (e0002500) is offered the install, and Home Assistant moved the entity from Diagnostic to Config, which is UpdateEntity.entity_category reacting to UpdateEntityFeature.INSTALL — so core does see the feature.

Not verified on hardware

  • The install sequence itself. The device reports fwversion == fwversionlatest and upd_state == 0, so there was no pending update to run it against; it has only been exercised against the fakes. The failure mode is bounded: firmware_download merely downloads, upd_state == 10 is a stable state from which the installation can still be started from the device's own web interface, and a device that ignores the keys runs into the 5 minute timeout and reports a translated error.
  • Whether the device would even find an update is open: nothing in the integration triggers the library's check_fwupd command, and homeassistant.update_entity only reaches CoordinatorEntity.async_update(), i.e. a plain data.jsn re-read. When the device checks with my-PV is entirely up to the device.

v1.7.0b2

Bug fixes

  • The b1 version gate excluded every AC ELWA 2 — i.e. the device the feature was written for. It required the a series (>=a0020000), taken from the my-PV library's shared base config. But the version series identifies the device family, not a common numbering: a is the AC•THOR, e the AC ELWA 2, s the Solthor, and the library's own ELWA config gates setup.mainmode on >=e0001000. Since upstream never evaluates any of these strings, the mismatch cannot surface there. Confirmed against hardware: the reporter's AC ELWA 2 runs e0002500, so b1 would never have offered the install button.
  • Fix: a minimum per series plus a capability check. _INSTALL_MIN_FW = {"a": 20000, "e": 2500}; a series without an entry (Solthor) stays report-only. Because a version number cannot be compared across series, supports_remote_install() additionally requires the device to report upd_percentage — the two ELWA captures bracket this nicely: the older e0002410 in fake_elwa.py does not report the key at all, the e0002500 capture does. supports_remote_install() therefore takes the whole data dict now, not just the version string.

New feature

  • Co-controller firmware entity. The devices report a third firmware part next to the control and power unit: coversion / coversionlatest / co_upd_state (ec104 on the captured ELWA). The my-PV library knows coversion as "Co-controller version" but neither the latest-version nor the update-state key. Report-only, like the power unit parts.

Tests

  • The AC ELWA 2 fixture used fwversion: "a0001234" and psversion: "d0005678" — an AC•THOR-shaped version on an ELWA, which is precisely what hid the bug above. It now mirrors the real capture (e0002500 / ep109 / ec104 plus upd_percentage, ps_upd_state, co_upd_state), so the translation-coverage test also exercises the new entity.
  • test_remote_install_gate_by_series covers both series' minimums and the unknown-series case; test_remote_install_needs_the_progress_key covers the capability half.

v1.7.0b1

New feature

  • Firmware installation from Home Assistant. MpvFwUpdate gained UpdateEntityFeature.INSTALL, driving the sequence the my-PV reference library implements in MyPVDevice.update_firmware() (added there in py-mypv 0.0.6, 2026-07-20): at upd_state == 1 send firmware_download, wait for upd_state == 10, send firmware_update, wait for upd_state == 0. Both commands are ordinary setup.jsn writes ({"firmware_download": 1} / {"firmware_update": 1}), added as MypvCommunicator.firmware_command() alongside activate_boost(). Each step has a 5 minute timeout and polls every 5 s through coordinator.async_refresh(), whose failures are swallowed — the device reboots while installing, so failing polls are expected. Errors are translated (exceptions block in strings.json, new for this integration).
  • This corrects the assumption the entity was built on. The old comment claimed "the device downloads and installs new firmware on its own"; upd_state == 10 is literally "Download finished, waiting for installation", so without the command the device sits there.
  • Version gate. The library's device configs declare "firmware": ">=a0020000" on both commands — and never evaluate it (supports_command() only checks the advanced flag, so upstream offers the commands on any device). We do evaluate it: supports_remote_install() requires the a series and seven digits >= 0020000, so a Solthor (s…) and any pre-a0020000 device keeps the old report-only behaviour. Only the control unit is installable — whether firmware_download also drives the power unit parts (ps_upd_state, p9s_upd_state) is unverified, so those stay report-only.
  • The other firmware gate in the library's configs, for reference: setup.mainmode on the AC ELWA 2 needs >=e0001000.

Bug fixes

  • in_progress was computed but never shown. UpdateEntity.state_attributes is @final and only reads the in_progress property when UpdateEntityFeature.PROGRESS is set; otherwise it uses its own private flag, which moves only while HA itself installs. The entity had no features at all, so a download running on the device stayed invisible. PROGRESS is now a class-level default on every part, INSTALL is added on top where supported. update_percentage reports upd_percentage during the download states (2/3/4) — HA blanks it outside in_progress anyway.

Notes

  • Our upd_state enum is more complete than the library's: we know 0,1,2,3,4,5,10 plus the Solthor offset, upstream only 0,1,3,10. Its download wait keys on 10 with the upd_percentage == 100 check commented out, so an interrupted download (5) runs into its timeout.
  • Released as a beta: the install path writes to live heating hardware and has only been exercised against fakes.

v1.6.9

Bug fixes

  • sensor.<ac_thor_9s>_output_status lost its state class on devices that report rel1_out as a string (issue #50, "Die Entität hat keine Zustandsklasse mehr"). MpvSensor.__init__ decides the state class by sniffing the raw first reading (device.data.get(key)), but MpvOutStatSensor publishes something else — the last digit of the zero-padded relay word, always an int. Reproduced with the 9s fixture: rel1_out=101 → state '1', state_class=measurement; rel1_out="0101" → same state '1', state_class=None. The isinstance(value, str) branch in _handle_coordinator_update has been there since v0.9.4 ("Fix for AC-THOR 9s detection and binary values"), so string-reporting 9s are real. History: up to v1.3.2 every MpvSensor had a hardcoded MEASUREMENT; e6c52b6 (v1.3.3) switched to "no unit → no state class", which took it away; 03e8c9d (v1.4.5) gave it back for numeric readings — but only when the raw value is numeric. So this entity has been without a state class since v1.3.3 on those devices, and anyone updating from ≤1.3.2 now gets the statistics repair.
  • Fix: MpvOutStatSensor pins _attr_state_class = MEASUREMENT and opts out of the reading-based check via the new _state_class_from_reading = False. The class attribute alone is not enough — the base __init__ assigns the instance attribute and would still override it. MEASUREMENT over a proper ENUM on purpose: an enum would change the states from a number to text and break the users' history and automations, while the value is numeric and did carry statistics before.
  • The Surplus sensor's state class depended on startup timing. "surplus" is MpvDescription("Surplus", None, "sensor_always") — numeric, unitless, and deliberately created before its first value arrives. The sniff then saw None, concluded "not numeric" and dropped the state class; when the device did report the key at startup, it kept it. That flips between restarts and raises the same repair repeatedly. Now only a reading that is actually present may take the state class away. Safe, because sensor_always is the only kind built without a sample (all others require key in data), and its single member is numeric.
  • number.<device>_control_value_timeout was never created on devices without a tout setting (found while reproducing the above: Error adding entity number.… KeyError: 'tout'). MpvToutControl is appended for every non-Solthor device (mypv_device.py:235), but _handle_coordinator_update read self.device.setup["tout"] unguarded, so the first update raised while the entity was being added and it disappeared entirely. It now skips the update and stays unknown, mirroring MpvSensor.

Tests

  • test_outstat_keeps_measurement_for_any_raw_type is parametrized over both raw types, test_sensor_without_reading_keeps_measurement covers the Surplus case, and test_9s_entities_without_a_control_value_timeout sets up a 9s whose setup.jsn has no tout and asserts the number entity exists and is unknown. All three verified to fail with the fixes stashed.

Open

  • What the last digit of rel1_out actually encodes is still unconfirmed (digits 0-2 are the Relais / Out 3 / Out 2 binary sensors). If it turns out to be a small enum rather than a level, an ENUM sensor would be the honest model — but only worth it alongside a migration that does not silently break existing statistics and automations.

v1.6.8

Bug fixes

  • Setup failed on HA Core 2026.8 with TypeError: IntegrationSensor.__init__() takes 1 positional argument but 2 positional arguments (and 8 keyword-only arguments) were given (issue #51, reported against 2026.8.0b2). MpvEnergySensor.__init__ passed device.comm.hass positionally, which every core up to 2026.7 required. Core PR #177596 ("Do not set a device on YAML integration entities", merged 2026-07-30, milestone 2026.8.0, commit afad195652f) removed the parameter: since #177459 entity_platform warns when an entity attaches a device without a config entry, and the constructor unconditionally did self.device_entry = async_entity_id_to_device(hass, source_entity) — also for YAML setups, where that link was never persisted anyway. The lookup therefore moved out to the caller as a new optional keyword device: DeviceEntry | None = None, leaving hass unused and dropped. Signature verified against the release tags: 2026.7.4 and 2026.8.0b0 still take hass, 2026.8.0b1 and later do not. The whole integration was dead on 2026.8 — init_entities() raises before any platform is set up.
  • Fix: derive the call shape from the installed signature. The issue reporter's patch (just delete the argument) is correct on 2026.8 but breaks every core from 2026.4 (our hacs.json minimum) through 2026.7, where hass is mandatory. _INTEGRATION_SENSOR_TAKES_HASS inspects inspect.signature(IntegrationSensor.__init__).parameters once at import, and the new integration_sensor_args() helper adds hass only when the installed core still declares it. Inspection rather than a version comparison, so betas and any backport are handled correctly too.
  • device is deliberately not passed on 2026.8+. On the old core the dropped lookup resolved the source entity's device, i.e. the same myPV device the energy sensor already gets from MpvEntity's _attr_device_info (MpvSensor.__init__ runs right after, and EntityPlatform sets device_entry from the device info when adding). Passing it would be redundant; the device assignment is unchanged in practice.

Tests

  • test_integration_sensor_args_match_core is parametrized over frozen copies of both real signatures (2026.7 and 2026.8) and binds the produced arguments against each with inspect.Signature.bind — the exact TypeError from the issue is what it catches. test_integration_sensor_args_bind_to_installed_core does the same against the IntegrationSensor actually installed, so the next signature change surfaces here rather than in a user's log.
  • This needed integration_sensor_args() to be a module-level helper: the arguments are otherwise built inline inside __init__ and are not reachable without constructing a full entity.

v1.6.7

Bug fixes

  • Energy sensors integrated a source entity that does not exist on a translated installation. MpvEnergySensor.__init__ built the IntegrationSensor source id as f"sensor.{slugify(name_by_user + '_' + source.name)}" — i.e. from the English description name (Power ELWA-2). The display name is resolved through translation_key, so on a German installation the power sensor is registered as sensor.<device>_leistung_elwa_2 while the energy sensors kept integrating sensor.<device>_power_elwa_2. Nothing ever reported under that id, so int_/intd_/intm_ sensors stayed at 0 and — because IntegrationSensor derives its unit from the source — carried no unit_of_measurement either. Reported for an AC ELWA 2 on a German install; every non-English user is affected, and so is anyone who renamed their power sensor (the same string-built id breaks on rename).
  • Fix: resolve the source through the entity registry by unique id. The unique id (f"{serial}_{source.name}") is derived from the raw English name and is both language- and rename-proof. async_added_to_hass looks the real entity id up and rebinds _sensor_source_id (state tracking) and _source_entity (initial value + restore) before delegating to IntegrationSensor; by then the power sensor is registered, as it is added ahead of the energy sensors on the same platform. The construction-time string id remains only as a placeholder, and a failed lookup now logs a warning instead of integrating silently into nothing. The name_by_user device-registry walk this needed is gone.
  • Note this was collateral damage of the v1.4.2 translation fix (del self._attr_name, so the translated name is used): that is what made the entity id language-dependent, invalidating the assumption the source id was built on.

Tests

  • test_energy_sensors_bind_to_the_translated_power_sensor sets hass.config.language = "de", resolves the power entity from the registry, asserts its id really is the German one, and then asserts the public source attribute of all three energy sensors points at it. Verified to fail against the old string-built id, so it is a genuine regression guard — in English the old code would have passed.

Open

  • button.stop_boost does not stop a running boost (reported alongside the above; present in 1.6.3 too, so not a regression). activate_boost(device, 0) writes POST /setup.jsn {"bststrt": 0}, and the device evidently ignores it: bststrt looks like a one-shot trigger rather than a flag, and setup.jsn carries no boost-stop key (only bstmode and ww1boost). The reporter stops a boost by switching bstmode off. Needs a setup.jsn dump taken while a boost runs and again after stopping it from the device's own web interface, to see which key actually changes — guessing a write to live heating hardware is not acceptable.

v1.6.6

Changes

Structural follow-up to v1.6.5, which only removed the trigger. control_enabled conflated two unrelated questions — "can the device do this?" (capability) and "is the read working right now?" (runtime health) — and answered both with one latch that could only ever go from True to False. Both halves are now separated.

  • Entity existence no longer depends on the control read. The control_enabled gate is gone from init_entities() (boost buttons and the power number entities). It was always redundant for capability: those entities are already gated on key in data_keys, and boostactive is a data.jsn key, so a device without boost support simply does not offer it. The gate contributed nothing except the failure mode reported against 1.6.4 — a read failing at setup silently stripping working entities.
  • The control read backs off instead of giving up. control_enabled is replaced by control_failures / control_skip. The first _CONTROL_FAILURES_BEFORE_BACKOFF (3) consecutive failures are retried at the full poll rate and logged as warnings; after that the read is retried only every _CONTROL_RETRY_CYCLES (30) polls — ~5 min at the 10 s SCAN_INTERVAL — and logged at debug, so a device that genuinely does not serve the endpoint is not hammered. A single success resets the counter.
  • This fixes a second, older bug unrelated to 1.6.4. control_enabled never returned to True, and MpyDevice.update() gated the whole state read on it. One transient timeout — near-certain over days against a device that serves a single connection at a time, polled every 10 s — permanently froze the control state on its last value until the entry was reloaded. That has been latent since long before the 1.6.4 regression.

Field data (reporter, three AC-THORs — confirms the mechanism, refutes the v1.6.5 remedy)

  • http://<ip>/control.html → connection refused (the device serves no plain HTTP, so sec_level is 1 or 2 and the integration correctly routes control.html over HTTPS); https://<ip>/control.html → 404.
  • v1.6.5 did not help; a downgrade to 1.6.3 restored the entities. So the 404 carries no usable body — empty or a bare error page — and if text.strip() never fires. The v1.6.5 remedy was aimed at a sloppy status with a good body; the reality is a genuine 404. The mechanism (the control_enabled gate) was right, the assumed payload was not.
  • Why 1.6.3 worked is now fully explained: it returned the empty body unconditionally, get_state_dict("") produced an empty dict without raising, state_update() returned True, the gate stayed open and the entities were built.
  • The device evidently 404s the parameter-less read specifically (that is what was tested in a browser). Whether it accepts control.html with query args is unknown, so the power number entities may or may not steer on this firmware — unchanged from 1.6.3 either way.
  • The boost buttons are unaffected by all of this: activate_boost() writes POST /setup.jsn {"bststrt": …} and never touches control.html. They were gated on an endpoint they do not use, which is the clearest argument that the gate was simply wrong.

Tests

  • test_boost_buttons_exist_when_the_control_read_fails is an end-to-end regression guard: it sets up an entry whose control.html always raises and asserts the boost buttons are in the entity registry. Verified to fail with the old gate reinstated, so it is not a vacuous test. Required a new per-path DeviceSpec.text_errors in the fake world (the existing error field fails every read, which would have failed setup outright rather than modelling this case).
  • test_state_update_failure_backs_off_then_recovers replaces test_state_update_failure_disables_control, covering the counter, the backoff and the recovery.

v1.6.5

Bug fixes

  • Boost buttons and power controls vanished after 1.6.4 (regression). v1.6.4 turned every non-200 read into a MyPVConnectionError. On the control.html status read that is fatal in a way that is invisible in the logs: MpyDevice.initialize() calls state_update() before init_entities(), state_update() catches MyPVConnectionError and latches control_enabled = False (communicate.py), and init_entities() gates the boost buttons and the power number entities on that flag (mypv_device.py). Everything fed from setup.jsn — including the bstmode "Enable Boost Mode" switch, which lives in SETUP_TYPES and is built in a separate, ungated loop — survives. Reported symptom (three AC-THORs, unchanged config, 1.6.3 fine / 1.6.4 broken): switch present, button.start_boost / button.stop_boost gone. That split falls exactly along the control_enabled gate, not along "boost-related", which is what identified the mechanism.
  • _request now accepts a response that is a 200 or carries a non-empty body. Embedded myPV firmware answers some endpoints with a sloppy status while the payload is perfectly good — the suspected trigger is the parameter-less control.html read (state_update is the only caller without query args; commands always pass some). The status is a channel independent of the body, and up to 1.6.3 the transport ignored it entirely, which is why this never surfaced before. Precedence on a non-200 is now: cached body (keeps the v1.6.4 transient-429 protection) → non-empty body (v1.6.3 behaviour) → MyPVConnectionError. Only 200 bodies are cached, so an error page can never poison the cache and later be served as device state.
  • Note the parser is deliberately unbreakable here: get_state_dict only picks key=value out of lines not starting with <, so even a useless body yields an empty dict rather than an exception — under 1.6.3 that still left control_enabled True and the buttons in place. The boost command itself is a different request (control.html with query args), so it may well have been working all along even where the status read was not.

Open

  • The exact HTTP status the reporter's AC-THOR returns is still unknown (no log yet); 400/404 on the parameter-less read are the working hypotheses. Redirects are ruled out (aiohttp follows them), as is a malformed status line (that raises ClientError, which already failed identically in 1.6.3). If 1.6.5 does not fix it, the next datum needed is the raw curl -sk -D - http://<IP>/control.html output.
  • The deeper design issue is untouched by choice: entity existence is still decided by a single read at setup time, so any future transport hiccup can strip the control entities again. Decoupling capability from runtime health (or retrying before latching control_enabled) remains the structural fix. Done in v1.6.6. Deliberately held back from 1.6.5 so that release stayed a single-variable experiment: with the decoupling shipped too, the buttons would reappear for the reporter either way and we would never learn what the device actually answers on control.html.

v1.6.4

Changes

Runtime robustness, informed by reading the my-pv==0.0.2 reference library (which the integration no longer depends on but which models the device's session behaviour). The library authenticates once in open() and then reuses the aiohttp ClientSession — i.e. relies on the session cookie the device sets at login — for every subsequent read/write; it never re-authenticates per request, and on any unexpected HTTP status (including 429) it returns {} rather than crashing.

  • Transient non-200 no longer crashes the poll. _request now raises MyPVAuthenticationError on 401 and, for any other non-200 (e.g. a 429 rate limit), returns the last cached body for that read path (self._cache, keyed by path, populated on each 200 read with no query). Previously the non-JSON body was passed to json.loads → JSONDecodeError → UpdateFailed → all entities unavailable with no reauth prompt. With no cached value yet it is a transient MyPVConnectionError.
  • Removed per-request re-authentication. The _reauthenticate / _get_once / _post_once retry-on-401 added in v1.6.3 is gone; the connection logs in once (open()) and reuses the session like the library. This cuts auth.jsn traffic (the device rate-limits / locks out on frequent logins) and simplifies the read/write paths back to a single request.

Note: the exact production trigger (a device 429 under sustained polling) was inferred from the library diff, not reproduced live; the fix is a robustness improvement regardless and mirrors the library's own handling. Two-phase transport model, verified on real e0002410. The earlier attempts to derive the transport during detection kept tripping over the device's grace window (after a login, setup.jsn reads stay open for a while, so a password-less probe is unreliable) and over a sec_level 0 + password device that serves data.jsn/control.html over HTTP but protects setup.jsn over HTTPS. The clean split:

  • Phase 1 — detection (config_flow._check_host, simple). A working HTTPS connection means new firmware, which always has a login password (it can only be changed, not removed): the integration's initial login opens the device's grace window so reads/writes work afterwards. So new firmware always routes to the password step; plain HTTP means old firmware (no password). sec_level is not read here — it needs the (grace-dependent, pre-login) setup.jsn, so it is deferred to runtime.
  • Phase 2 — runtime (respects sec_level). After the login, setup_update() reads setup.jsn (over the connection's own protocol -> HTTPS on new firmware) and calls connection.set_sec_level(). The connection then routes per endpoint via _scheme_for(): sec_level 0 serves data.jsn/control.html over plain HTTP, everything else (and setup.jsn + auth.jsn) over HTTPS; sec_level 1/2 use HTTPS throughout. setup.jsn is the deliberate exception (_HTTP_IN_SEC0 excludes it) because the firmware protects it over HTTPS even in HTTP mode.
  • sec_level 1 vs 2. A 401 on a read or a setup.jsn write triggers a single _reauthenticate() (re-run auth.jsn) and retry before surfacing as an auth error — covers a shorter grace window in mode 2; a no-op under the endless grace of modes 0/1.
  • Self-heal (_setup_host) simplified to match. An old plain-HTTP entry (no password) whose device is now new firmware can no longer read it; if the device speaks HTTPS and no password is stored, it routes to reauth. The former sec_level-probing / no-password-HTTPS-upgrade / _persist_https() paths are gone. _open_and_init() now also maps a MyPVAuthenticationError raised during device.initialize() (a read 401 that re-auth could not satisfy) to ConfigEntryAuthFailed.
  • CONF_SSL is no longer written by the config flow (a stored password implies HTTPS; the runtime transport follows sec_level); it is still read for backwards compatibility with pre-1.6.3 entries.

v1.6.2

Changes

  • A reachable-but-unreadable device routes to the password step instead of failing at setup. mypv_dev.jsn (the discovery/identity beacon) answers over plain HTTP in every state, including a device still locked in its initial state after a firmware update — but setup.jsn/data.jsn are gated behind a login there, so sec_level cannot be read over any password-less channel. _check_host previously fell through to auth_required=False in that case (no password prompt → the config entry was created HTTP-only → setup then raised ConfigEntryNotReady "No myPV device responded"). It now returns auth_required=True whenever the device is reachable but setup came back None from both the HTTP and the password-less HTTPS probe, so the user gets the password step. The password step description also tells the user to set the initial password on the device's own web interface (initial password = device key) first. sec_level 0 with open HTTP reads is unaffected: setup.jsn reads there, sec_level is 0, and no auth flow is triggered.

v1.6.1

Changes

  • Self-healing transport on a post-setup encryption-mode change. An already-configured entry stores its transport (CONF_SSL / CONF_PASSWORD); if the device's sec_level is later changed, the stored transport can no longer read (mypv_dev.jsn still answers over plain HTTP in every mode, so open() succeeds, but the first real read of setup.jsn is redirected → MyPVConnectionError → an endless ConfigEntryNotReady retry). MypvCommunicator.initialize() now heals this: _setup_host() opens + initialises via _open_and_init(), and on failure re-reads sec_level over password-less HTTPS (_probe_sec_level(), open in every mode) — 2 without a stored password raises ConfigEntryAuthFailed (reauth for the password); 1/2 while on plain HTTP upgrades to HTTPS and persists CONF_SSL (_persist_https()). It also covers the inverse: reads that succeed over HTTP while the device reports sec_level ≥ 1 are upgraded to HTTPS too (otherwise control.html would be redirected). Connections expose is_https for the HTTP-vs-HTTPS decision. A wrong stored password still raises ConfigEntryAuthFailed from open() directly.

v1.6.0

Changes

  • Removed the my-pv library dependency — the transport is now built in. connection.py is self-contained (own aiohttp ClientSession lifecycle, own MyPVConnectionError / MyPVAuthenticationError; manifest.json requirements: []). The library was 0.0.2 and did not match the real firmware (wrong auth encoding, POST-vs-GET writes, no HTTPS-without-password); we had already overridden almost everything, and its HTTP _auth (GET http://…/auth.jsn with ssl=True) actively broke detection on new firmware — /auth.jsn is HTTPS-redirected there, so the self-signed cert raised MyPVAuthenticationError in every mode. Base _Connection gives open() (session + mypv_dev.jsn), is_open(), close(), get_json()/get_text() (raw, key-preserving), send(), command(); MypvHttpConnection (http) and MypvHttpsConnection (https, ssl=False, optional password) specialise it.
  • All three firmware encryption modes supported and auto-detected. sec_level governs only the control.html channel; data/setup stay open and the HTTPS server runs in every mode. Contract (verified on real e0002410): reads and control.html power steering are open (no password) everywhere; config writes are POST /setup.jsn (with pw only in mode 2); the browser-encoded password (_encode_form) gates only /auth.jsn. create_connection(host, password, use_https) picks HTTPS when a password is set or use_https, else HTTP; communicate reads CONF_SSL and passes use_https.
    • Detection (_check_host): the encryption mode is read straight from setup.jsn's sec_level (0 HTTP / 1 HTTPS / 2 HTTPS + password). mypv_dev.jsn is served over plain HTTP in every mode (it is the discovery/identity endpoint), so it only proves reachability and gives the name — it does not distinguish the mode (an earlier redirect-probe wrongly assumed mypv_dev.jsn is redirected in mode 2; only data.jsn/setup.jsn/control.html are). setup.jsn is readable over plain HTTP in modes 0/1 (and old firmware) and over HTTPS without a password in every mode, so detection tries HTTP then HTTPS and classifies by sec_level: 2 → password step (CONF_PASSWORD, which already implies HTTPS); 1 → CONF_SSL: True (HTTPS, no password); 0 or absent (old firmware) → plain HTTP.
  • Two write channels. send() = config writes (POST /setup.jsn, pw appended only when set); command() = power steering (GET /control.html?…, never carries pw — the channel is open, so the password stays out of URLs).
  • New "Encryption" enum sensor (MpvEncSensor, diagnostic) reflecting setup.sec_level → HTTP / HTTPS / HTTPS+PW.
  • Reauth unchanged in spirit: a wrong stored password → open() raises MyPVAuthenticationError → ConfigEntryAuthFailed on setup/poll, or _start_reauth() on a user command.

Verified on hardware (e0002410)

  • The device contract (all three modes: reads, config writes, boost, control.html power steering, login encoding) was confirmed live. The rebuilt self-contained transport + sec_level auto-detection were re-verified live against the real device in all three modes: mode 0 (HTTP), mode 1 (HTTPS, no password — reads/control.html/config write over HTTPS), and mode 2 (HTTPS + password — detection routes to the password step, login/reads/control.html/config write over the authenticated HTTPS session). The mode-2 detection fix (read sec_level rather than assume mypv_dev.jsn is redirected) was validated on hardware.

v1.5.0

Changes

  • Transport moved onto the official my-pv library (requirements: ["my-pv==0.0.2"]). A new connection.py subclasses the library's MyPVHTTPConnection / MyPVHTTPSConnection (MypvHttpConnection / MypvHttpsConnection) and adds the raw access the integration needs: get_json() returns data.jsn / setup.jsn unmodified (the library lowercases keys, which would break volt_L2 etc.), and get_text() provides plain-text access for the control.html power steering the library does not expose. Requests are serialised per device via a per-connection asyncio.Lock (replacing the former single global lock). MypvCommunicator keeps the exact same public method surface (data_update, setup_update, state_update, set_number, set_power, set_pid_power, set_control_mode, switch, activate_boost, get_state_dict), so mypv_device.py, const.py and every entity platform are unchanged. Device values stay raw — the library's value/config layer (MyPVDevice + bundled configs) is deliberately bypassed, so entity scaling (°C/10, Hz/1000, A/10) and unique ids are identical.
  • Authentication. The config flow probes the device through the library; if it redirects to HTTPS (MyPVAuthenticationError), a password step is shown and the password is stored in entry.data[CONF_PASSWORD]. Old HTTP-only firmware is detected as before and needs no password. A reauth / reauth_confirm flow updates the password if it later becomes invalid; at runtime an auth failure during the cyclic poll raises ConfigEntryAuthFailed, and an auth failure during a user command starts reauth directly (MypvCommunicator._start_reauth). Each device gets its own library connection (its own session/auth), and connections are closed on unload (MypvCommunicator.async_close).
  • Transport hardening. connection._request reads the body inside an async with block so the response is always released — including on the 401 (auth) path, which previously leaked the connection until GC.
  • Tests reseamed onto the connection layer. The suite no longer mocks aiohttp; create_connection is patched to a FakeWorld / FakeConnection (one DeviceSpec per IP), so unreachable / auth-protected / dropping devices are modelled directly. New test_connection.py exercises the real MypvHttpConnection against a mocked session (query encoding, JSON parsing, 401→auth + response release, connection-error mapping, per-device serialisation, create_connection factory), plus new password/reauth/command-auth coverage. config_flow now routes through create_connection (single seam) and the dead check_ip was removed. Run with the Python 3.14 dev-container.

Open / to verify

  • HTTPS/auth path ships as experimental. Basic interaction with an auth-firmware device (e0002410) has been confirmed on real hardware with no HA log errors; broader confirmation is still pending — in particular control.html?power=… power steering over the authenticated HTTPS session. The plain-HTTP path on old firmware is byte-for-byte unchanged.

v1.4.6

Bug fixes

  • control_state sensor (MpvDevStatSensor) decoded the device state wrongly (#42): control.html's State field is the myPV operation-state code (0 Standby, 1 Heat, 2 Boost heat, 3 Heat finished, 4 No control — confirmed against live AC-ELWA-2 captures and the AC-THOR Controls doc), but DEV_STATE_ENUM was built from the different "status codes" table and read with a + 1 offset. Net effect: every state except Heat was scrambled (e.g. State=3 "target reached" showed boost_heat). Fixed by re-keying DEV_STATE_ENUM/DEV_STATE_ENUM_SOLTHOR to the raw operation-state codes and indexing them directly (no offset); missing State now keeps the last value. Affects all devices, not just one model. The >=200 power-stage error codes and the 20/21/22 (SolThor 21/22/23) Legionella/disabled/blocked entries are kept best-effort and still need device verification.

v1.4.5

Bug fixes

  • Numeric sensors without a unit (e.g. meter power sums) keep their measurement state class again, so long-term statistics are tracked instead of triggering "no longer has a state class" warnings. Non-numeric sensors (versions, IPs, status) correctly have none — delete their orphaned statistics via the repair dialog.

v1.4.4

Bug fixes

  • All device requests are serialized; a command (e.g. set power) overlapping the cyclic poll no longer fails with "Connect call failed" (the device serves one connection at a time).

v1.4.3

Bug fixes

  • Device data and setup are fetched sequentially again; concurrent requests overwhelmed the single-connection myPV web server, flipping entities to "unknown" and breaking setup (regression since v1.3.3).

v1.4.2

Bug fixes

  • Energy sensor names are now translated (they were stuck in English regardless of the configured language).

v1.4.1

Improvements

  • German translations for all entity names and states.

v1.4.0

Improvements

  • Entities report their value immediately on startup instead of waiting for the first poll.
  • Setup retries automatically when the device is unreachable; cleaner unload.
  • Declared as a config-entry-only integration (removed the dead YAML import path); passes hassfest without warnings.

Quality

  • Added a test suite (~98% coverage) and a pre-commit suite (ruff + hassfest).

v1.3.3

Improvements

  • Entity names and enum states are now translatable (translation keys); all icons moved to icons.json.
  • Network (IP/subnet/gateway/DNS), screen mode, fan speed, firmware versions, firmware update states, power unit temperature and L1 voltage are now diagnostic sensors, disabled by default.
  • Device data and setup are fetched concurrently and use Home Assistant's shared HTTP session.
  • Coordinator now reports UpdateFailed, so unavailability and ConfigEntryNotReady work correctly.
  • Polling interval is no longer user-configurable (fixed 10 s, per Home Assistant guidelines); the options flow was removed.
  • Large internal cleanup: shared entity base class, fully typed code, ruff/mypy clean.

Bug fixes

  • Non-numeric sensors (e.g. control source) no longer raise a state class error.
  • Reset-energy-sensor service and the "Enable HTTP" switch-off now work.

v1.3.2

New feature

  • Report-only firmware update entities for the control unit and the power unit.