Closed jasperslits closed 2 years ago
Hi, after following this issue closely I just have my WPU connected and I noticed the following:
Outdoor temp and Boiler temp below are showing 0 in status, while the Query status results returns actually plausible values.
80 82 A4 01 01 AA 04 4C 12 65 15 21 0A 20 0A 41 0B 8A 0A 7D 09 E9 0A 81 0B 1B 0A 00 00 76 00.....'
Outdoor temp: 11
Boiler temp below: 47.09
I might have found something. My device returns device type 26, which is version 38 in decimal. If I understand right that version isn't supported yet.
The versions are taken from the official Itho database hosted on Azure. So it should be up to date. It currently lists 37 as max.
Do you have a WPu 5g as well?
No a 4th generation. WPU-55I
That's interesting, I used the steps here: https://github.com/pommi/python-itho-wpu/tree/master and it doesn't mention that the HeatPump database is tied to 5th generation devices only.
Do you see correct labels / values for other fields?
I see this:
Itho device type: Heatpump Itho fw version: 34
But you see this? Itho device type: 26 Itho fw version: ???
But I think 26 is already in decimals so I guess the hex is 0x1A and it should be added here: https://github.com/arjenhiemstra/ithowifi/blob/7ab30355dc46e3f4964ec645f011f5b85d0a0577/software/NRG_itho_wifi/IthoSystem.cpp#L69-L79
So perhaps the existing HeatPump entry is for 5th gen (5G) and there's a different identifier for 4G units, being the 0x1A.
My device returns device type 26, which is version 38 in decimal.
Where do you see this number? Could you post the output of the "Query Devicetype" command on the debug page?
I'm sorry, I should have posted the raw query result right away.
Query DeviceType returns
80 82 90 E0 01 07 00 01 00 0D 26 14 00 3E
I'm sorry, I should have posted the raw query result right away. Query DeviceType returns
80 82 90 E0 01 07 00 01 00 0D 26 14 00 3E
Thanks! So that is 0D for device type, which seems to be correctly the Heatpump. And 14 for the version number which translates to 20 in decimal. This version is also present in the code from jasper. Cannot really explain why it should not work.
NRG_itho_wifi.ino.esp32.bin.zip
@jasperslits (and @JoostBaltissen), I've compiled the PR you supplied and also included some code to better protect (and give error messages) when a version is not supported or out of band somehow.
Nice, this the new output, still some 0's on the begin and weird values at the end. See table below. I don't see any odd messages in the log right now.
Label | Value -- | -- temp | 0 hum | 0 ppmw | 0 Outdoor temp (°C) | 0 Boiler temp below (°C) | 0 Boiler temp up (°C) | 50.31 Evaporator temp (°C) | 20.22 Suction gas temp (°C) | 20.84 Compressed gas temp (°C) | 23.92 Liquid temp (°C) | 20.49 Temp to source (°C) | 21.56 Temp from source (°C) | 21.27 CV supply temp (°C) | 23.04 CV return temp (°C) | 22.95 CV pressure (Bar) | 1.18 Flow compressor (A) | 0 Flow e-element (A) | 0 Pressure switch | 0 Tarif high or low | 0 Condensation protection | 0 Spare input | 0 Correction measurement delta source temperature (K) | 0 Flow sensor (lt/hr) | 0 Phase detection order | 0 CV pump (%) | 0 Source pump speed (%) | 0 Boiler pump speed (%) | 0 Free cooling valve (%) | 725 CV/DHW or cooling temp valve (%) | 725 Compressor | 0 Element | 0 Trickle heating | 0 Fault existing | 1 Free cooling | 0 Expansion valve position (pls) | 0 Room temp (°C) | 21.49 Requested room temp (°C sp) | 21 Heat demand thermost. (%) | 0 Status | 1 Sub status CV | 255 Blockage | 0 Calculated evaporation temp CV (°C) | 19.22 Calculated condensation temp CV (°C) | 22.52 Calculated evaporation temp DHW (°C) | 19.22 Calculated condensation temp DHW (°C) | 22.52 Error found | 0 Error retry | 0 Task active by external control | 0 Manual operation | 0 Compressor block (sec) | 0 Elek block (sec) | 0 CV before / after turn (sec) | 0 Source before / after turn (sec) | 0 Boiler before / after turn (sec) | 0 Delay electr (sec) | 0 Min run time compr (sec) | 0 Pump off time (sec) | 0 EV pressure offset (sec) | 0 EV adjust (sec) | 0 Free cooling interval (sec) | 0 Manual control (sec) | 0 Low pressure timer (sec) | 0 Compressor start (sec) | 0 Compr power on delay (sec) | 0 Delay CV start (sec) | 0 Delay CV stop (sec) | 0 Adaptive timer (sec) | 0 Adaptive overheat (K) | 5 Adaptive fifo index | 29 Error highest priority | 0 UTC time | 1637013719 Max CV return temp (°C) | 45 Source pump speed free cooling mode | 0 Compressor in CV mode | 0 Compressor in boiler mode | 0 Element in CV mode | 0 Element in boiler mode | 0 CV mode blocked | 0 Boiler mode blocked | 0 Free cooling mode blocked | 0 Vented mode blocked | 0 Electr element blocked | 0 Electr element DHW blocked | 0 Compressor blocked | 0 Off mode active | 1 CV mode active | 0 Boiler mode active | 0 Free cooling mode active | 0 Heat pump prime | 0 Source pump prime | 0 Element enabled | 0 Enable additional cooling | 0 Heating enabled | 0 Free cooling enabled | 0 Tariff low from thermostat | 0 Venting from thermostat | 0 ECO selected on thermostat | 0 Comfort selected from thermostat | 1 Boiler block from thermostat | 0 Boiler boost from thermostat | 0 Heat demand total (%) | 0 E-consumption during standby (kWh) | 1 E-consumption during heating (kWh) | 1 E-consumption during DHW (kWh) | 0.44 E-consumption during cooling (kWh) | 70.03313 Preheating tap hot water | 70.47 Element blocked during retry | 0 Pi error source flow | 60 Current source valve position (%) | 1104 Utc Time offset (min.) | 1 Free cooling block time (min.) | 23 Cooling temp control valve setpoint (%) | 1 CO valve position (%) | 59 HRU blowout temp (°C) | 0 onStatusHighKitchenBathroom | 0.0018temp | 0 |
---|---|
hum | 0 |
ppmw | 0 |
These are correct (manually added)
To check the others I need the status format output and the full status output from the debug page
Status format:
Result: 80 82 A4 00 01 6F 92 92 92 92 92 92 92 92 92 92 92 92 92 92 0C 0C 0C 0C 10 10 0C 00 00 00 10 10 0C 0C 0C 0C 0C 10 92 92 00 00 00 00 92 92 92 92 00 00 10 0C 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 12 00 00 20 00 00 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 00 00 00 A2 A5 92 92 90 10 00 00 00 00 10 ED
Status:
Result: 80 82 A4 01 01 AA 02 58 0F 6B 13 A7 07 EC 08 24 09 58 08 06 08 6C 08 4F 08 F7 08 F7 00 76 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 D5 02 D5 00 00 00 01 00 00 00 08 65 08 34 00 01 FF 00 07 88 08 D2 07 88 08 D2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 F4 1D 00 61 92 D9 C1 2D 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01 01 00 00 00 2C 00 6A DC B1 1B 87 00 00 00 3C 04 4C 01 17 05 35 00 00 B6
Log: 5785 N: System boot, last reset reason: POWERON_RESET 5802 N: HW rev: NON-CVE 1, FW ver.: 2.3-beta4 5937 N: wifi config saved 5966 N: Setup: Wifi config load failed 7733 N: wifi AP mode started 7754 N: Setup: AP mode active 7774 N: Setup: Virtual remote ID: 60,175,52 7801 N: Webserver: started 7822 N: mDNS: started 7842 N: Hostname: nrg-itho-af34 7863 N: Setup: done 2157 N: System boot, last reset reason: POWERON_RESET 2175 N: HW rev: NON-CVE 1, FW ver.: 2.3-beta4 2214 N: Setup: Wifi config load failed 3891 N: wifi AP mode started 3911 N: Setup: AP mode active 3929 N: Setup: Virtual remote ID: 60,175,52 3956 N: Webserver: started 3978 N: mDNS: started 4000 N: Hostname: nrg-itho-af34 4020 N: Setup: done 2158 N: System boot, last reset reason: POWERON_RESET 2176 N: HW rev: NON-CVE 1, FW ver.: 2.3-beta4 2214 N: Setup: Wifi config load failed 3892 N: wifi AP mode started 3914 N: Setup: AP mode active 3932 N: Setup: Virtual remote ID: 60,175,52 3958 N: Webserver: started 3980 N: mDNS: started 4001 N: Hostname: nrg-itho-af34 4021 N: Setup: done 222431 N: wifi config saved 238168 N: wifi config saved 259728 N: Reboot requested 2159 N: System boot, last reset reason: SDIO_RESET 2177 N: HW rev: NON-CVE 1, FW ver.: 2.3-beta4 6447 N: WiFi: connection successful 6466 N: WiFi info: 6485 N: Mode:STA 6503 N: Status:3 6522 N: IP:192.168.2.32 6541 N: Setup: Virtual remote ID: 60,175,52 6566 N: Webserver: started 6586 N: mDNS: started 6604 N: Hostname: itho-warmtepomp 6624 N: Setup: done 2021-11-13 21:06:01 N: Firmware update: NRG_itho_wifi.ino.esp32.bin 2021-11-13 21:06:17 N: Reboot requested 2021-11-13 21:06:19 N: System boot, last reset reason: SDIO_RESET 2021-11-13 21:06:19 N: HW rev: NON-CVE 1, FW ver.: 2.3-beta4-wputest 2021-11-13 21:06:23 N: WiFi: connection successful 2021-11-13 21:06:23 N: WiFi info: 2021-11-13 21:06:23 N: Mode:STA 2021-11-13 21:06:23 N: Status:3 2021-11-13 21:06:23 N: IP:192.168.2.32 2021-11-13 21:06:23 N: Setup: Virtual remote ID: 60,175,52 2021-11-13 21:06:23 N: Webserver: started 2021-11-13 21:06:23 N: mDNS: started 2021-11-13 21:06:23 N: Hostname: itho-warmtepomp 2021-11-13 21:06:23 N: Setup: done 2163 N: System boot, last reset reason: POWERON_RESET 2181 N: HW rev: NON-CVE 1, FW ver.: 2.3-beta4-wputest 6556 N: WiFi: connection successful 6574 N: WiFi info: 6592 N: Mode:STA 6610 N: Status:3 6628 N: IP:192.168.2.32 2021-11-13 21:12:09 N: Setup: Virtual remote ID: 60,175,52 2021-11-13 21:12:09 N: MQTT: connected, System config: 1 2021-11-13 21:12:09 N: Webserver: started 2021-11-13 21:12:09 N: mDNS: started 2021-11-13 21:12:09 N: Hostname: itho-warmtepomp 2021-11-13 21:12:09 N: Setup: done 2021-11-13 21:12:17 N: HA DISCOVERY: Start publishing MQTT Home Assistant Discovery... 2021-11-14 03:12:02 N: Mem free: 103744, Mem low: 75944, Mem block: 59320 2021-11-14 03:07:01 N: System boot, last reset reason: OWDT_RESET 2021-11-14 03:07:01 N: HW rev: NON-CVE 1, FW ver.: 2.3-beta4-wputest 2021-11-14 03:07:05 N: WiFi: connection successful 2021-11-14 03:07:05 N: WiFi info: 2021-11-14 03:07:05 N: Mode:STA 2021-11-14 03:07:05 N: Status:3 2021-11-14 03:07:05 N: IP:192.168.2.32 2021-11-14 03:07:05 N: Setup: Virtual remote ID: 60,175,52 2021-11-14 03:22:39 N: MQTT: connected, System config: 1 2021-11-14 03:22:39 N: Webserver: started 2021-11-14 03:22:39 N: mDNS: started 2021-11-14 03:22:39 N: Hostname: itho-warmtepomp 2021-11-14 03:22:39 N: Setup: done 2021-11-14 03:22:48 N: HA DISCOVERY: Start publishing MQTT Home Assistant Discovery... 2021-11-14 09:22:33 N: Mem free: 140736, Mem low: 97944, Mem block: 60544 43200049 N: Mem free: 133944, Mem low: 97944, Mem block: 60544 2021-11-14 20:13:19 N: HA DISCOVERY: Start publishing MQTT Home Assistant Discovery... 2021-11-14 20:33:25 N: HA DISCOVERY: Start publishing MQTT Home Assistant Discovery... 2021-11-14 21:22:33 N: Mem free: 140344, Mem low: 97944, Mem block: 60544 2021-11-15 03:22:33 N: Mem free: 131916, Mem low: 97944, Mem block: 60544 2021-11-15 09:22:33 N: Mem free: 140044, Mem low: 97944, Mem block: 60544 2021-11-15 15:22:34 N: Mem free: 138032, Mem low: 97944, Mem block: 60544 2021-11-15 15:46:19 N: HA DISCOVERY: Start publishing MQTT Home Assistant Discovery... 2021-11-15 21:22:34 N: Mem free: 140280, Mem low: 97936, Mem block: 60544 2021-11-15 21:58:56 N: Firmware update: NRG_itho_wifi.ino.esp32.bin 2021-11-15 21:59:11 N: Reboot requested 2021-11-15 22:00:36 N: System boot, last reset reason: SDIO_RESET 2021-11-15 22:00:36 N: HW rev: NON-CVE 1, FW ver.: 2.3-beta4-wputest 2021-11-15 22:00:41 N: WiFi: connection successful 2021-11-15 22:00:41 N: WiFi info: 2021-11-15 22:00:41 N: Mode:STA 2021-11-15 22:00:41 N: Status:3 2021-11-15 22:00:41 N: IP:192.168.2.32 2021-11-15 22:00:41 N: Setup: Virtual remote ID: 60,175,52 2021-11-15 22:00:41 N: MQTT: connected, System config: 1 2021-11-15 22:00:41 N: Webserver: started 2021-11-15 22:00:41 N: mDNS: started 2021-11-15 22:00:41 N: Hostname: itho-warmtepomp 2021-11-15 22:00:41 N: Setup: done 2021-11-15 21:59:28 N: HA DISCOVERY: Start publishing MQTT Home Assistant Discovery...
if I compare your version 20 mapping with de database jaspers' mentioning some labels are off and the length is not the same. So maybe there is an issue with the script of Jasper? @jasperslits could you maybe share the script?
I am a lazy coder so it's an ugly PHP script.
But Itho has per version a table, so for version 20 there are 111 elements where as version 34 (mine) has 123 labels. I assumed that the 111 elements of version 20 overlap with the first 111 of version 34.
But when I use the Python script of Pommi with the provided status format and status, it yields two errors but I guess these data types are handled in the C++ code already: Unknown data type for label Pbron: 0xA2 Unknown data type for label Ibron: 0xA5
Data type | Label | value |
---|---|---|
0x92 | Buitentemp (°C) (t_out) | 6.0 |
0x92 | Boilertemp Onder (°C) (t_boildwn) | 39.47 |
0x92 | Boilertemp Boven (°C) (t_boiltop) | 50.31 |
0x92 | Verdamper Temp (°C) (t_evap) | 20.28 |
0x92 | Zuiggas Temp (°C) (t_suct) | 20.84 |
0x92 | Persgas Temp (°C) (t_disc) | 23.92 |
0x92 | Vloeistof Temp (°C) (t_cond) | 20.54 |
0x92 | Temp Naar Bron (°C) (t_source_r) | 21.56 |
0x92 | Temp Uit Bron (°C) (t_source_s) | 21.27 |
0x92 | Cv Aanvoertemp (°C) (t_ch_supp) | 22.95 |
0x92 | Cv Retourtemp (°C) (t_ch_ret) | 22.95 |
0x92 | Cv-Druk (Bar) (p_sens) | 1.18 |
0x92 | Stroom Compressor (A) (i_tr1) | 0.0 |
0x92 | Stroom E-Element (A) (i_tr2) | 0.0 |
0xc | Drukschakelaar (in_p_switch) | 0 |
0xc | Tarief (in_hl) | 0 |
0xc | Condens Beveiliging (in_cond) | 0 |
0xc | Spare Ingang (sparein) | 0 |
0x10 | Pulsteller (in_count) | 0 |
0x10 | Flowsensor (lt/hr) (in_flow) | 0 |
0xc | Fase Detectie (in_phase) | 0 |
0x0 | Cv Pomp (%) (out_ch) | 0 |
0x0 | Bron Pomp (%) (out_src) | 0 |
0x0 | Boiler Pomp (%) (out_dhw) | 0 |
0x10 | Vrijkoelklep (pls) (out_fc_valve) | 725 |
0x10 | Cv/Dhw Klep (pls) (out_ch_valve) | 725 |
0xc | Compressor (out_c1) | 0 |
0xc | Element (out_ele) | 0 |
0xc | Trickle Heating (out_trickle) | 0 |
0xc | Fout (out_fault) | 1 |
0xc | Vrijkoelen (out_fc) | 0 |
0x10 | Expansieventiel (pls) (out_ev) | 0 |
0x92 | Kamertemp (°C) (ot_room) | 21.49 |
0x92 | Gevr Kamertemp (°C) (ot_setp) | 21.0 |
0x0 | Warmtevraag (%) (ot_mod) | 0 |
0x0 | Status (state) | 1 |
0x0 | Sub_Status (sub_state) | 255 |
0x0 | Blokkade (ot_vrij) | 0 |
0x92 | Berekende Verdampings Temp Cv (°C) (c_sh_evap) | 19.28 |
0x92 | Berekende Condensatie Temp Cv (°C) (c_sh_con) | 22.58 |
0x92 | Berekende Verdampings Temp Dhw (°C) (c_sh_evap_dhw) | 19.28 |
0x92 | Berekende Condensatie Temp Dhw (°C) (c_sh_con_dhw) | 22.58 |
0x0 | Fout_Gevonden (fault_reported) | 0 |
0x0 | Fout_Retry (fault_retrying) | 0 |
0x10 | Taak Aktief (task_active) | 0 |
0xc | Handbediening (c_hand) | 0 |
0x10 | Compr Blok (sec) (tr_compr) | 0 |
0x10 | Elek Blok (sec) (tr_eblock) | 0 |
0x10 | Cv Voor / Nadraai (sec) (tr_cv) | 0 |
0x10 | Bron Voor / Nadraai (sec) (tr_src) | 0 |
0x10 | Boiler Voor / Nadraai (sec) (tr_dhw) | 0 |
0x10 | Delay Elektr (sec) (tr_elek) | 0 |
0x10 | Min Draaitijd Compr (sec) (tr_press) | 0 |
0x10 | Afpomp Tijd (sec) (tr_mincompr) | 0 |
0x10 | Ev Drukvereffenen (sec) (tr_ev_bal) | 0 |
0x10 | Ev Verstellen (sec) (tr_ev_verstel) | 0 |
0x10 | Vrijkoel Interval (sec) (tr_fc) | 0 |
0x10 | Handbediening (sec) (tr_hand) | 0 |
0x10 | Lage Druk Timer (sec) (tr_ld) | 0 |
0x10 | Compressor Start (sec) (tr_strtcompr) | 0 |
0x10 | Compr Power On Delay (sec) (compr_powondelay) | 0 |
0x10 | Vertraging Cv Start (sec) (delaybefstartch) | 0 |
0x10 | Vertraging Cv Stop (sec) (delaybefstopch) | 0 |
0x10 | Adaptief Timer (sec) (tr_adaptief) | 0 |
0x12 | Adaptief Oververhitting (K) (t_adoverheating) | 258.44 |
0x0 | Adaptief Fifo Index (adfifoindex) | 29 |
0x0 | Fout Hoogste Prioriteit (hipriorfault) | 0 |
0x20 | Utc Tijd (utc_time) | 1637013953 |
0x0 | Max Cv Retour Temp (°C) (maxcvtemp) | 45 |
0x0 | Bronpomp Snelheid Vrijkoel Mode (bronpompspeed) | 0 |
0xc | Compressor In Cv Mode (comprch) | 0 |
0xc | Compressor In Boiler Mode (comprdhw) | 0 |
0xc | Element In Cv Mode (elemch) | 0 |
0xc | Element In Boiler Mode (elemdhw) | 0 |
0xc | Cv Mode Geblokkeerd (chmodeblocked) | 0 |
0xc | Boiler Mode Geblokkeerd (dhwmodeblocked) | 0 |
0xc | Vrijkoel Mode Geblokkeerd (fcmodeblocked) | 0 |
0xc | Ontlucht Mode Geblokkeerd (ventmodeblocked) | 0 |
0xc | Elektr Element Geblokkeerd (elblocked) | 0 |
0xc | Elektr Element Dhw Geblokkeerd (eldhwblocked) | 0 |
0xc | Compressor Geblokkeerd (comprblocked) | 0 |
0xc | Off Mode Aktief (offmode) | 1 |
0xc | Cv Mode Aktief (chmode) | 0 |
0xc | Boiler Mode Aktief (dhwmode) | 0 |
0xc | Vrijkoel Mode Aktief (fcmode) | 0 |
0xc | Cv Pomp Voordraaien (chpmpprerun) | 0 |
0xc | Bron Pomp Voordraaien (srcpmpprerun) | 0 |
0xc | Element Vrijgegeven Door Gebruiker (elreluser) | 0 |
0xc | Vrijgave Extra Koelen (fclowrel) | 0 |
0xc | Cv Vrijgegeven (chrel) | 0 |
0xc | Vrijkoel Vrijgegeven (fcrel) | 0 |
0xc | Tarief Laag Vanuit Thermostaat (lttherm) | 0 |
0xc | Ontluchten Vanuit Thermostaat (venttherm) | 0 |
0xc | Eco Geselecteerd Op Thermostaat (ecotherm) | 0 |
0xc | Comfort Geselecteerd Op Thermostaat (comftherm) | 1 |
0xc | Boiler Blokkade Vanuit Thermostaat (dhwthermblocked) | 0 |
0xc | Boiler Boost Vanuit Thermostaat (dhwthermboost) | 0 |
0x0 | Warmtevraag (%) (maxrmod) | 0 |
0x0 | Utc Tijd : (utctimevalid) | 1 |
0x0 | Element Alleen Voor Dhw Vrijgegeven (elementalleenvoordhw) | 1 |
Unknown message type for datalog P Fout Bronflow (pbron): 162 |0xa2|P Fout Bronflow (pbron)|1| Unknown message type for datalog I Fout Bronflow (ibron): 165 |0xa5|I Fout Bronflow (ibron)|1| |0x92|Pi Bronflow Resultaat (pibron)|0.0| |0x92|Actuele Bronklepstand (%) (kleppos)|0.44| |0x90|Utc Tijd Offset (min.) (utcoffset)|106| |0x10|Gateway Tijd Ontvangen (gwtrec)|56497| |0x0|Ot-Tijd Valid (totvalid)|27| |0x0|Tijd Uren (uur) (thr)|135| |0x0|Tijd Minuten (min) (tmin)|0| |0x0|Tijd Seconden (sec) (tsec)|0| |0x10|Vrijkoel Blokkade Tijd (min.) (tr_fc_block)|60|
So there's something funky with the labels, will see if I can compare it against v34 later today
I did a query on the sqlite database and found the following: sqlite>select in 20 but not 37, a.name, a.tooltip from datalabel_v20 as a left join datalabel_v37 as b on a.name = b.name where b.name is null; in 20 but not 37|In_Count|pulsteller ingang in 20 but not 37|Pbron| in 20 but not 37|Ibron| in 20 but not 37|GWtRec|tbv test in 20 but not 37|tOTvalid|tbv test in 20 but not 37|Thr|tbv test in20 but not 37|Tmin|tbv test in 20 but not 37|Tsec|tbv test
so it looks like v20 has less labels than v37, but also a few other labels.
So much for the theory of full overlap then....
Having a per version all labels explicitly added to the .h file will just add bloat and just adding a baseline (v37) with per versions differences only is difficult I guess.
I am a lazy coder so it's an ugly PHP script.
Lazy coders are the best coders ;-)
I assumed that the 111 elements of version 20 overlap with the first 111 of version 34.
Unfortunately not, all elements could change between versions (not all do but it can be the case)
So much for the theory of full overlap then....
Having a per version all labels explicitly added to the .h file will just add bloat and just adding a baseline (v37) with per versions differences only is difficult I guess.
Having a per version all labels explicitly added to the .h file is not needed. What I did up until now was create one list with all the unique labels for all the different versions, this creates the flashstring array with all the possible labels. Then map it to the correct index position for a particular version. Where the mapping is the same between versions they are collapsed into one mapping. So it seems that the only change needed to the script is that the total mapping is created for each version instead of assuming that parts of the mapping always overlap.
I am a lazy coder so it's an ugly PHP script.
And still, ugly is more than fine, are you willing to share the script so that we maybe can help you or do you want to change the script yourself?
Spaghetti code incoming. Had to rewrite it quite a few times to have the squashing done based on versions / record count. I think the only part that's still relevant are the labels and not the structs anymore given your changes earlier and I didn't update that part.
class ExportWPU
{
private $db;
public function __construct()
{
$this->db = new SQLite3('wpu.db');
}
private function squashcounts(array $d): array
{
$output = [];
$tmp = [];
$tmpCount = [];
foreach($d as $k=>$v) {
if (count($v) > 1) {
$output[$k] = $v;
} else {
$results = $this->db->query("select count(*) as cnt from datalabel_v".$v[0]);
$row = $results->fetchArray();
$tmp[$v[0]] = $row[0];
if (! isset($tmpCount[$row[0]])) {
$tmpCount[$row[0]] = [];
}
$tmpCount[$row[0]][] = $v[0];
}
}
foreach($tmpCount as $count=>$v)
{
if (count($v) == 1) {
$output[$v[0]][] = $v[0];
} else {
$output[$v[0]] = $v;
}
}
ksort($output);
return $output;
}
public function squashSettings(): void
{
$results = $this->db->query("select version,datalabel from versiebeheer");
$v = [];
while ($row = $results->fetchArray()) {
$v[$row['version']] = $row['datalabel'];
}
$dl = [];
foreach($v as $key=>$value) {
if (! isset($dl[$value])) { $dl[$value] = []; }
$dl[$value][] = $key;
}
$dl = $this->squashcounts($dl);
$settings = [];
foreach($dl as $k=>$v) {
$av = array_values($v);
if (count($v) == 1) {
echo "const uint8_t itho_WPUset".$k."[] = { ".$this->getStatusByVersion($k)."};\n";
$settings[$av[0]] = "itho_WPUset".$k;
} else {
$c = count($v);
$from = array_shift($v);
$to = array_pop($v);
echo "const uint8_t itho_WPUset".$from."_".$to."[] = { ".$this->getStatusByVersion($k)." };\n";
for($i=0;$i<$c;$i++) {
$settings[$from+$i] = "itho_WPUset".$from."_".$to;
}
// $settings[$v] = "WPUset".$from."_".$to;
}
}
echo "\n\n";
echo "const uint8_t *ithoWPUSettingsMap[] = { nullptr, ";
foreach($settings as $version => $code) {
echo $code.",";
}
echo "255};\n\n";
}
public function squashStatus(): void
{
$results = $this->db->query("select version,datalabel from versiebeheer");
$v = [];
while ($row = $results->fetchArray()) {
$v[$row['version']] = $row['datalabel'];
}
$dl = [];
foreach($v as $key=>$value) {
if (! isset($dl[$value])) { $dl[$value] = []; }
$dl[$value][] = $key;
}
$settings = [];
$dl = $this->squashcounts($dl);
foreach($dl as $k=>$v) {
$av = array_values($v);
if (count($v) == 1) {
echo "const uint8_t itho_WPUstatus".$k."[] = { ".$this->getStatusByVersion($k)."};\n";
$settings[$av[0]] = "itho_WPUstatus".$k;
} else {
$c = count($v);
$from = array_shift($v);
$to = array_pop($v);
echo "const uint8_t itho_WPUstatus".$from."_".$to."[] = { ".$this->getStatusByVersion($k)." };\n";
for($i=0;$i<$c;$i++) {
$settings[$from+$i] = "itho_WPUstatus".$from."_".$to;
}
}
}
echo "\n\n";
echo "const uint8_t *ithoWPUSstatusMap[] = { nullptr, ";
foreach($settings as $version => $code) {
echo $code.",";
}
echo "255};\n\n";
}
private function getStatusByVersion(int $version): string
{
$results = $this->db->query("select id from datalabel_v".$version);
$rv = [];
while ($row = $results->fetchArray()) {
$rv[] = $row['id'];
}
return join(",",$rv);
}
public function createSettingDescriptions(): void
{
echo "const __FlashStringHelper *ithoWPUSettingDescriptions[] = {\n";
$results = $this->db->query("SELECT * from versiebeheer where datalabel = '37'");
while ($row = $results->fetchArray()) {
$v = $row['datalabel'];
$q = "select title,tooltip from datalabel_v".$v;
$rq = $this->db->query($q);
while ($r2 = $rq->fetchArray()) {
if (! empty($r2['tooltip'])) {
$labels = $r2['tooltip'];
} else {
$labels = $r2['title'];
}
echo 'F("'.$labels.'"),';
echo "\n";
}
}
echo "\n};\n\n";
}
public function createStatusLabels(): void
{
echo "const __FlashStringHelper *ithoWPUStatusLabels[] = {\n";
$results = $this->db->query("SELECT * from versiebeheer where datalabel = '37'");
while ($row = $results->fetchArray()) {
$v = $row['datalabel'];
$q = "select title,unit from datalabel_v".$v;
$rq = $this->db->query($q);
while ($r2 = $rq->fetchArray()) {
$labels = $r2['title'];
if ($r2['unit'] != '') {
echo 'F("'.$labels.' ('.$r2['unit'].')"),';
} else {
echo 'F("'.$labels.'"),';
}
echo "\n";
}
}
echo "\n};\n\n";
}
$w = new ExportWPU;
$w->squashSettings();
$w->squashStatus();
$w->createStatusLabels();
$w->createSettingDescriptions();
?>
I almost had a conceptual solution, but i ran into double values because due to minor differences in tooltip text.
but the idea was:
get all unique labels. use union on all datalabel version tables and insert in a new table (datalabel_all).
then get the corresponding index for a version by using left join.
select b.rowid,a.rowid, b.* from datalabel_v20 as a left join datalabel_all as b on a.name = b.name order by a.rowid;
it looks a bit more messy since the union sorts the labels. And it has a problem now that it has doubles.
Ok, my python and sql are very rusty to say the least, I'll try to convert the DB to SQlite and have a look at the code you shared. Much appreciated for sharing! In pseudo code, could it be something like this:
create datastructure {label, description}
for each table Datalabel_V<version>
for each row in column[Naam]
if row.value[Naam] is not in datastructure.label
add row.value[Naam] to datastructure.label
add row.value[Tooltip_NL]to datastructure.description
if row.value[Tooltip_NL] is empty
add row.value[Tekst_NL] to datastructure.description //something like this or just the value from the Naam colomn
for each table Datalabel_V<version>
create itho_<product>status<version> array
for each row in column[Naam]
for each datastructure {label}
if row.value[Naam] is datastructure {label}
add datastructure {label} array index number to itho_<product>status<version> array
This way you will create a unique mapping for all the versions of a product (which might need to be squashed but that is less important) and never create a label twice (and this saving the most of memory / flash possible)
Hmm, Arjen beat me to it. :)
Some coding to get for each name (regardless of the version) the matching versions, not considering squashing (yet).
1) Build an array with unique labels across all versions using name 2) Iterate over all versions and create an array of label positions 3) Show title + unit
const uint8_t itho_WPUstatus2[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60 }
const uint8_t itho_WPUstatus4[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67 }
const uint8_t itho_WPUstatus5[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,68 }
const uint8_t itho_WPUstatus6[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,64,65,66,67,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97 }
const uint8_t itho_WPUstatus7[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,64,101,66,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,102 }
const uint8_t itho_WPUstatus8[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,64,101,66,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,102,103 }
const uint8_t itho_WPUstatus10[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,102,103 }
const uint8_t itho_WPUstatus11[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,102,103 }
const uint8_t itho_WPUstatus18[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121 }
const uint8_t itho_WPUstatus20[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121,122 }
const uint8_t itho_WPUstatus21[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133 }
const uint8_t itho_WPUstatus22[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134 }
const uint8_t itho_WPUstatus23[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134 }
const uint8_t itho_WPUstatus24[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134 }
const uint8_t itho_WPUstatus25[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134 }
const uint8_t itho_WPUstatus27[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,135,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,54,53,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,136,137,138,139,102,103,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,140,141,142 }
const uint8_t itho_WPUstatus31[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,135,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,54,53,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,136,137,138,139,143,103,114,115,116,122,123,124,125,126,127,128,129,130,131,132,134,140,141,142,144,145,146,102 }
const uint8_t itho_WPUstatus33[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,135,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,54,53,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,136,137,138,139,143,103,114,115,116,122,123,124,125,126,127,128,129,147,131,130,132,134,140,141,142,144,145,146,102,148,149,150,151,152,153 }
const uint8_t itho_WPUstatus34[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,135,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,54,53,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,136,137,138,139,143,103,114,115,116,122,123,124,125,126,127,128,129,147,131,130,132,134,140,141,142,144,145,146,102,148,149,150,151,152,153,154 }
const uint8_t itho_WPUstatus37[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,155,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,54,53,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,136,137,138,139,143,103,114,115,116,122,123,124,125,126,127,128,129,147,131,130,132,134,140,141,142,144,145,146,102,148,149,150,151,152,153,154 }
Flash labels:
F(|0|"Buitentemp (°C)"),
F(|1|"Boiler laag (°C)"),
F(|2|"Boiler hoog (°C)"),
F(|3|"Verdamper temp (°C)"),
F(|4|"Zuiggas temp (°C)"),
F(|5|"Persgas temp (°C)"),
F(|6|"Vloeistof temp (°C)"),
F(|7|"Naar bron (°C)"),
F(|8|"Van bron (°C)"),
F(|9|"CV aanvoer (°C)"),
F(|10|"CV retour (°C)"),
F(|11|"Druksensor (Bar)"),
F(|12|"Stroomtrafo 1 (A)"),
F(|13|"Stroomtrafo 2 (A)"),
F(|14|"Drukschakelaar"),
F(|15|"Hoog / laag"),
F(|16|"Condens beveiliging"),
F(|17|"Pulsteller"),
F(|18|"Flowsensor (lt/hr)"),
F(|19|"Fase detectie"),
F(|20|"Cv pomp (%)"),
F(|21|"Bron pomp (%)"),
F(|22|"Boiler pomp (%)"),
F(|23|"Vrijkoelklep (pls)"),
F(|24|"Cv klep (pls)"),
F(|25|"Compressor"),
F(|26|"Element"),
F(|27|"Trickle heating"),
F(|28|"Fout"),
F(|29|"Vrijkoel"),
F(|30|"Expansieventiel (pls)"),
F(|31|"Kamertemp (°C)"),
F(|32|"Gevr temp (°C)"),
F(|33|"Vraag (%)"),
F(|34|"State"),
F(|35|"Sub_status"),
F(|36|"Blokkade"),
F(|37|"Berekende verdampings temp (°C)"),
F(|38|"Berekende condensatie temp (°C)"),
F(|39|"Foutcode byte 5"),
F(|40|"Foutcode byte 4"),
F(|41|"Foutcode byte 3"),
F(|42|"Foutcode byte 2"),
F(|43|"Foutcode byte 1"),
F(|44|"Foutcode byte 0"),
F(|45|"Handbediening"),
F(|46|"Logging (sec)"),
F(|47|"Compr blok (sec)"),
F(|48|"Elek blok (sec)"),
F(|49|"Cv voor / nadraai (sec)"),
F(|50|"Bron voor / nadraai (sec)"),
F(|51|"Boiler voor / nadraai (sec)"),
F(|52|"Delay elektr (sec)"),
F(|53|"Min draaitijd compr (sec)"),
F(|54|"Afpomp tijd (sec)"),
F(|55|"EV drukvereffenen (sec)"),
F(|56|"EV verstellen (sec)"),
F(|57|"Vrijkoel interval (sec)"),
F(|58|"Handbediening (sec)"),
F(|59|"Lage druk timer (sec)"),
F(|60|"Compressor start (sec)"),
F(|61|"Compr power on delay (sec)"),
F(|62|"Cv start vertraging (sec)"),
F(|63|"Cv stop vertraging (sec)"),
F(|64|"Fout hoogste prioriteit"),
F(|65|"Tijd voor fouthistorie (sec)"),
F(|66|"Max cv retour temp (°C)"),
F(|67|"StroomHardware"),
F(|68|"Fout hoogste prioriteit"),
F(|69|"Vertraging cv start (sec)"),
F(|70|"Vertraging cv stop (sec)"),
F(|71|"Bronpomp snelheid vrijkoel mode"),
F(|72|"Compressor in Cv mode"),
F(|73|"Compressor in boiler mode"),
F(|74|"Element in cv mode"),
F(|75|"Element in boiler mode"),
F(|76|"Cv mode geblokkeerd"),
F(|77|"Boiler mode geblokkeerd"),
F(|78|"Vrijkoel mode geblokkeerd"),
F(|79|"Ontlucht mode geblokkeerd"),
F(|80|"Elektr element geblokkeerd"),
F(|81|"Compressor geblokkeerd"),
F(|82|"Off mode aktief"),
F(|83|"Cv mode aktief"),
F(|84|"Boiler mode aktief"),
F(|85|"Vrijkoel mode aktief"),
F(|86|"Cv pomp voordraaien"),
F(|87|"Bron pomp voordraaien"),
F(|88|"Element vrijgegeven door gebruiker"),
F(|89|"Vrijgave extra koelen"),
F(|90|"Cv vrijgegeven"),
F(|91|"Vrijkoel vrijgegeven"),
F(|92|"Tarief laag vanuit thermostaat"),
F(|93|"Ontluchten vanuit thermostaat"),
F(|94|"Eco geselecteerd op thermostaat"),
F(|95|"Comfort geselecteerd op thermostaat"),
F(|96|"Boiler blokkade vanuit thermostaat"),
F(|97|"Boiler boost vanuit thermostaat"),
F(|98|"Fout_gevonden"),
F(|99|"Fout_retry"),
F(|100|"Taak aktief"),
F(|101|"UTC tijd"),
F(|102|"UTC tijd :"),
F(|103|"Element alleen voor DHW vrijgegeven"),
F(|104|"Spare Ingang"),
F(|105|"Elektr Element DHW geblokkeerd"),
F(|106|"Berekende verdampings temp DHW (°C)"),
F(|107|"Berekende condensatie temp DHW (°C)"),
F(|108|"Adaptief timer (sec)"),
F(|109|"Adaptief oververhitting (K)"),
F(|110|"Adaptief fifo index"),
F(|111|"Warmtevraag (%)"),
F(|112|"P fout bronflow"),
F(|113|"I fout bronflow"),
F(|114|"PI bronflow resultaat"),
F(|115|"Actuele bronklepstand (%)"),
F(|116|"Utc Tijd offset (min.)"),
F(|117|"Gateway Tijd ontvangen"),
F(|118|"OT-tijd valid"),
F(|119|"Tijd uren (uur)"),
F(|120|"Tijd minuten (min)"),
F(|121|"Tijd seconden (sec)"),
F(|122|"Vrijkoel blokkade tijd (min.)"),
F(|123|"Vrijkoelklep control percentage (%)"),
F(|124|"Luchtklep positie (%)"),
F(|125|"HRU uitblaas temp (°C)"),
F(|126|"HRU uitblaas flow (m3/h)"),
F(|127|"Regeneratie aktief"),
F(|128|"Laatst geldige brontoevoer temp. (°C)"),
F(|129|"Bronpomp flow setpoint (l/h)"),
F(|130|"Bronpomp snelheid bij luchtreg + Compr (%)"),
F(|131|"Bronpomp snelheid bij vrijkoel (%)"),
F(|132|"Vrijkoelmodus"),
F(|133|"Vrijkoel aan tijd (sec)"),
F(|134|"Positie CO-klep (%)"),
F(|135|"Reserve"),
F(|136|"E-verbuik tijdens stand-by (kWh)"),
F(|137|"E-verbuik tijdens verwarmen (kWh)"),
F(|138|"E-verbuik tijdens DHW (kWh)"),
F(|139|"E-verbuik tijdens koelen (kWh)"),
F(|140|"Minimale vrijgave tijd extern koelen (sec.)"),
F(|141|"Blokkeertijd vrijgave extern koelen (sec.)"),
F(|142|"Blokkeertijd vrijgave extern verwarmen (sec.)"),
F(|143|"Voorverwarmen tapwater"),
F(|144|"Blokkeertijd trickle low na power-up (sec.)"),
F(|145|"Blokkeertijd trickle low na CV-bedrijf (sec.)"),
F(|146|"Blokkeertijd voorverwarmen tapwater (sec.)"),
F(|147|"Bronpomp snelheid bij Compr (%)"),
F(|148|"Slow start bronpomp (sec.)"),
F(|149|"Bron retourtemperatuur te laag (sec.)"),
F(|150|"Regelperiode bronflow (sec.)"),
F(|151|"Stabilisatie wachttijd vrijkoelen (sec.)"),
F(|152|"Minimale tijd voorverwarmen tapwater (sec)"),
F(|153|"Maximale tijd voorverwarmen tapwater (sec.)"),
F(|154|"Vrijgave elektrisch element (min)"),
F(|155|"Correctie meting delta brontemperatuur (K)")
The |XXX| is added for reference only. I am not sure if this works...
Some coding to get for each name (regardless of the version) the matching versions, not considering squashing (yet).
- Build an array with unique labels across all versions using name
- Iterate over all versions and create an array of label positions
- Show title + unit
RofL! This is just brilliant. This seems to be exactly the same idea as my reply minutes earlier 💯
Script:
<?php
$db = new SQLite3('wpu.db');
$q = "select datalabel from versiebeheer";
$res = $db->query($q);
$dl = [];
// All datalabel numbers in an array
while ($row = $res->fetchArray())
{
$dl[$row['datalabel']] = [];
}
// Collect names per datalabel and the flash label text
foreach($dl as $k=>$v) {
$q = "select * from datalabel_v".$k;
$res = $db->query($q);
while($row = $res->fetchArray()) {
if (! empty($row['unit'])) {
$row['title'] .= " (".$row['unit'].")";
}
$dl[$k][$row['name']] = ucfirst($row['title']);
}
}
// Build array of labels with their associated datalabel number
$labels = [];
foreach($dl as $k=>$v) {
foreach($v as $label=>$id) {
if (! isset($labels[$label]))
{
$labels[$label] = [];
}
$labels[$label][$k] = $id;
}
}
$nr = 0;
$f = [];
// Store label sequences
$labelsequence = [];
foreach($labels as $label => $version) {
$keys = array_keys($version);
$labelsequence[$label][$nr] = $keys;
// Flash message position
$f[$nr] = $version[$keys[0]];
$nr++;
}
// Display the relevant labels numbers per version
foreach($dl as $labelnr=>$nameArr)
{
$fieldseq = [];
foreach($nameArr as $name=>$id) {
$n = $labelsequence[$name];
$fieldseq[] = array_keys($n)[0];
}
printf("const uint8_t itho_WPUstatus%d[] = { %s }\n",$labelnr,join(",",$fieldseq));
}
print("\n\n");
// Flash messages
foreach($f as $pos => $flashlabel) {
printf("F(|%d|\"%s\"),\n",$pos,$flashlabel);
}
Cool, it seems that using the datalabel from VersieBeheer already results in a squashed result, great! That also means there might be missing mappings in the current code so all mappings need to be recreated but that can easily be done with the script.
Here a compiled version with the above info, please test and thanks for this great work! NRG_itho_wifi.ino.esp32.bin.zip
A few small changes made to the script.
<?php
$db = new SQLite3('wpu.db');
$q = 'select DataLabel from VersieBeheer';
$res = $db->query($q);
$dl = [];
// All datalabel numbers in an array
while ($row = $res->fetchArray())
{
$dl[$row['DataLabel']] = [];
}
// Collect names per datalabel and the flash label text
foreach($dl as $k=>$v) {
$q = "select * from Datalabel_V".$k;
$res = $db->query($q);
while($row = $res->fetchArray()) {
if (! empty($row['Eenheid_NL'])) {
$row['Tekst_NL'] .= " (".$row['Eenheid_NL'].")";
}
$dl[$k][$row['Naam']] = ucfirst($row['Tekst_NL']);
}
}
// Build array of labels with their associated datalabel number
$labels = [];
foreach($dl as $k=>$v) {
foreach($v as $label=>$id) {
if (! isset($labels[$label]))
{
$labels[$label] = [];
}
$labels[$label][$k] = $id;
}
}
$nr = 0;
$f = [];
// Store label sequences
$labelsequence = [];
foreach($labels as $label => $version) {
$keys = array_keys($version);
$labelsequence[$label][$nr] = $keys;
// Flash message position
$f[$nr] = $version[$keys[0]];
$nr++;
}
// Display the relevant labels numbers per version
foreach($dl as $labelnr=>$nameArr)
{
$fieldseq = [];
foreach($nameArr as $name=>$id) {
$n = $labelsequence[$name];
$fieldseq[] = array_keys($n)[0];
}
printf("const uint8_t itho_WPUstatus%d[] { %s,255};\n",$labelnr,join(",",$fieldseq));
}
print("\n\n");
print("const __FlashStringHelper *ithoWPUStatusLabels[] = {\n");
// Flash messages
foreach($f as $pos => $flashlabel) {
printf(" F(\"%s\"),\n",$flashlabel);
}
print("};\n");
I've ran it again but had to discard the database field name changes as they didn't match with my sqlite version.
const uint8_t itho_WPUstatus2[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,255 };
const uint8_t itho_WPUstatus4[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,255 };
const uint8_t itho_WPUstatus5[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,68,255 };
const uint8_t itho_WPUstatus6[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,64,65,66,67,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,255 };
const uint8_t itho_WPUstatus7[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,64,101,66,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,102,255 };
const uint8_t itho_WPUstatus8[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,64,101,66,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,102,103,255 };
const uint8_t itho_WPUstatus10[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,102,103,255 };
const uint8_t itho_WPUstatus11[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,102,103,255 };
const uint8_t itho_WPUstatus18[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121,255 };
const uint8_t itho_WPUstatus20[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121,122,255 };
const uint8_t itho_WPUstatus21[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,255 };
const uint8_t itho_WPUstatus22[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,255 };
const uint8_t itho_WPUstatus23[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,255 };
const uint8_t itho_WPUstatus24[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,255 };
const uint8_t itho_WPUstatus25[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,102,103,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,255 };
const uint8_t itho_WPUstatus27[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,135,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,54,53,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,136,137,138,139,102,103,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,140,141,142,255 };
const uint8_t itho_WPUstatus31[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,135,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,54,53,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,136,137,138,139,143,103,114,115,116,122,123,124,125,126,127,128,129,130,131,132,134,140,141,142,144,145,146,102,255 };
const uint8_t itho_WPUstatus33[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,135,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,54,53,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,136,137,138,139,143,103,114,115,116,122,123,124,125,126,127,128,129,147,131,130,132,134,140,141,142,144,145,146,102,148,149,150,151,152,153,255 };
const uint8_t itho_WPUstatus34[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,135,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,54,53,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,136,137,138,139,143,103,114,115,116,122,123,124,125,126,127,128,129,147,131,130,132,134,140,141,142,144,145,146,102,148,149,150,151,152,153,154,255 };
const uint8_t itho_WPUstatus37[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,104,155,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,106,107,98,99,100,45,47,48,49,50,51,52,54,53,55,56,57,58,59,60,61,69,70,108,109,110,64,101,66,71,72,73,74,75,76,77,78,79,80,105,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,111,136,137,138,139,143,103,114,115,116,122,123,124,125,126,127,128,129,147,131,130,132,134,140,141,142,144,145,146,102,148,149,150,151,152,153,154,255 };
const __FlashStringHelper *ithoWPUStatusLabels[] = {
F("Buitentemp (°C)"),
F("Boiler laag (°C)"),
F("Boiler hoog (°C)"),
F("Verdamper temp (°C)"),
F("Zuiggas temp (°C)"),
F("Persgas temp (°C)"),
F("Vloeistof temp (°C)"),
F("Naar bron (°C)"),
F("Van bron (°C)"),
F("CV aanvoer (°C)"),
F("CV retour (°C)"),
F("Druksensor (Bar)"),
F("Stroomtrafo 1 (A)"),
F("Stroomtrafo 2 (A)"),
F("Drukschakelaar"),
F("Hoog / laag"),
F("Condens beveiliging"),
F("Pulsteller"),
F("Flowsensor (lt/hr)"),
F("Fase detectie"),
F("Cv pomp (%)"),
F("Bron pomp (%)"),
F("Boiler pomp (%)"),
F("Vrijkoelklep (pls)"),
F("Cv klep (pls)"),
F("Compressor"),
F("Element"),
F("Trickle heating"),
F("Fout"),
F("Vrijkoel"),
F("Expansieventiel (pls)"),
F("Kamertemp (°C)"),
F("Gevr temp (°C)"),
F("Vraag (%)"),
F("State"),
F("Sub_status"),
F("Blokkade"),
F("Berekende verdampings temp (°C)"),
F("Berekende condensatie temp (°C)"),
F("Foutcode byte 5"),
F("Foutcode byte 4"),
F("Foutcode byte 3"),
F("Foutcode byte 2"),
F("Foutcode byte 1"),
F("Foutcode byte 0"),
F("Handbediening"),
F("Logging (sec)"),
F("Compr blok (sec)"),
F("Elek blok (sec)"),
F("Cv voor / nadraai (sec)"),
F("Bron voor / nadraai (sec)"),
F("Boiler voor / nadraai (sec)"),
F("Delay elektr (sec)"),
F("Min draaitijd compr (sec)"),
F("Afpomp tijd (sec)"),
F("EV drukvereffenen (sec)"),
F("EV verstellen (sec)"),
F("Vrijkoel interval (sec)"),
F("Handbediening (sec)"),
F("Lage druk timer (sec)"),
F("Compressor start (sec)"),
F("Compr power on delay (sec)"),
F("Cv start vertraging (sec)"),
F("Cv stop vertraging (sec)"),
F("Fout hoogste prioriteit"),
F("Tijd voor fouthistorie (sec)"),
F("Max cv retour temp (°C)"),
F("StroomHardware"),
F("Fout hoogste prioriteit"),
F("Vertraging cv start (sec)"),
F("Vertraging cv stop (sec)"),
F("Bronpomp snelheid vrijkoel mode"),
F("Compressor in Cv mode"),
F("Compressor in boiler mode"),
F("Element in cv mode"),
F("Element in boiler mode"),
F("Cv mode geblokkeerd"),
F("Boiler mode geblokkeerd"),
F("Vrijkoel mode geblokkeerd"),
F("Ontlucht mode geblokkeerd"),
F("Elektr element geblokkeerd"),
F("Compressor geblokkeerd"),
F("Off mode aktief"),
F("Cv mode aktief"),
F("Boiler mode aktief"),
F("Vrijkoel mode aktief"),
F("Cv pomp voordraaien"),
F("Bron pomp voordraaien"),
F("Element vrijgegeven door gebruiker"),
F("Vrijgave extra koelen"),
F("Cv vrijgegeven"),
F("Vrijkoel vrijgegeven"),
F("Tarief laag vanuit thermostaat"),
F("Ontluchten vanuit thermostaat"),
F("Eco geselecteerd op thermostaat"),
F("Comfort geselecteerd op thermostaat"),
F("Boiler blokkade vanuit thermostaat"),
F("Boiler boost vanuit thermostaat"),
F("Fout_gevonden"),
F("Fout_retry"),
F("Taak aktief"),
F("UTC tijd"),
F("UTC tijd :"),
F("Element alleen voor DHW vrijgegeven"),
F("Spare Ingang"),
F("Elektr Element DHW geblokkeerd"),
F("Berekende verdampings temp DHW (°C)"),
F("Berekende condensatie temp DHW (°C)"),
F("Adaptief timer (sec)"),
F("Adaptief oververhitting (K)"),
F("Adaptief fifo index"),
F("Warmtevraag (%)"),
F("P fout bronflow"),
F("I fout bronflow"),
F("PI bronflow resultaat"),
F("Actuele bronklepstand (%)"),
F("Utc Tijd offset (min.)"),
F("Gateway Tijd ontvangen"),
F("OT-tijd valid"),
F("Tijd uren (uur)"),
F("Tijd minuten (min)"),
F("Tijd seconden (sec)"),
F("Vrijkoel blokkade tijd (min.)"),
F("Vrijkoelklep control percentage (%)"),
F("Luchtklep positie (%)"),
F("HRU uitblaas temp (°C)"),
F("HRU uitblaas flow (m3/h)"),
F("Regeneratie aktief"),
F("Laatst geldige brontoevoer temp. (°C)"),
F("Bronpomp flow setpoint (l/h)"),
F("Bronpomp snelheid bij luchtreg + Compr (%)"),
F("Bronpomp snelheid bij vrijkoel (%)"),
F("Vrijkoelmodus"),
F("Vrijkoel aan tijd (sec)"),
F("Positie CO-klep (%)"),
F("Reserve"),
F("E-verbuik tijdens stand-by (kWh)"),
F("E-verbuik tijdens verwarmen (kWh)"),
F("E-verbuik tijdens DHW (kWh)"),
F("E-verbuik tijdens koelen (kWh)"),
F("Minimale vrijgave tijd extern koelen (sec.)"),
F("Blokkeertijd vrijgave extern koelen (sec.)"),
F("Blokkeertijd vrijgave extern verwarmen (sec.)"),
F("Voorverwarmen tapwater"),
F("Blokkeertijd trickle low na power-up (sec.)"),
F("Blokkeertijd trickle low na CV-bedrijf (sec.)"),
F("Blokkeertijd voorverwarmen tapwater (sec.)"),
F("Bronpomp snelheid bij Compr (%)"),
F("Slow start bronpomp (sec.)"),
F("Bron retourtemperatuur te laag (sec.)"),
F("Regelperiode bronflow (sec.)"),
F("Stabilisatie wachttijd vrijkoelen (sec.)"),
F("Minimale tijd voorverwarmen tapwater (sec)"),
F("Maximale tijd voorverwarmen tapwater (sec.)"),
F("Vrijgave elektrisch element (min)"),
F("Correctie meting delta brontemperatuur (K)"),
};
Were you able to test the binary?
I installed the latest version and it look ok. All values seem more or less logical.
Result: 80 82 A4 00 01 6F 92 92 92 92 92 92 92 92 92 92 92 92 92 92 0C 0C 0C 0C 10 10 0C 00 00 00 10 10 0C 0C 0C 0C 0C 10 92 92 00 00 00 00 92 92 92 92 00 00 10 0C 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 12 00 00 20 00 00 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 00 00 00 A2 A5 92 92 90 10 00 00 00 00 10 ED
Status:
Result: 80 82 A4 01 01 AA 02 BC 13 6D 13 9E 02 8C 03 FE 1B 51 14 96 03 20 03 E2 09 1A 0A CC 00 78 01 53 00 00 00 00 00 00 00 00 05 71 00 00 45 64 05 AA 05 AA 01 00 00 01 00 01 24 08 48 08 34 00 03 06 00 02 28 16 53 02 28 16 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13 00 00 00 00 00 00 00 00 00 00 08 5A 00 00 00 00 01 F4 17 00 61 94 C0 36 2D 00 00 01 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 01 00 00 00 00 01 00 00 00 01 01 FF FF FF D0 00 6A 1C 01 1A F9 00 00 00 3C 03 B5 01 09 29 1A 00 00 A7
The 4G doesn't have a built-in kWh meter?
The "Gateway tijd ontvangen" implies there's a connection with internet?
Unfortunately the 4g doesn't have a built in kWh meter. They installed an external kWh meter which transmits the values to somewhere. The unit has an add-on, RFP-I2C_U1 which is, for what i assume, a 8-900 Mhz transceiver. The unit receives the time and outside temperature from a gateway. For what I know from the Itho website they have some sort of mesh network. Couple of years ago they were also experimenting with a portal to see all the data we are also trying to get. But as far as i know the portal didn't go further than beta for me at least. I just see that the offer it as a service or something. https://www.ithodaalderop.nl/monitoring
Thanks, the 5G has a built-in kWh meter per activity (heat, standy) so that's what I am using to calculate the daily usage. So I am still not sure if the reported numbers are correct, so benchmarking it against other users was something I was looking for.
I do have some antennas on my 5G but I thought it was for communicating with the thermostat. But this seem to have some more info: https://ithodaalderop.compano.com/Data/Environments/000001/Attachment/Bijlage/A02_Warmtepompen/A02_80_Accessoires/A02_80_01_Grond/A02_80_01_04_Monitoring/B01_04_PRT/TED%20052%20productblad%20Monitoring.pdf
But with Arjen's tool I can get all the status values and visualise it locally with Home Assistant, Influx/Grafana.
More on topic: so what's left is to translate the labels again to English and give the parameters a try?
Adaptation of the script to also include settings
<?php
$lang = 'NL';
//$lang = 'EN';
$product = 'WPU';
$dbname = 'wpu.db';
$pwlevel = 23;
$db = new SQLite3($dbname);
$q = 'select ParameterLijst from VersieBeheer';
$res = $db->query($q);
$dl = [];
// All datalabel numbers in an array
while ($row = $res->fetchArray())
{
$dl[$row['ParameterLijst']] = [];
}
if($lang == 'NL') {
$col_unit = 'Eenheid_NL';
$col_title = 'Tekst_NL';
$col_name = 'Naam';
}
else {
$col_unit = 'unit';
$col_title = 'title';
$col_name = 'name';
}
// Collect names per datalabel and the flash label text
foreach($dl as $k=>$v) {
$q = "select * from Parameterlijst_V$k where Paswoordnivo<$pwlevel";
$res = $db->query($q);
while($row = $res->fetchArray()) {
if (! empty($row[$col_unit])) {
$row[$col_title] .= " (".$row[$col_unit].")";
}
$dl[$k][$row[$col_name]] = ucfirst($row[$col_title]);
}
}
// Build array of labels with their associated datalabel number
$labels = [];
foreach($dl as $k=>$v) {
foreach($v as $label=>$id) {
if (! isset($labels[$label]))
{
$labels[$label] = [];
}
$labels[$label][$k] = $id;
}
}
$nr = 0;
$f = [];
// Store label sequences
$labelsequence = [];
foreach($labels as $label => $version) {
$keys = array_keys($version);
$labelsequence[$label][$nr] = $keys;
// Flash message position
$f[$nr] = $version[$keys[0]];
$nr++;
}
// Display the relevant labels numbers per version
foreach($dl as $labelnr=>$nameArr)
{
$fieldseq = [];
foreach($nameArr as $name=>$id) {
$n = $labelsequence[$name];
$fieldseq[] = array_keys($n)[0];
}
printf("const uint16_t itho_%ssetting%d[] { %s,255};\n",$product,$labelnr,join(",",$fieldseq));
}
print("\n\n");
print("const __FlashStringHelper *itho{$product}SettingsLabels[] = {\n");
// Flash messages
foreach($f as $pos => $flashlabel) {
printf(" F(\"%s\"),\n",$flashlabel);
}
print("};\n");
$q = 'select DataLabel from VersieBeheer';
$res = $db->query($q);
$dl = [];
// All datalabel numbers in an array
while ($row = $res->fetchArray())
{
$dl[$row['DataLabel']] = [];
}
if($lang == 'NL') {
$col_unit = 'Eenheid_NL';
$col_title = 'Tekst_NL';
$col_name = 'Naam';
}
else {
$col_unit = 'unit';
$col_title = 'title';
$col_name = 'name';
}
// Collect names per datalabel and the flash label text
foreach($dl as $k=>$v) {
$q = "select * from Datalabel_V".$k;
$res = $db->query($q);
while($row = $res->fetchArray()) {
if (! empty($row[$col_unit])) {
$row[$col_title] .= " (".$row[$col_unit].")";
}
$dl[$k][$row[$col_name]] = ucfirst($row[$col_title]);
}
}
// Build array of labels with their associated datalabel number
$labels = [];
foreach($dl as $k=>$v) {
foreach($v as $label=>$id) {
if (! isset($labels[$label]))
{
$labels[$label] = [];
}
$labels[$label][$k] = $id;
}
}
$nr = 0;
$f = [];
// Store label sequences
$labelsequence = [];
foreach($labels as $label => $version) {
$keys = array_keys($version);
$labelsequence[$label][$nr] = $keys;
// Flash message position
$f[$nr] = $version[$keys[0]];
$nr++;
}
// Display the relevant labels numbers per version
foreach($dl as $labelnr=>$nameArr)
{
$fieldseq = [];
foreach($nameArr as $name=>$id) {
$n = $labelsequence[$name];
$fieldseq[] = array_keys($n)[0];
}
printf("const uint8_t itho_%sstatus%d[] { %s,255};\n",$product,$labelnr,join(",",$fieldseq));
}
print("\n\n");
print("const __FlashStringHelper *itho{$product}StatusLabels[] = {\n");
// Flash messages
foreach($f as $pos => $flashlabel) {
printf(" F(\"%s\"),\n",$flashlabel);
}
print("};\n");
NRG_itho_wifi.ino.esp32.bin.zip
And again a binary to test (this includes the result from the above script). If this works the labels can be translated to english and I will update the other products' settings and labels as well.
The labels are in the wrong order now.
Label | Value -- | -- temp | 0 hum | 0 ppmw | 0 Adaptief fifo index | 7 Bronpomp snelheid vrijkoel mode | 54.91 Handbediening | 55.44 Berekende condensatie temp (°C) | 27.58 Berekende condensatie temp DHW (°C) | 28.25 Berekende verdampings temp (°C) | 36.53 Berekende verdampings temp DHW (°C) | 28.97 Cv mode aktief | 18.31 Cv mode geblokkeerd | 31.69 Cv pomp voordraaien | 37.35 Cv vrijgegeven | 28.08 Comfort geselecteerd op thermostaat | 1.18 Compr power on delay (sec) | 0 Compressor geblokkeerd | 0 Compressor in Cv mode | 0 Compressor in boiler mode | 0 Vertraging cv start (sec) | 0 Vertraging cv stop (sec) | 0 Boiler mode aktief | 0 Boiler mode geblokkeerd | 0 Boiler blokkade vanuit thermostaat | 0 Boiler boost vanuit thermostaat | 0 Eco geselecteerd op thermostaat | 0 Elektr element geblokkeerd | 0 Elektr Element DHW geblokkeerd | 725 Element in cv mode | 725 Element in boiler mode | 0 Element alleen voor DHW vrijgegeven | 0 Element vrijgegeven door gebruiker | 0 Fout_gevonden | 1 Fout_retry | 0 Vrijgave extra koelen | 0 Vrijkoel mode aktief | 21.21 Vrijkoel mode geblokkeerd | 21 Vrijkoel vrijgegeven | 0 Gateway Tijd ontvangen | 1 Fout hoogste prioriteit | 255 Stroomtrafo 1 (A) | 0 Stroomtrafo 2 (A) | 26.58 I fout bronflow | 31.64 Condens beveiliging | 26.58 Pulsteller | 31.64 Flowsensor (lt/hr) | 0 Hoog / laag | 0 Drukschakelaar | 0 Fase detectie | 0 Actuele bronklepstand (%) | 0 Tarief laag vanuit thermostaat | 0 Max cv retour temp (°C) | 0 Warmtevraag (%) | 0 Off mode aktief | 0 Vraag (%) | 0 Kamertemp (°C) | 0 Gevr temp (°C) | 0 Blokkade | 0 Compressor | 0 Cv pomp (%) | 0 Cv klep (pls) | 0 Boiler pomp (%) | 0 Element | 0 Expansieventiel (pls) | 0 Fout | 0 Vrijkoel | 0 Vrijkoelklep (pls) | 0 Bron pomp (%) | 5 Trickle heating | 0 Druksensor (Bar) | 0 P fout bronflow | 1637145433 PI bronflow resultaat | 45 Spare Ingang | 0 Bron pomp voordraaien | 0 State | 0 Sub_status | 0 Adaptief oververhitting (K) | 0 Boiler laag (°C) | 0 Boiler hoog (°C) | 0 CV retour (°C) | 0 CV aanvoer (°C) | 0 Vloeistof temp (°C) | 0 Persgas temp (°C) | 0 Verdamper temp (°C) | 0 Buitentemp (°C) | 1 Naar bron (°C) | 0 Van bron (°C) | 0 Zuiggas temp (°C) | 0 Taak aktief | 0 Tijd uren (uur) | 0 Tijd minuten (min) | 0 OT-tijd valid | 0 Adaptief timer (sec) | 1 Compr blok (sec) | 0 Cv voor / nadraai (sec) | 0 Boiler voor / nadraai (sec) | 0 Elek blok (sec) | 0 Delay elektr (sec) | 1 EV drukvereffenen (sec) | 0 EV verstellen (sec) | 0 Vrijkoel interval (sec) | 0 Vrijkoel blokkade tijd (min.) | 1 Handbediening (sec) | 1 Lage druk timer (sec) | -0.44 Afpomp tijd (sec) | 70.57305 Min draaitijd compr (sec) | 70.13 Bron voor / nadraai (sec) | 0 Compressor start (sec) | 60 Tijd seconden (sec) | 833 UTC tijd | 1 Utc Tijd offset (min.) | 11 UTC tijd : | 37 Ontlucht mode geblokkeerd | 13 Ontluchten vanuit thermostaat | 0Hmm, in the DB apparently not all data info is sorted the same way... Another try NRG_itho_wifi.ino.esp32.bin.zip
This one looks correct again.
This one looks correct again.
Cool, thanks! Do the settings show up as well?
Settings seems to look correct also. I had not checked that before. List looks pretty limited in comparison with the demandflow.
Thanks! The settings were just added so you couldn't have checked them earlier :) The list is limited indeed, I've used a password level to limit the number of available settings. The total number is settings is larger than currently fits the structure and the higher password level settings are probably more dangerous and less relevant to include. Maybe at a later stage I'll include the other ones as well.
Will give it a try tomorrow too when I am back in NL. But it's looking great already!
I've created https://github.com/arjenhiemstra/ithowifi/wiki/Itho-WPU-Heat-pump-support , but I guess we only got prelim test results from a 5G (me) and 4G (Joost) devices, so that's version 20 and 34. I am not sure if the lower numbers relate to 3G or 4G variants.
I / we can post something on Gathering of Tweakers forum and ask for more volunteers?
I've posted beta5, also on the Tweakers forum. Let's see how it works for the rest of the users. Thanks for al of your help on this!
I also saw the restructured headers with a per device .h file. Looks nice.
I have auto temp on all 3 floors, do you know if anyone tested that already? Otherwise I’ll be the first tomorrow 😉I saw auto temp labels etc are already in English so I take you extracted params and labels from Itho service tool?
I also saw the restructured headers with a per device .h file. Looks nice.
yeah, it was getting kinda messy... :)
I have auto temp on all 3 floors, do you know if anyone tested that already? Otherwise I’ll be the first tomorrow 😉I saw auto temp labels etc are already in English
No, nobody tested it, I just knew someone would be interested in this 😉 Very interested what the result will be!
so I take you extracted params and labels from Itho service tool?
I adapted your script further and ran it against available databases and when needed translated the labels
Ok, auto temp confirmed to work for both status & settings with latest firmware (pulled). Biggest challenge is to interpret the values. E.g. I see 7 rooms but how do they translate to rooms in the house. But definitely useful.
For the WPU there are I think a few settings I'd like to control via API / MQTT: 1) Change requested temperature for thermostat 2) Change mode for boiler (Eco, Comfort, Off, something else) So basically the same functionality one controls today via the thermostat of Itho (Spider).
Are you open to support that (via new feature)? I guess you need to have the CC1101 linked to the Spider module to see which I2C messages you need to send?
Are you open to support that (via new feature)? I guess you need to have the CC1101 linked to the Spider module to see which I2C messages you need to send?
The firmware now transitioned from a PWM 2 I2C controller to something far more complex kind of itho multitool. Probably we would need an interface per device instead of the page with slider and a few buttons and also adapt the API at the same time. Possible? sure Would it be the proper direction for this project? I guess it would! It will probably need some serious time and also understanding what interface is needed for what device.
I guess you need to have the CC1101 linked to the Spider module to see which I2C messages you need to send?
Specially on this, I'm not sure what the spider sends but it can be received by the CC1101 module for sure.
Ok, so I gave it a try with api.html?debug=level3 and see quite a bit of chatter until the page refreshes and the device seems to reboot (Connecting... spinner) which then clears the RF log console. No ideas if it overflows a buffer but after some more rounds of level3 debugging it just locks up (unknown connection state) and restart is needed.
But it makes it difficult to capture so the different scenarios (increase temp, decrease temp etc). I guess it's too much of an ask to send the RF log entries via MQTT so it's easier to process / inspect elsewhere?
Any other suggestions?
I think the 31DA/31D9 might be coming from the Spider when I increased room temp from 20.5 to 21.0 and everything else seems just RF chatter. But it's - as expected - noisy.
22-11-2021 20:58:51: W --- 0B,AE,64 54,9B,41 --,--,-- 22C9 8:04,08,66,7F,FF,01,01,03 (cmd:unknown)
22-11-2021 20:58:51: I --- 54,9B,41 0B,AE,64 --,--,-- 22C9 6:04,08,66,08,CA,01 (cmd:unknown)
22-11-2021 20:58:50: W --- 94,A1,C4 --,--,-- 94,A1,C4 1298 3:00,02,63 (cmd:unknown)
22-11-2021 20:58:46: RP --- 52,EB,C3 54,9B,41 --,--,-- 31DA 30:00,C8,00,03,12,EF,EF,02,02,05,F5,05,F5,02,02,28,08,00,18,01,2C,00,00,EF,EF,7F,FF,7F,FF,00 (cmd:unknown)
22-11-2021 20:58:46: RQ --- 54,9B,41 52,EB,C3 --,--,-- 31DA 1:00 (cmd:unknown)
22-11-2021 20:58:45: RP 123 52,EB,C3 54,9B,41 --,--,-- 31D9 17:00,0A,01,00,20,20,20,20,20,20,20,20,20,20,20,20,00 (cmd:unknown)
22-11-2021 20:58:45: W --- 0B,AE,64 54,9B,41 --,--,-- 22C9 8:04,08,34,7F,FF,01,01,03 (cmd:unknown)
22-11-2021 20:58:45: I --- 54,9B,41 0B,AE,64 --,--,-- 22C9 6:04,08,34,08,98,01 (cmd:unknown)
22-11-2021 20:58:39: W --- 0B,B2,63 0B,AE,84 --,--,-- 4E02 34:00,07,6C,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,04,07,D0,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF (cmd:unknown)
22-11-2021 20:58:37: W --- 0B,B2,73 0B,AE,84 --,--,-- 4E02 34:00,07,6C,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,04,07,D0,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF (cmd:unknown)
22-11-2021 20:58:36: W --- 0B,B2,73 0B,AE,84 --,--,-- 4E01 18:00,07,CF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,00 (cmd:unknown)
Is this useful to begin with?
This looks pretty similar to RAMES-II Rf protocol (from honeywell?) As described here: https://github.com/zxdavb/ramses_protocol
Ok, so I gave it a try with api.html?debug=level3 and see quite a bit of chatter until the page refreshes and the device seems to reboot (Connecting... spinner) which then clears the RF log console. No ideas if it overflows a buffer but after some more rounds of level3 debugging it just locks up (unknown connection state) and restart is needed.
But it makes it difficult to capture so the different scenarios (increase temp, decrease temp etc). I guess it's too much of an ask to send the RF log entries via MQTT so it's easier to process / inspect elsewhere?
Any other suggestions?
I think the 31DA/31D9 might be coming from the Spider when I increased room temp from 20.5 to 21.0 and everything else seems just RF chatter. But it's - as expected - noisy.
22-11-2021 20:58:51: W --- 0B,AE,64 54,9B,41 --,--,-- 22C9 8:04,08,66,7F,FF,01,01,03 (cmd:unknown) 22-11-2021 20:58:51: I --- 54,9B,41 0B,AE,64 --,--,-- 22C9 6:04,08,66,08,CA,01 (cmd:unknown) 22-11-2021 20:58:50: W --- 94,A1,C4 --,--,-- 94,A1,C4 1298 3:00,02,63 (cmd:unknown) 22-11-2021 20:58:46: RP --- 52,EB,C3 54,9B,41 --,--,-- 31DA 30:00,C8,00,03,12,EF,EF,02,02,05,F5,05,F5,02,02,28,08,00,18,01,2C,00,00,EF,EF,7F,FF,7F,FF,00 (cmd:unknown) 22-11-2021 20:58:46: RQ --- 54,9B,41 52,EB,C3 --,--,-- 31DA 1:00 (cmd:unknown) 22-11-2021 20:58:45: RP 123 52,EB,C3 54,9B,41 --,--,-- 31D9 17:00,0A,01,00,20,20,20,20,20,20,20,20,20,20,20,20,00 (cmd:unknown) 22-11-2021 20:58:45: W --- 0B,AE,64 54,9B,41 --,--,-- 22C9 8:04,08,34,7F,FF,01,01,03 (cmd:unknown) 22-11-2021 20:58:45: I --- 54,9B,41 0B,AE,64 --,--,-- 22C9 6:04,08,34,08,98,01 (cmd:unknown) 22-11-2021 20:58:39: W --- 0B,B2,63 0B,AE,84 --,--,-- 4E02 34:00,07,6C,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,04,07,D0,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF (cmd:unknown) 22-11-2021 20:58:37: W --- 0B,B2,73 0B,AE,84 --,--,-- 4E02 34:00,07,6C,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,04,07,D0,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF (cmd:unknown) 22-11-2021 20:58:36: W --- 0B,B2,73 0B,AE,84 --,--,-- 4E01 18:00,07,CF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,7F,FF,00 (cmd:unknown)
Is this useful to begin with?
Hmm, lockups are strange, should not happen. Everything you see is logical data btw. It adheres to the RF standard (most noise is filtered out by the CC1101 chip using a sync word)
It is the ramses-ii protocol I got my logging format inspiration from that repo. This repo is also very interesting: https://github.com/ghoti57/evofw3/wiki
Itho Daalderop also provides heat-pumps (water/water) which uses I2C communication as well similar to the HRU units.
Today the end-user can only control limited parameters (room temp, heating moment) but not read parameters. This is useful to get more information out of the device similar to what's used here: https://github.com/pommi/python-itho-wpu/tree/370209603b70a464821b8340ce9e07c4b6c08855
Why via this project if there are already solutions out there? 1) MQTT gives much more flexibility than storing it locally (in influx) 2) Soldering / Raspberry PI only adds complexity 3) Single PCB design for multiple devices made by Itho
I've created a simple script that reads the WPU database of Itho and converts it to a C++ header file to get a head start. It's here: https://github.com/jasperslits/ithowifi/blob/master/wpu.h
I was only able to compile test it (create a .cpp file and include the header) but would this be of any help as I cannot functionally test it?
Happy to assist with testing and on GoT there are more volunteers if needed.