-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Support for WPU Version 41 #238
Comments
Thanks for you this issue. I see that there is indeed a new version in the servicetool.
Unfortunately there is no easy way to get these labels out of the tool, for starters because all labels are in Dutch... |
Dutch is not an issue ;-) Do you need an account for the service tool to be able to see the labels? Theoretically, if I would build a new version for myself to test where I copy the status registers from version 37, could that work? |
Ok, the status label are easy, not a lot of changes, commit aa65d7b settings labels need a bit more work |
if you pull this repo and build it you should have status labels |
I theory the settings should be an easy fix as well. There is one change on an existing index (228) and there are 10 additions. |
Thanks for the fast response! Took me some time to build, commit aa65d7b doesn't actually build with me (gives 2 errors regarding type conversion). I was able to build the change of this commit on top of 2.8.0. I now see status data again! |
Hmm, your correct. I accidentally checked in two files extra... trying to do too many things at once... I'll fix that here is a reference to the script in use to generate the files But somehow its not working anymore, need to check this one into version control as well cleary |
Thanks for the hint towards the script. I just manually opened the par file from the tool, still trying to understand how it's all built together. For now at least my monitoring is running again. I'll see if I can get the script working to also get parameters in for version 41. |
Here is some useful info about the par files and how to download them: and here is the "latest" version of the script. I'm far from an PHP expert and as said, should have better kept track of things using vc. If you can help out, that would be great! <?php
$lang = 'NL';
//$lang = 'GB';
//$lang = 'other';
$product = 'WPU'; //(cve14, cve1B, demandflow, autotemp, hrueco, hru200, hru250-300, hru350, WPU)
$dbname = 'wpu.db';
$pwlevel = 500;
//use versionlist instead of DB query
//cve14
//$versions = [1,2,3,4,5,6];
//cve1B
//$versions = [6,7,8,9,10,11,17,18,20,21,22,24,25,26,27];
//demandflow
//$versions = [1,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21];
//autotemp
//$versions = [1,2,3,4,5,6,7,8,9,10,12,13];
//hrueco
//$versions = [3,4,6,7,8,10,11,12];
//hru200
//$versions = [12,13,14,15,17,18,19,20,21,25,26,27];
//hru250-300, $lang = 'GB';
//$product = 'HRU250_300';
//$versions = [1,2,3,4,6,7,8,9,10];
//hru350
//$versions = [1,3,4];
//wpu & set $verlist to TRUE
$versions = [];
$verlist = TRUE;
$db = new SQLite3($dbname);
$dl = [];
if ($verlist == TRUE) {
$q = 'select DataLabel from VersieBeheer';
$res = $db->query($q);
// All datalabel numbers in an array
while ($row = $res->fetchArray()) {
$dl[$row['DataLabel']] = [];
}
}
else {
foreach ($versions as $value) {
$dl[$value] = [];
}
}
if($lang == 'NL') {
$col_unit = 'Eenheid_NL';
$col_title = 'Tekst_NL';
$col_name = 'Naam';
}
else if($lang == 'GB') {
$col_unit = 'Eenheid_GB';
$col_title = 'Tooltip_GB';
$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 ORDER BY `Index` ASC";
$res = $db->query($q);
while($row = $res->fetchArray()) {
// if (empty($row[$col_title])) {
// $col_title_save = $col_title;
// $col_title = 'Naam';
// }
echo print_r($row);
$fullname = $row[$col_title];
if (!empty($row[$col_unit])) {
$row[$col_unit] = preg_replace('/[\s]+/','',$row[$col_unit]);
//Strip off spaces and non-alpha-numeric
$fullname .= " (".$row[$col_unit].")";
}
if (!empty($row[$col_unit])) {
$unit = "";
if (strcmp($row[$col_unit], "%") == 0) $unit = 'perc';
else if (strcmp($row[$col_unit], "% ") == 0) $unit = 'perc';
else if (strcmp($row[$col_unit], "°c") == 0) $unit = 'degc';
else {
$unit = $row[$col_unit];
}
$unit = preg_replace('/[\W]+/','',$unit);
$row[$col_title] .= "_".$unit;
$row[$col_title] = preg_replace('/[[:space:]]+/', '-', $row[$col_title] ?? '');
}
//$dl[$k][$row[$col_name]] = strtolower($row[$col_title]);
$dl[$k][$row[$col_name]] = array(ucfirst($fullname ?? ''), strtolower($row[$col_title] ?? ''));
// $col_title = $col_title_save;
//echo print_r($dl[$k]);
echo "\n";
}
}
// 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;
}
//p rint_r($labels);
echo "\n";
}
$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[array_key_last($keys)]];
//p rint array_key_last($keys)."\n";
//p rint_r($keys)."\n";
$nr++;
}
print("\n");
// 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");
print("const struct ithoLabels itho{$product}StatusLabels[] {\n");
//print("const __FlashStringHelper *itho{$product}StatusLabels[] = {\n");
// Flash messages
foreach($f as $pos => $flashlabel) {
$flashlabel[1] = preg_replace('/[[:space:]]+/', '-', $flashlabel[1] ?? '');
$flashlabel[1] = preg_replace('/^[\-]+/','',$flashlabel[1] ?? '');
// Strip off the starting hyphens
$flashlabel[1] = preg_replace('/[\-]+$/','',$flashlabel[1] ?? '');
// // Strip off the ending hyphens
//$ flashlabel = preg_replace('/[\s\W]+/','-',$flashlabel);
// Strip off spaces and non-alpha-numeric
printf(" { \"%s\", \"%s\" },\n",$flashlabel[0],$flashlabel[1]);
}
print("};\n");
$dl = [];
if ($verlist == TRUE) {
$q = 'select ParameterLijst from VersieBeheer';
$res = $db->query($q);
// All datalabel numbers in an array
while ($row = $res->fetchArray()) {
$dl[$row['ParameterLijst']] = [];
}
}
else {
foreach ($versions as $value) {
$dl[$value] = [];
}
}
if($lang == 'NL') {
$col_unit = 'Eenheid_NL';
$col_title = 'Tekst_NL';
$col_name = 'Naam';
if($product == 'DemandFlow') {
$col_title = 'Naam_fabriek';
}
if($product == 'WPU') {
$col_name = 'Tekst_NL';
}
}
else if($lang == 'GB') {
$col_unit = 'Eenheid_GB';
$col_title = 'Tekst_GB';
$col_name = 'Naam';
if($product == 'WPU') {
$col_name = 'Tekst_NL';
}
}
else {
$col_unit = 'unit';
$col_title = 'title';
$col_name = 'name';
}
// Collect names per settingslabel and the flash label text
foreach($dl as $k=>$v) {
$q = "select * from Parameterlijst_V$k where Paswoordnivo<$pwlevel ORDER BY `Index` ASC";
$res = $db->query($q);
while($row = $res->fetchArray()) {
if (empty($row[$col_title])) {
if($product == 'AutoTemp') {
$col_title = 'Naam';
}
if($product == 'WPU') {
$col_title = 'Naam_fabriek';
}
}
if(strcmp($row[$col_title] ?? '', "Minimum ventilation speed during Auto Night mode") == 0 || strcmp($row[$col_title] ?? '', "Minimum ventilation speed during Auto mode") == 0) {
$col_title = 'Naam';
}
if (!empty($row[$col_unit])) {
$row[$col_unit] = preg_replace('/[\s]+/','',$row[$col_unit]);
//Strip off spaces and non-alpha-numeric
$row[$col_title] .= " (".$row[$col_unit].")";
}
$dl[$k][$row[$col_name]] = ucfirst($row[$col_title] ?? '');
if($product == 'AutoTemp') { //check if correct
$col_title = 'Tekst_GB';
}
if($product == 'WPU') { //check if correct
$col_title = 'Tekst_GB';
}
}
}
// 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[array_key_last($keys)]];
$nr++;
}
print("\n");
// 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,999};\n",$product,$labelnr,join(",",$fieldseq));
}
print("\n");
print("const char* itho{$product}SettingsLabels[] = {\n");
// Flash messages
foreach($f as $pos => $flashlabel) {
printf(" \"%s\",\n",$flashlabel);
}
print("};\n");
|
Looking at my own earlier reply in the mentioned issue:
It probably has something to do with the data alignment (rows in the DB do not appear to be stored in index order), the script does not correct for that |
I have a tool that needs cleaning up that does just this... Shall I dig into this and add the setting labels for v41, or is this already fixed by @RobBie1221 ? |
I didn't fix anything yet, I'm still in a learning curve ;) If you can do this that would be perfect. |
Unfortunately my (spaghetti) code just reads all the StatusLabels and exports a list. However, the order does not seem to match I guess last time I just manually edited/added some stuff. (Just like I manually editted the double 'utc-time' key). I'll try to write the records to sqllite and try with the PHP tool above. |
If I look in the database, If this is the case, I wonder how parsing has been done with scripts before, because e.g. v37 is also inserted before v4... I can make a script which parses from v1 to v41 (first to last), but that would also maybe change |
@RobBie1221 I just read the tables from the Access database (parameter file). Using code copied from I have two problems which prevent me from auto-generating much of
The StatusLabels seems to autogen just fine (except from different descriptions, but the order is an exact match) I'll upload my python notebook to GitHub so you can have a look: (This is a "work in progress" notebook, I have not cleaned it up) |
I also noticed StatusLabels are different in sense of descriptions, this probably has to do with different descriptions. Some StatusLabels have among versions the same I'm trying to wrap my head around this: That should simply fetch the |
Also if I order the versions ASC the result is the same, also with old db files unfortunately |
I think I manually translated the labels because no english version was available. Some other devices have english labels and some luckily don't get updated as often :) |
Thats correct, the goal is to store labels with as little memory as possible. User a certain labels (Naam, Tekst_NL etc.) as keys. The keys need to be unique in the sense that they generate enough unique labels for all settings across all firmware versions to be covered. This sometimes means a value can be repeated, keys were different in that case. Unfortunately, the db files of the service tool are a just as much spaghetti as our code :) What would be great is if we could generate the .h file and with that output check agains the db if all labels line up with device fw version x and index no y etc. |
Just checking here, I'm now manually reading and trying to interpret the v37 parameter list. Via Access I can see the following: Here:
It seems that index 228 refers to position 409 from ithoWPUSettingsLabels. Position 409 should be:
Right? Or am I seeing this wrong?
|
You should read it as follows: ithoWPUSettingsLabels[409] = "Log interval (sec)" which indeed is in the db:
|
Okay, My understanding of this as of now:
My proposed solution: Auto-generate
The solution above would ofcourse introduce the chance of broken settings (mis-aligned labels) but I can at least check it for version 37 myself and this should give a higher confidence in the correctness. @arjenhiemstra Looking at your php-script above, I don't think the script can do the above mentioned things, right? (I cannot save some work by trying to figure out PHP?). |
O... I've thought a little bit about this, but the solution above is not a real solution: It would work for Anyway, I'll finish the python script. Propose a new |
If the generator script works correctly, new version additions should only result in labels being added to the end of the array. Only these new labels need translation if no english version is available. This worked up until now with the wpu settings. The datalables I checked in have been created in exact that way, there is a bit of manual work involved but this is minimal.
You do have a "database", this is the current wpu.h ;-)
Proper sorting of the tables before generating the label should fix this (also for future releases). Because then the order in wich labels are placed in the array with the script are always the same and new additions should end up at the bottom.
Statuslabels are correct and already auto generated, only the translation is manual. No rework needed here I would say.
I think we should indeed use an updated script to autogenerate the settings labels (at first it is fine when this is in Dutch). Then we need to check of the generated settings labels match up with the settings for that version, it seems we can easily check that with your devices for version 37 and 41, some manual and/or automated test can be generated for the other versions. Other option is to manually add it now for version 41 and hope there will be no other wpu firmware versions but I think that's not the best idea ;-) |
Okay, I can do most of this. I’ll submit a PR. |
and PHP or Python, either is fine. I think Python might be a bit easier to maintain |
I agree with Pythong being easier. I created that PHP script for a quick headstart of WPU support, didn't expect it would be considered after 2? years again. |
haha, still in use indeed :) |
@RobBie1221 #240 seems ready (and tested on fw37 by myself). Can you test? (I guess you can build it yourself, please do, or use this: https://www.dropbox.com/scl/fi/9hnr8whhgetirn74o51hz/nrgitho-v2.8.0-pr240.bin?rlkey=kq86zy0o9o42zwkolcf0nth85&dl=0) |
I can build myself. I will test it this evening. Thanks for the effort! |
Hi, I have an Itho WPU 5G here at home, hardware version 83, firmware version 41. I have a board with hardware revision: NON-CVE 1 and firmware 2.9.0-beta1. The board came with firmware 2.8.0 and I did not see any status values. I updated to 2.9.0-beta1 and briefly saw some values and after configuring mqtt some values made it to Home Assistant as well. However after a couple of hours everything stopped working. The controller is reporting everything is well and I don't see any I2C issues, however no data. I would love some pointers to help fix this and maybe improve the firmware as well! |
@arjenhiemstra As said in the previous comment, I have WPU 5G running firmware 41 at home. I'v now got the message " i2c bus stuck - please power cycle the Itho unit", with the following logs:
|
First of all, kudos for the very nice prints and code, I use them on my WPU as well as all my AutoTemp units!
Today, they exchanged my heatpump. The print used to work perfectly, but they bumped me to hw version 83, fw version 41.
It seems from wpu.h that up to fw version 37 is currently supported.
Obviously, I'd like to get support in for fw version 41.
I can add some effort, but need some guidance. It seems I need to extend wpu.h? Could I test this by locally running build_script.py from Python to generate a binary?
How would I be able to determine if they added / changed some settings / status registers? Do I need to enable sniffing?
The text was updated successfully, but these errors were encountered: