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

Merge WPU manual control from fork #234

Closed tomkooij closed 4 months ago

tomkooij commented 4 months ago

This merges the changes in the private fork that enables "manual operation". It is mainly used for controlling the WPU heatpump.

This commit adds "4030 Manual control" to the debug page. The debug option "dryrun" is removed. It is no longer needed for initial debugging.

Ref: https://gathering.tweakers.net/forum/list_message/77786836#77786836

It seems to work, but I will do some more testing tomorrow, to make sure this actually works.

TODO:

arjenhiemstra commented 4 months ago

Thanks!

I've pushed some textual changes and a first try for some documentation for the api page of the add-on. Could you have a look and add some details to the key descriptions (I do not know the possible values and their function) the basic text is already there.

https://github.com/arjenhiemstra/ithowifi/tree/pr/234

arjenhiemstra commented 4 months ago

and here also a compiled firmware file for those who want to test: nrgitho-v2.7.4-pr234-test.bin.zip

tomkooij commented 4 months ago

I've tested this and it works OK.

I do notice something that might be better to fix. If I leave an extra comma in the MQTT command:

{
            "manual_operation_index":34,
            "manual_operation_datatype":0,
            "manual_operation_value":0,
            "manual_operation_checked":1,
}

Note the extra comma after "checked":1, This is valid JSON, but the command is rejected (picked up as another type of command). Debug log shows:

Feb 25 07:39:52 nrg-itho-c2a8 nrgitho EXEC COMMAND:{ "manual_operation_index":30, "manual_operation_datatype":0, "manual_operation_value":0, "manual_operation_checked":1,#012}

instead of the D_LOG() echos of the command that is executed:

Feb 25 07:40:09 nrg-itho-c2a8 nrgitho index: 30 dt: 0 value: 0 checked: 1
Feb 25 07:40:09 nrg-itho-c2a8 nrgitho Sending 4030: 82 80 40 30 06 07 01 00 1E 00 00 00 01 61
tomkooij commented 4 months ago

I merged pr/234 into this and added (a little bit) of information. The information is from the (publicly available) documentation of the i2c modbus module: https://www.ithodaalderop.nl/nl-NL/consument/product/03-00638 (Table 8.4). I'm not sure if we should provide a link / reference to this source.

In the past I've added some documentation for these WPU features to the wiki: https://github.com/arjenhiemstra/ithowifi/wiki/Itho-WPU-Heat-pump-support I will add something about manual control as well

EDIT: Done.

arjenhiemstra commented 4 months ago

I've tested this and it works OK.

I do notice something that might be better to fix. If I leave an extra comma in the MQTT command:

{
            "manual_operation_index":34,
            "manual_operation_datatype":0,
            "manual_operation_value":0,
            "manual_operation_checked":1,
}

Note the extra comma after "checked":1, This is valid JSON, but the command is rejected (picked up as another type of command). Debug log shows:

Feb 25 07:39:52 nrg-itho-c2a8 nrgitho EXEC COMMAND:{ "manual_operation_index":30, "manual_operation_datatype":0, "manual_operation_value":0, "manual_operation_checked":1,#012}

instead of the D_LOG() echos of the command that is executed:

Feb 25 07:40:09 nrg-itho-c2a8 nrgitho index: 30 dt: 0 value: 0 checked: 1
Feb 25 07:40:09 nrg-itho-c2a8 nrgitho Sending 4030: 82 80 40 30 06 07 01 00 1E 00 00 00 01 61

Had a small look into this. A JSON with a stray comma (one not followed by an object key or array value) is not a valid JSON. That is exactly what you see happening.

The input fails here: https://github.com/arjenhiemstra/ithowifi/blob/cd73d0e541ce366a00b3127adf05328b32d424f9/software/NRG_itho_wifi/main/tasks/task_mqtt.cpp#L312

and hits this line: https://github.com/arjenhiemstra/ithowifi/blob/cd73d0e541ce366a00b3127adf05328b32d424f9/software/NRG_itho_wifi/main/tasks/task_mqtt.cpp#L314

as there is an error in the JSON, the API processing passed the input to the ithoExecCommand function here: https://github.com/arjenhiemstra/ithowifi/blob/cd73d0e541ce366a00b3127adf05328b32d424f9/software/NRG_itho_wifi/main/tasks/task_mqtt.cpp#L446-L448

what is passed is the raw input string (s_payload), which is logged in the ithoExecCommand function.

arjenhiemstra commented 4 months ago

I merged pr/234 into this and added (a little bit) of information. The information is from the (publicly available) documentation of the i2c modbus module: https://www.ithodaalderop.nl/nl-NL/consument/product/03-00638 (Table 8.4). I'm not sure if we should provide a link / reference to this source.

In the past I've added some documentation for these WPU features to the wiki: https://github.com/arjenhiemstra/ithowifi/wiki/Itho-WPU-Heat-pump-support I will add something about manual control as well

EDIT: Done.

nice work, thanks!!!

arjenhiemstra commented 4 months ago

I merged pr/234 into this and added (a little bit) of information. The information is from the (publicly available) documentation of the i2c modbus module: https://www.ithodaalderop.nl/nl-NL/consument/product/03-00638 (Table 8.4). I'm not sure if we should provide a link / reference to this source.

I just had a look at this link, imho it's best to leave as little external dependancies as possible. but I read this: "Artikelprijs: € 449,00" Whut?! Is that the price for something as simple as a i2c to modbus converter?!?! That's outrageously crazy