Skip to content

Commit dec4ff8

Browse files
committed
log_bold
1 parent 2019a43 commit dec4ff8

5 files changed

Lines changed: 37 additions & 26 deletions

File tree

‎.cursor/skills/release/SKILL.md‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,27 @@ Run from the **sunsynk** repo root. Stop with a clear message unless **all** pas
3838
3. Use the new version string and change the `## Unreleased` heading in
3939
`hass-addon-sunsynk-edge/CHANGELOG.md` to `## Release x.x.x`
4040
4. Copy `hass-addon-sunsynk-edge/CHANGELOG.md` to `hass-addon-sunsynk-multi/CHANGELOG.md`
41-
5. Commit using the release number (`0.0.0` form) as the message and push to GitHub
42-
6. Create a draft GitHub release with tag `v0.0.0` (semantic version preceded by `v`)
43-
7. Notify the user to review and **publish** the draft release on GitHub to start the release
41+
5. In `www/docs/reference/multi-options.md`, remove every edge-only option prefix
42+
`<i-mdi-dev-to class="vp-edge-option-icon" />` (list items and table cells). Leave the `::: tip`
43+
block unchanged — it stays for future edge-only options.
44+
6. Commit using the release number (`0.0.0` form) as the message and push to GitHub
45+
7. Create a draft GitHub release with tag `v0.0.0` (semantic version preceded by `v`)
46+
8. Notify the user to review and **publish** the draft release on GitHub to start the release
4447
process
4548

4649
## Implementation notes
4750

4851
- Read current version from `[project]` → `version = "..."` in `pyproject.toml`.
4952
- Heading match is case-insensitive for `## Unreleased`; write `## Release <new_version>` (no `v`
5053
prefix).
51-
- Stage only `pyproject.toml`, `hass-addon-sunsynk-edge/CHANGELOG.md`, and
52-
`hass-addon-sunsynk-multi/CHANGELOG.md`. Include `uv.lock` if the version bump changed it. The
53-
multi CHANGELOG copy is the one allowed hand-edit under `hass-addon-sunsynk-multi/` in this skill
54-
(overwrite; do not merge).
54+
- Stage only `pyproject.toml`, `hass-addon-sunsynk-edge/CHANGELOG.md`,
55+
`hass-addon-sunsynk-multi/CHANGELOG.md`, and `www/docs/reference/multi-options.md` (if the edge
56+
prefixes were present). Include `uv.lock` if the version bump changed it. The multi CHANGELOG copy
57+
is the one allowed hand-edit under `hass-addon-sunsynk-multi/` in this skill (overwrite; do not
58+
merge).
59+
- When stripping edge prefixes, delete the HTML tag and the space after it so bullets stay
60+
`- \`OPTION\`` (or the table cell starts with the backtick). Do not touch the tip, and do not
61+
rewrite surrounding option text.
5562
- Do not copy `config.yaml` here. On a published release, `deployer2.yml` copies edge `config.yaml`,
5663
`translations/`, and `apparmor.txt` onto stable except `name`/`slug`, then sets `version` to the
5764
tag.

‎src/ha_addon_sunsynk_multi/a_inverter.py‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ def serial_matches_config(self) -> bool:
183183
expected_ser = self.opt.serial_nr.replace("_", "")
184184
actual_ser = str(self.identity.serial)
185185
if expected_ser != actual_ser:
186-
raise ValueError(
187-
f"Serial number mismatch. Expected {expected_ser}, got {actual_ser}"
188-
)
186+
msg = f"Serial number mismatch. Expected {expected_ser}, got {actual_ser}"
187+
self.log_bold(msg)
188+
raise ValueError(msg)
189189
return True
190190

191191
async def read_sensors(self, *, sensors: Iterable[Sensor], msg: str = "") -> bool:
@@ -282,13 +282,7 @@ async def connect(self) -> None:
282282
) from exc
283283

284284
assert self.identity is not None
285-
_LOG.info(
286-
"Identity: device_type=%s (%s) protocol=%s serial=****%s",
287-
self.identity.device_type,
288-
hex(self.identity.device_type_code),
289-
self.identity.protocol,
290-
str(self.identity.serial)[-5:],
291-
)
285+
self.log_bold(str(self.identity))
292286
self.warn_device_type_config()
293287
self.serial_matches_config()
294288

‎src/sunsynk/identity.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ class Identity(Component):
3939
protocol: str = NumberField(2, signed=False, convert=_protocol_version) # type: ignore[assignment]
4040
serial: str = string(3, length=5) # type: ignore[assignment]
4141

42+
def __str__(self) -> str:
43+
"""Return a string representation of the identity."""
44+
return (
45+
f"Identity: device_type={self.device_type} ({hex(self.device_type_code)}) "
46+
f"protocol={self.protocol} serial=****{str(self.serial)[-5:]}"
47+
)
48+
4249

4350
def suggested_sensor_definitions(device_type_code: int) -> str:
4451
"""Return the SENSOR_DEFINITIONS profile for ``device_type_code`` (default single-phase)."""

‎src/tests/sunsynk/test_identity.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ async def test_identity_decode() -> None:
3737
assert identity.device_type == "Single-phase hybrid"
3838
assert identity.protocol == "1.2"
3939
assert identity.serial == "ABCDE12345"
40+
assert str(identity) == (
41+
"Identity: device_type=Single-phase hybrid (0x3) protocol=1.2 serial=****12345"
42+
)
4043
assert suggested_sensor_definitions(3) == "single-phase"
4144
assert suggested_sensor_definitions(0x601) == "three-phase-hv"
4245
assert suggested_sensor_definitions(4) == "single-phase"

‎uv.lock‎

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)