Commit fb57b1f
fix(sunsynk): make the settings write actually work - group, sell flag, encodings
First live write test against a real inverter. Control could never have
worked before this: three separate defects each blocked it.
1. The write endpoint silently discards an oversized object. Posting all
350 settings keys returned {"code":0,"msg":"Success","success":true} and
changed nothing, twice, including a probe altering a single field with
every original type preserved. Posting only the System Mode group made
the identical change persist at once. Predbat now sends that group.
This is also safer: battery, grid and generator settings are never
transmitted by a schedule write, so they cannot be disturbed.
2. The per-slot Sell flag, sellTime{n}En, was missing entirely. It is the
third per-slot flag in the app alongside Grid Charge and Gen Charge, and
it must be 1 for a forced export slot - so export windows could never
have armed. Worse, its ABSENCE from the payload made the API silently
drop time{n}on too: grid charge failed to write on six consecutive
attempts across every encoding tried, while the rest of each write
persisted. The API validates the per-slot field set as a whole. With the
flag present the three are independent, proven by setting grid charge on
a slot whose sell flag is 0 and vice versa in one write.
3. Boolean fields must be the strings "true"/"false", not bare JSON
booleans - the opposite of what solarsynkv3's ReplaceTRUE() implied.
sellTime{n}En is the exception, taking the numeric "1"/"0" the API
returns for it.
Also: time{n}On (capital O) is server-derived and must never be written. It
went from '0' to '65' on a write that never mentioned it, and writing '1'
produced '65' as well.
Verified live with a combined charge and export plan: 33/33 owned fields
written and read back exactly, 0 of the 350 keys lost, nothing outside the
group changed, and the inverter restored to its original settings 33/33.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 004f298 commit fb57b1f
4 files changed
Lines changed: 237 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| 61 | + | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
527 | 530 | | |
528 | 531 | | |
529 | 532 | | |
530 | | - | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
531 | 538 | | |
532 | 539 | | |
533 | 540 | | |
| |||
702 | 709 | | |
703 | 710 | | |
704 | 711 | | |
705 | | - | |
| 712 | + | |
706 | 713 | | |
707 | 714 | | |
708 | 715 | | |
709 | | - | |
| 716 | + | |
710 | 717 | | |
711 | 718 | | |
712 | 719 | | |
| |||
848 | 855 | | |
849 | 856 | | |
850 | 857 | | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
851 | 862 | | |
852 | 863 | | |
853 | 864 | | |
854 | 865 | | |
855 | 866 | | |
856 | | - | |
857 | | - | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
858 | 871 | | |
859 | 872 | | |
860 | 873 | | |
| |||
867 | 880 | | |
868 | 881 | | |
869 | 882 | | |
870 | | - | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
871 | 888 | | |
872 | 889 | | |
873 | 890 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
97 | 107 | | |
98 | 108 | | |
99 | 109 | | |
100 | 110 | | |
101 | 111 | | |
| 112 | + | |
102 | 113 | | |
103 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
104 | 120 | | |
105 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
106 | 148 | | |
107 | 149 | | |
108 | 150 | | |
109 | 151 | | |
110 | 152 | | |
111 | 153 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
116 | 166 | | |
117 | 167 | | |
118 | 168 | | |
| |||
122 | 172 | | |
123 | 173 | | |
124 | 174 | | |
125 | | - | |
126 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
127 | 179 | | |
128 | 180 | | |
129 | | - | |
130 | | - | |
131 | | - | |
| 181 | + | |
| 182 | + | |
132 | 183 | | |
133 | 184 | | |
134 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| 155 | + | |
155 | 156 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
| |||
0 commit comments