arjenhiemstra / ithowifi

Itho wifi add-on module (ESP32 wifi to itho I2C protocol)
GNU General Public License v3.0
170 stars 29 forks source link

wpu.h for version 41 #240

Closed tomkooij closed 3 months ago

tomkooij commented 4 months ago

This is created with the script create_device_header.py from https://github.com/tomkooij/itho_parameters/ This script autogenerates the Status and Setting labels, but imports the hand-translated orginal status labels. The status labels cannot change without breaking MQTT.

In short:

The settinglabels were quite "broken". Many duplicate keys with similar but slightly different values. These labels are all autogenerated, hence some are still in Dutch. (Most are in English, all labels for recent hardware is in English). There are quite a few bad translations and typos. (frost, forst and vorst mixed, for example)

I have added indexvalues (in comments) to the settinglables. This helps a lot when debugging/cross-referencing. I would like to add that as well to de StatusLabels, but I have turned it off for now, so the diff is easier/clearer.

I have not fully tested this, but this seems OK. I will double check the settinglabels with my v37 WPU.

TODO:

I'm not sure if this is "the way to go" (and it is autogenerated, so easy to change)

tomkooij commented 4 months ago

This should be OK / finished now.

I added the comments/labelindices in a separate commit d873011e4570fe99bad231fc22771c7e2bf0b3cc, So it is easy to check using 6f3ccfb that the Statustabels have not changed in this PR.

The setting labels have considerable changes. Most hand translations were a bit better that the "default" english translation, but it both works and is auto-generated without too much trouble, so I strongly prefer the new setting labels.

I have tested this on my v37 heatpump, and manually checked the values, to prevent regression of the issue mentioned above. Works fine. I'll ask @RobBie1221 to test.

(I will make sure the python script, see link above, is a bit more documented and add autotemp, so that it is clear how to use it with different hardware)

arjenhiemstra commented 4 months ago

thanks for you work on this!!

Most hand translations were a bit better that the "default" english translation, but it both works and is auto-generated without too much trouble, so I strongly prefer the new setting labels.

You mean, leave the auto generated mixed dutch/english labels as they are in the PR because this makes it repeatable towards the future?

RobBie1221 commented 4 months ago

Works perfect for me 👍

tomkooij commented 4 months ago

You mean, leave the auto generated mixed dutch/english labels as they are in the PR because this makes it repeatable towards > the future?

Yes, It is certainly possible to do it in the same way as the status labels (my script simply uses a lookup table copied from wpu.h), but for setting labels that would be a lot of extra work, as currently there are many duplicates.

The dutch labels only appear in old firmware versions. On recent models everything is in English. But still the hand translated version were a bit better, as there are quite some typos in the auto-generated version.

Indeed it should (repeatable) auto-generate a new wpu.h when a new firmware appears. (fingers-crossed)

arjenhiemstra commented 3 months ago

This is created with the script create_device_header.py from https://github.com/tomkooij/itho_parameters/ This script autogenerates the Status and Setting labels, but imports the hand-translated orginal status labels. The status labels cannot change without breaking MQTT.

In short:

  • SettingLabels are newly generated, with a lot of differences.
  • StatusLabels are mostly unchanged.

The settinglabels were quite "broken". Many duplicate keys with similar but slightly different values. These labels are all autogenerated, hence some are still in Dutch. (Most are in English, all labels for recent hardware is in English). There are quite a few bad translations and typos. (frost, forst and vorst mixed, for example)

I have added indexvalues (in comments) to the settinglables. This helps a lot when debugging/cross-referencing. I would like to add that as well to de StatusLabels, but I have turned it off for now, so the diff is easier/clearer.

I have not fully tested this, but this seems OK. I will double check the settinglabels with my v37 WPU.

TODO:

  • [x] L649 is broken. If have misinterpreted the way firmware versions work.
  • [x] Add indices (comments) to statuslabels
  • [x] Manually check v37, to prevent regression of WPU Heatpump settings incorrect #119 where settinglabels were misaligned.

I'm not sure if this is "the way to go" (and it is autogenerated, so easy to change)

Unfortunately this python script will only work on windows machines. The driver is indeed win32 only. for linux/mac it seems that mdbtools is the way to go, here an example.

https://wenyu-z.medium.com/reading-ms-access-mdb-files-on-mac-969a176baa7a

edit: With this little test script:

import pandas as pd
import subprocess, json

def show_tables(path='WPU.mdb'):
    tables = subprocess.check_output(["mdb-tables", path])
    print(json.dumps(tables.decode().split(), indent=4))

if __name__ == '__main__':
    show_tables()

I'm able to read the DB on my mac. No password needed...

tomkooij commented 3 months ago

I tried mdbtools works fine on Linux, but ofcourse that doesn't run as well on win32. I couldn't get it to work with pandas. Sigh.

It is however very easy to read an .mdb file using mdbtools and convert it to sqlite. I changed the script to read/process sqlite and included a conversion script mdb2sqlite that uses mdbtools: https://github.com/tomkooij/itho_parameters/

I still need to verify that Autotemp (or different hardware) also works. But it seems fine.

arjenhiemstra commented 3 months ago

I tried mdbtools works fine on Linux, but ofcourse that doesn't run as well on win32. I couldn't get it to work with pandas. Sigh.

Bummer, I had hopes it would be possible to compile it using windows...

It is however very easy to read an .mdb file using mdbtools and convert it to sqlite. I changed the script to read/process sqlite and included a conversion script mdb2sqlite that uses mdbtools: https://github.com/tomkooij/itho_parameters/

Thanks a lot!

I still need to verify that Autotemp (or different hardware) also works. But it seems fine.

If I can find some time I'l try to do some comparisons as well. This will probably be somewhere this weekend