Skip to content

Commit 841583a

Browse files
committed
identity
1 parent 814c072 commit 841583a

195 files changed

Lines changed: 36915 additions & 1893 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.DS_Store‎

-6 KB
Binary file not shown.

‎.github/copilot-instructions.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ to work in this repository.
1717

1818
## Current rule files (index)
1919

20-
| Path | Typical scope | Topic |
21-
| ------ | ---------------- | -------- |
22-
| `.cursor/rules/sunsynk-addons.mdc` | Home Assistant add-ons, add-on Python (`src/ha_addon_sunsynk_multi/`), `www/docs/reference/multi-options.md` | Edit **`hass-addon-sunsynk-edge/`** for packaging; do not hand-edit **`hass-addon-sunsynk-multi/`** unless the user explicitly asks for stable-multi work; keep Supervisor options, docs, and `options.py` in sync as described in the rule. |
23-
| `.cursor/rules/sunsynk-definitions.mdc` | `src/sunsynk/definitions/**` | Inverter Modbus definitions: profiles, inheritance, single- vs three-phase; how to extend `ALL_DEFS` and avoid wrong cross-profile register assumptions. |
20+
| Path | Typical scope | Topic |
21+
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
22+
| `.cursor/rules/sunsynk-addons.mdc` | Home Assistant add-ons, add-on Python (`src/ha_addon_sunsynk_multi/`), `www/docs/reference/multi-options.md` | Edit **`hass-addon-sunsynk-edge/`** for packaging; do not hand-edit **`hass-addon-sunsynk-multi/`** unless the user explicitly asks for stable-multi work; keep Supervisor options, docs, and `options.py` in sync as described in the rule. |
23+
| `.cursor/rules/sunsynk-definitions.mdc` | `src/sunsynk/definitions/**` | Inverter Modbus definitions: profiles, inheritance, single- vs three-phase; how to extend `ALL_DEFS` and avoid wrong cross-profile register assumptions. |
2424

2525
If this index drifts, **trust the `.mdc` files**; update this table when you add or rename rules.
2626

‎.gitignore‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Graphify output
2+
graphify-out/cost.json # local only
3+
graphify-out/cache # optional: commit for speed, skip to keep repo small
4+
15
# private/local config
26
hass-addon-sunsynk-edge/sunsynk
37
hass-addon-sunsynk-edge/VERSION
@@ -39,6 +43,3 @@ share/python-wheels/
3943
*.egg-info/
4044
.installed.cfg
4145
*.egg
42-
MANIFEST
43-
44-
.DS_store

‎MANIFEST.in‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎docs/modbus-connection.md‎

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ Two libraries means two decode paths until v1 is deleted. The decode is the prod
6666

6767
## Modelling mismatch
6868

69-
| | sunsynk `Sensor` | `modbus_connection.model` field |
70-
| --- | --- | --- |
71-
| Address | tuple of **arbitrary** registers | one start + **consecutive** `count` |
72-
| Layout | instances in a dict, subset chosen at runtime | class attributes, plan cached on first update |
73-
| 32-bit | `Sensor16((633, 691), …)` — two far-apart regs, stateful 16/32 heuristic | `uint32(n)` = registers `n` and `n+1`, stateless codec |
74-
| Combine | `MathSensor((175, 169, 166), factors=(1, 1, -1))` | `@property` over other fields |
75-
| Packed bits | `bitmask=` + read-modify-write | `bit` / `bits` / `flags` (this part is **better**) |
76-
| Word order | always little (`<h` / `<2H`) | default **big**; would need `word_order="little"` everywhere |
77-
| Writes | FC16 even for one register | FC06 unless `force_fc16=True` |
78-
| Cache | raw regs + decoded values + history + `onchange` | last decoded value on the component |
69+
| | sunsynk `Sensor` | `modbus_connection.model` field |
70+
| ----------- | ------------------------------------------------------------------------ | ------------------------------------------------------------ |
71+
| Address | tuple of **arbitrary** registers | one start + **consecutive** `count` |
72+
| Layout | instances in a dict, subset chosen at runtime | class attributes, plan cached on first update |
73+
| 32-bit | `Sensor16((633, 691), …)` — two far-apart regs, stateful 16/32 heuristic | `uint32(n)` = registers `n` and `n+1`, stateless codec |
74+
| Combine | `MathSensor((175, 169, 166), factors=(1, 1, -1))` | `@property` over other fields |
75+
| Packed bits | `bitmask=` + read-modify-write | `bit` / `bits` / `flags` (this part is **better**) |
76+
| Word order | always little (`<h` / `<2H`) | default **big**; would need `word_order="little"` everywhere |
77+
| Writes | FC16 even for one register | FC06 unless `force_fc16=True` |
78+
| Cache | raw regs + decoded values + history + `onchange` | last decoded value on the component |
7979

8080
`Sensor16` and `MathSensor` block a straight rewrite. A `Component` field cannot be “registers 633
8181
and 691”. You would split them into two integers plus a stateful `@property` — and that state (last
@@ -123,12 +123,12 @@ Two inverters on one adapter: one connection, two units — no swapping `server_
123123

124124
## What stays in sunsynk
125125

126-
| Keep | Why |
127-
| --- | --- |
128-
| `Sensor` / definitions / `mysensors.py` | Public API and the Deye map |
129-
| `group_sensors` | Same job as Component `max_gap` / `max_span`, but over a dynamic subset |
130-
| `InverterState` | Raw regs for bitmask writes; history for MQTT; `onchange` for discovery; RW dependencies |
131-
| Schedules / MQTT | Application layer; Component `_values` is only “last poll” |
126+
| Keep | Why |
127+
| --------------------------------------- | ---------------------------------------------------------------------------------------- |
128+
| `Sensor` / definitions / `mysensors.py` | Public API and the Deye map |
129+
| `group_sensors` | Same job as Component `max_gap` / `max_span`, but over a dynamic subset |
130+
| `InverterState` | Raw regs for bitmask writes; history for MQTT; `onchange` for discovery; RW dependencies |
131+
| Schedules / MQTT | Application layer; Component `_values` is only “last poll” |
132132

133133
## If Components come later
134134

@@ -139,6 +139,9 @@ the source of truth and keep `Sensor` as the HA/mysensors view.
139139
`MathSensor` / `Sensor16` / `FaultSensor` / `SystemTimeRWSensor` stay as properties or custom
140140
converters. Do not migrate decode and transport at once.
141141

142+
Identity (regs 0–7: device type, protocol, serial) is already a `Component`
143+
(`sunsynk.identity.Identity`); scheduled polls stay on `Sensor` + `group_sensors`.
144+
142145
## Sequence
143146

144147
1. `Sunsynk` holds a `HoldingUnit`; I/O delegates; FC16 stays.

‎graphify-out/.graphify_labels.json‎

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
{
2-
"0": "utils/__init__.py",
2+
"0": "SensorDefinitions",
33
"1": "package.json",
4-
"2": "sunsynk.py",
4+
"2": ".read_sensors",
55
"3": "Adaptors & Wiring",
66
"4": "sensors.py",
77
"5": "Sunsynk",
88
"6": "compilerOptions",
9-
"7": "test_a_inverter.py",
10-
"8": "BinarySensor",
9+
"7": "sensor_options.py",
10+
"8": "Sensor",
1111
"9": "RegType",
1212
"10": "percentile",
13-
"11": "a_inverter.py",
13+
"11": "timer_schedule.py",
1414
"12": "__main__.py",
1515
"13": "HoldingUnit",
16-
"14": "RWSensor",
17-
"15": "RegType",
18-
"16": "Sensor",
16+
"14": "ModbusUnit underlay",
17+
"15": "RWSensor",
18+
"16": "ToggleLogCallback",
1919
"17": "SolarmanUnit",
2020
"18": "ASensor",
21-
"19": "test_connection.py",
22-
"20": "test_sunsynk.py",
23-
"21": "AInverter",
21+
"19": "sunsynk.py",
22+
"20": "NumberRWSensor",
23+
"21": "Architecture: modbus-connection and sunsynk",
2424
"22": ".get",
2525
"23": "test_helpers.py",
2626
"24": "Groups of sensors",
2727
"25": "InverterState",
28-
"26": ".read_sensors",
28+
"26": "Identity",
2929
"27": "definitions.md",
3030
"28": "ensure_tuple",
3131
"29": "tests/conftest.py",
@@ -36,7 +36,7 @@
3636
"34": "Configuration",
3737
"35": "Single-phase register backfill (proposal)",
3838
"36": "Unreleased",
39-
"37": "NumberRWSensor",
39+
"37": "int_round",
4040
"38": "test_options.py",
4141
"39": "Inverter Automation",
4242
"40": "Deye/Sunsynk Inverters",
@@ -49,15 +49,15 @@
4949
"47": "build_prep.sh",
5050
"48": "Sunsynk — align with Cursor rules",
5151
"49": "Issue related to the Python sunsynk library",
52-
"50": ".value_to_reg",
52+
"50": "AInverter",
5353
"51": "types.d.ts",
5454
"52": "Sunsynk User Documentation",
5555
"53": "Your environment",
5656
"54": "test_sensor_options.py",
5757
"55": "test_versions.py",
5858
"56": "Modbus TCP to Modbus RTU Gateway Add-on",
59-
"57": "ToggleLogCallback",
60-
"58": "Time",
59+
"57": ".publish",
60+
"58": "ensure_str",
6161
"59": "json_view.vue",
6262
"60": "run.sh",
6363
"61": "hass-addon-sunsynk-edge/DOCS.md",
@@ -80,9 +80,7 @@
8080
"78": ".eslintrc.js",
8181
"79": "copy2local.sh",
8282
"80": ".create_entity",
83-
"81": ".reg_to_value",
84-
"82": ".publish",
85-
"83": "as_num",
86-
"84": "src/ha_addon_sunsynk_multi/__init__.py",
87-
"88": "three_phase_common.py"
83+
"81": "slug",
84+
"83": "hex_str",
85+
"84": "src/ha_addon_sunsynk_multi/__init__.py"
8886
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"0": "5b9e23a8ed845e93", "1": "d7eff289702b5a96", "2": "231a9bc7963820b0", "3": "869f2abe14b8f433", "4": "00eb2a2121871967", "5": "9299608ad508b997", "6": "f732b42942917d95", "7": "a43466836978a0f0", "8": "52a6dcee5bf13c39", "9": "eb95d81a968dd58f", "10": "a1745bd48bc9c400", "11": "bc73166704fe3483", "12": "823ddea8283ed189", "13": "1a67aaa6cb8a773d", "14": "83214d26908bf706", "15": "be821b978c000a33", "16": "c70d3dabbc1212ec", "17": "1a10dcb9a6326da5", "18": "c71bcba8658fe1e0", "19": "3b464bfdb765b6bf", "20": "32020db9747147ff", "21": "52f88a24673d47ed", "22": "3e7ba5a637ec2616", "23": "e3f1e54fee4f7974", "24": "62cb3b589b92b632", "25": "591b8cd772b6658e", "26": "5527b877685edbe0", "27": "889d10a55f518608", "28": "b116de2e8c35d939", "29": "efb3eb460a32a6f2", "30": "4c7b1ac6176ac43f", "31": "40e1b717a00d5720", "32": "9c1f479a3bcd341b", "33": "62b878daf5110c7e", "34": "c7f14ab2ace44244", "35": "92b68165a2cf45e9", "36": "f56eeb0ec6f186b8", "37": "e4ec693244d9be2c", "38": "c1de9d63eeba24c4", "39": "9db7211992a3c63e", "40": "96581cf5de114de1", "41": "0badd1a49fb2a79f", "42": "cb9d34e8318b8eaf", "43": "5b9eff363aa466eb", "44": "09e528f265f0c5ab", "45": "1b6b734b18235303", "46": "880816b24e256dfa", "47": "3eb18500770ce5d5", "48": "594087919fd6a8bf", "49": "6a1b71cfaa02fbe4", "50": "1f3fcd882eef2ae5", "51": "8e91020c75f51e60", "52": "6f85c62bd7407043", "53": "c41d0f8469fb4033", "54": "718fe9b4d9e630e0", "55": "0b0ab091a04e9bbd", "56": "8d0ab5753e1ac6d2", "57": "d40284ea4fdb9344", "58": "7f3a25668f41d6eb", "59": "690532b304f88171", "60": "4d0607b0908e13f3", "61": "3ec2502bc18dc152", "62": "1d486ec4363f3239", "63": "c949b242a690db15", "64": "e8ae0f4946290bf6", "65": "18316c5d24f790ac", "66": "396e4a0815293b67", "67": "4b7e85283b24d2bb", "68": "7fea16a83bf40f41", "69": "3b16499aaf0de712", "70": "8f7839415266b30e", "71": "f59f46a360d37b42", "72": "988bdd5d26ab19f8", "73": "1784db6153045ac1", "74": "8754aeda3c5d62e1", "75": "41e60d101b21e785", "76": "0ea3a21e4cc92283", "77": "b38991a747d1c7fb", "78": "bf4e8f2adf50dbd9", "79": "b2f0b28d1a0427b7", "80": "2cc293e3a09aa9d6", "81": "74ec239edf2a3d98", "82": "c000557f8a3c5b57", "83": "d27c8e33eb3687ae", "84": "0d4a752d9dda280d", "88": "81b00d9c9d22d0a7"}
1+
{"0": "8b18e54fa772210f", "1": "d7eff289702b5a96", "2": "bea71d73f2763f5e", "3": "869f2abe14b8f433", "4": "c26a5bb33af46529", "5": "04c1585af22b343d", "6": "f732b42942917d95", "7": "1b92b680d32a511f", "8": "619c33e28fe69e1e", "9": "3308159c5944429f", "10": "a1745bd48bc9c400", "11": "047f8218a039dfd3", "12": "cc76b3dee94c460b", "13": "25c515c2acb06404", "14": "31004416107f59f1", "15": "79d51349ccacc62a", "16": "d40284ea4fdb9344", "17": "1a10dcb9a6326da5", "18": "fe3bde5ee3f51074", "19": "3a68886eee63505c", "20": "a30f040b2661dd64", "21": "a9e33aabe228782a", "22": "204bd3688bb79ed6", "23": "153e194ffc8066f7", "24": "62cb3b589b92b632", "25": "ec4bf6df67dc0e57", "26": "83d7bd7cb51237d9", "27": "889d10a55f518608", "28": "a94655012a5293b1", "29": "efb3eb460a32a6f2", "30": "4c7b1ac6176ac43f", "31": "40e1b717a00d5720", "32": "9c1f479a3bcd341b", "33": "62b878daf5110c7e", "34": "c7f14ab2ace44244", "35": "92b68165a2cf45e9", "36": "f56eeb0ec6f186b8", "37": "13c41ba9b905ce5d", "38": "c1de9d63eeba24c4", "39": "9db7211992a3c63e", "40": "96581cf5de114de1", "41": "0badd1a49fb2a79f", "42": "cb9d34e8318b8eaf", "43": "5b9eff363aa466eb", "44": "09e528f265f0c5ab", "45": "1b6b734b18235303", "46": "83736e1d8f464d00", "47": "3eb18500770ce5d5", "48": "594087919fd6a8bf", "49": "6a1b71cfaa02fbe4", "50": "7e9ab709a678603c", "51": "8e91020c75f51e60", "52": "6f85c62bd7407043", "53": "c41d0f8469fb4033", "54": "718fe9b4d9e630e0", "55": "0b0ab091a04e9bbd", "56": "8d0ab5753e1ac6d2", "57": "c000557f8a3c5b57", "58": "ca30820d95603ae5", "59": "690532b304f88171", "60": "4d0607b0908e13f3", "61": "3ec2502bc18dc152", "62": "1d486ec4363f3239", "63": "c949b242a690db15", "64": "e8ae0f4946290bf6", "65": "18316c5d24f790ac", "66": "396e4a0815293b67", "67": "4b7e85283b24d2bb", "68": "7fea16a83bf40f41", "69": "3b16499aaf0de712", "70": "8f7839415266b30e", "71": "f59f46a360d37b42", "72": "988bdd5d26ab19f8", "73": "1784db6153045ac1", "74": "8754aeda3c5d62e1", "75": "41e60d101b21e785", "76": "0ea3a21e4cc92283", "77": "b38991a747d1c7fb", "78": "bf4e8f2adf50dbd9", "79": "b2f0b28d1a0427b7", "80": "2cc293e3a09aa9d6", "81": "5eac985353be60ac", "83": "1b4ca02d1383c760", "84": "0d4a752d9dda280d"}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"0": "SensorDefinitions",
3+
"1": "package.json",
4+
"2": ".read_sensors",
5+
"3": "Adaptors & Wiring",
6+
"4": "sensors.py",
7+
"5": "Sunsynk",
8+
"6": "compilerOptions",
9+
"7": "sensor_options.py",
10+
"8": "Sensor",
11+
"9": "RegType",
12+
"10": "percentile",
13+
"11": "timer_schedule.py",
14+
"12": "__main__.py",
15+
"13": "HoldingUnit",
16+
"14": "ModbusUnit underlay",
17+
"15": "RWSensor",
18+
"16": "ToggleLogCallback",
19+
"17": "SolarmanUnit",
20+
"18": "ASensor",
21+
"19": "sunsynk.py",
22+
"20": "NumberRWSensor",
23+
"21": "Architecture: modbus-connection and sunsynk",
24+
"22": ".get",
25+
"23": "test_helpers.py",
26+
"24": "Groups of sensors",
27+
"25": "InverterState",
28+
"26": "Identity",
29+
"27": "definitions.md",
30+
"28": "ensure_tuple",
31+
"29": "tests/conftest.py",
32+
"30": "Run standalone using docker compose",
33+
"31": "Sensors",
34+
"32": ".significant_change",
35+
"33": "Available addons",
36+
"34": "Configuration",
37+
"35": "Single-phase register backfill (proposal)",
38+
"36": "Unreleased",
39+
"37": "int_round",
40+
"38": "test_options.py",
41+
"39": "Inverter Automation",
42+
"40": "Deye/Sunsynk Inverters",
43+
"41": ".reg_value",
44+
"42": "multi-options.md",
45+
"43": "Schedules",
46+
"44": "Issue related to",
47+
"45": "Deye/Sunsynk Inverters",
48+
"46": "_reset_near_realtime",
49+
"47": "build_prep.sh",
50+
"48": "Sunsynk — align with Cursor rules",
51+
"49": "Issue related to the Python sunsynk library",
52+
"50": "AInverter",
53+
"51": "types.d.ts",
54+
"52": "Sunsynk User Documentation",
55+
"53": "Your environment",
56+
"54": "test_sensor_options.py",
57+
"55": "test_versions.py",
58+
"56": "Modbus TCP to Modbus RTU Gateway Add-on",
59+
"57": ".publish",
60+
"58": "ensure_str",
61+
"59": "json_view.vue",
62+
"60": "run.sh",
63+
"61": "hass-addon-sunsynk-edge/DOCS.md",
64+
"62": "hass-addon-sunsynk-edge/README.md",
65+
"63": "hass-addon-sunsynk-multi/CHANGELOG.md",
66+
"64": "hass-addon-sunsynk-multi/DOCS.md",
67+
"65": "hass-addon-sunsynk-multi/README.md",
68+
"66": "tests/README.md",
69+
"67": "templates.md",
70+
"68": "build_sitemap.js",
71+
"69": "index.ts",
72+
"70": "NearRealtime",
73+
"71": "tests/ha_addon_sunsynk_multi/__init__.py",
74+
"72": "tests/__init__.py",
75+
"73": "tests/sunsynk/definitions/__init__.py",
76+
"74": "tests/sunsynk/__init__.py",
77+
"75": "test_zuban.py",
78+
"76": "docs/index.md",
79+
"77": "config.ts",
80+
"78": ".eslintrc.js",
81+
"79": "copy2local.sh",
82+
"80": ".create_entity",
83+
"81": "slug",
84+
"83": "hex_str",
85+
"84": "src/ha_addon_sunsynk_multi/__init__.py"
86+
}

0 commit comments

Comments
 (0)