budulinek / arduino-altherma-controller

Arduino-based controller for Daikin Altherma heat pumps. The controller connect to the Altherma heat pump via P1/P2 bus, has a built-in webserver for configuration (of the controller itself). Integration to Loxone home automation system via UDP protocol, allows you to monitor and control your Altherma heat pump.
GNU General Public License v2.0
46 stars 11 forks source link

Daikin and Modbus interface #4

Open jelockwood opened 2 years ago

jelockwood commented 2 years ago

@budulinek You mention in your ReadMe

There is no external Modbus adapter for newer Altherma models, the official LAN adapter is very limited in functionality and as of today Daikin has no usable public API or cloud-based solution.

However I found the following two products. Would these solve this problem?

https://www.daikin.eu/en_us/products/RTD-W.html - For use with Altherma 3 HT models I believe https://www.daikin.eu/en_us/products/RTD-LT-CA.html - For use with Altherma 3 LT models I believe

See this discussion https://community.openhab.org/t/how-to-integrate-daikin-altherma-lt-heat-pump/16488/ and in particular this post https://community.openhab.org/t/how-to-integrate-daikin-altherma-lt-heat-pump/16488/17

adicorra commented 1 month ago

Thanks for your recap. Yes, I can confirm everything is working perefectly. I didn't experience the issues with the other commercial gateways since I didn't test them, but if @StefanR71 tells me exactly what register (on the Altherma) doesn't work because of the multiple parts inside the data packet , then I can test it live and confirm.

adicorra commented 1 month ago

@budulinek, regarding the default IP, can you please confirm because I recall to have changed it and reflashed but didn't seem to take into account (I mean before going in the WebUI). This is important as the gateway will be in the unit casing and don't want to unwire just to change the IP one day. Ideally can we get another IP adress at boot without going through the WebUI ?

Did I do this correctly ? In yellow the values I changed (here they are as default of course)

defaultIP

budulinek commented 1 month ago

@adicorra Yes, this is where you change the default IP. You can also see the default static IP on the "Tools" page in web UI. And you can test your default IP by clicking "Load Default Settings". The button will erase your EEPROM (only MAC address is retained) and default settings from advanced_settings.h will be apllied (incl. your default IP) .

BTW can I use the picture of your hardware (with the KKSB case) in my my readme?

adicorra commented 1 month ago

Yes you can, with pleasure.

adicorra commented 1 month ago

Update : this morning I had just setup 2 input sensors that worked fine and supplied me with the water temp.

I tried to control the cooling today and it takes it (relay 1 goes on) and the remotcon led goes green but the PUMP does not start. I checked the min outside temperature thinking it was reset and the value is correct.

I don't know whats going on.

Also, if I change the "Room Cooling Setpoint" the value on the remotcon doesn't change. Weird. I sent commands over the gateway such as 01 06 00 07 00 15

adicorra commented 1 month ago

Found the issue ! Before I had the LAN adpater and when I removed it (because its not compatible with a Remotcon + DCOM), my room thermostat switched to "At Unit" in [A.2.1.B] - Once switched back to "In Room" as it should be (thermostat) then all came back as before and HP working now with Climate Entities from HA.

adicorra commented 1 month ago

@budulinek here is a picture of the full kit installed on a DIN rail inside the indoor unit.

IMG_8763

You can use it as you wish.

adicorra commented 1 month ago

A lot of invalid RTU responsed (in just 12h hours). What are these coming from ? My RS485 card is working fine, no errors reported by the HP.

Timeouts

budulinek commented 1 month ago

A lot of errors? Come on...

Most probable cause of these soft errors: Arduino delays in processing the response. Arduino is a single-threaded computer. I have invested a lot of effort in optimizing the code to make it non-blocking (I have even modified some of the core functions in the ethernet library). But I suspect that under certain circumstances (0,5% of cases), Arduino is not fast enough to process the Modbus RTU response. What probably happens:

As I said, Invalid RTU Response and Response Timeout are soft (fully recoverable) errors. Treat them as warnings - no need to worry about them. Watch out for Slave Responded with Error, Gateway Overloaded and Slave Failed to Respond.

adicorra commented 4 weeks ago

No problem, I was anticipating your answer that it is not an issue since I mentioned not to have errors. I was just curious to understand from where these "dropped communications" could come from and I think you have a given a clear analysis. Your project is so good that it even tracks such "missed paquets". I really appreciate what you have done on optimizing the code. A nice project in the end. Did you consider industrializing it in a complete package ?

adicorra commented 3 weeks ago

Hi @budulinek

How do we disable this if we have hardware flow control ?

define RS485_CONTROL_PIN 6

Do we just "delete" the line?

PS : im facing issues with the arduino not accessible when it starts (I havent identified why yet).

adicorra commented 3 weeks ago

@StefanR71 Arduino ethernet is just crap, not industrial and not stable. Going with this, industrial and works perfectly ! https://www.pusr.com/products/din-rail-rs485-serial-to-ethernet-converter-usr-dr302.html

StefanR71 commented 3 weeks ago

@StefanR71 Arduino ethernet is just crap, not industrial and not stable. Going with this, industrial and works perfectly ! https://www.pusr.com/products/din-rail-rs485-serial-to-ethernet-converter-usr-dr302.html

Yes it is working, when you query only single registers or registers that are directly following. But when you query multiple registers like 2, 8, 30 then it isn't working you will receive only the answer for the first register. I was in touch with the support and they told me this is an issue.

adicorra commented 3 weeks ago

This is not an issue to control the Altherma,

StefanR71 commented 3 weeks ago

This is not an issue to control the Altherma,

It is an problem when you query the following registers in one query:

Input registers: 29, 30, 34, 36, 37, 39, 40, 41, 42, 43, 44, 48, 51, 52 Holding registers: 0, 1, 2, 3, 9, 11

When i send this directly to the HomeHub via Modbus TCP i'm getting an answer. But when the HomeHub is in RTU mode and i use the USR IOT gateway i'm gettig a timeout, because the gateway don't understand multiple Modbus packets in one TCP packet.

So query single registers is a workaround to get this working but the behavior of the gateway isn't correct.

adicorra commented 3 weeks ago

Ok, but what devices do such multiple requests ? I don’t think HA does this nor the Fibaro app.

I will test the commercial one and let you know. The fact that Arduino is some sort of « lego » board is a big issue, not reliable, no electrostatic standards, ETH is not reliable, so many drawbacks. Sometimes you start it and nothing.

StefanR71 commented 3 weeks ago

I don't know i have written my onwn monitoring and i was using this to query a Modbus device: https://github.com/favalex/modbus-cli

Here i have created a register file:

reg_pumpe i@29:einaus
reg_verdichter i@30:einaus
reg_durchfluss i@48
reg_dreiwege i@36:dreiwege
reg_hk_mode_ist i@37:betrieb
reg_aussentemperatur i@43
reg_warmwasser i@51:status
reg_raumheizung i@52:status
reg_vorlauf_phe i@39
reg_vorlauf_buh i@40
reg_rucklauf i@41
reg_ist_warmwasser i@42
reg_kaeltemittel i@44
reg_soll_heizen h@0
reg_soll_kuehlen h@1
reg_hk_mode h@2:betrieb
reg_hk_status h@3:einaus
reg_soll_warmwasser h@9
reg_ww_status h@11:einaus

:einaus
  0=aus
  1=ein

:dreiwege
  0=raumheizung
  1=brauchwasser

:betrieb
  0=auto
  1=heizen
  2=kuehlen

:status
  0=untaetig
  1=betrieb

And then i query:

modbus -s 1 -r /haus/heizung/register 192.168.77.82:502 reg*

And get all the values in one batch:

reg_soll_heizen: 42 0x2a reg_soll_kuehlen: 18 0x12 reg_hk_mode: 1 0x1 heizen reg_hk_status: 1 0x1 ein reg_soll_warmwasser: 50 0x32 reg_ww_status: 1 0x1 ein reg_pumpe: 1 0x1 ein reg_verdichter: 1 0x1 ein reg_abtauen: 0 0x0 aus reg_dreiwege: 1 0x1 brauchwasser reg_hk_mode_ist: 1 0x1 heizen reg_vorlauf_phe: 4670 0x123e reg_vorlauf_buh: 4660 0x1234 reg_rucklauf: 4180 0x1054 reg_ist_warmwasser: 4480 0x1180 reg_aussentemperatur: 440 0x1b8 reg_kaeltemittel: 3800 0xed8 reg_durchfluss: 2820 0xb04 reg_warmwasser: 1 0x1 betrieb reg_raumheizung: 1 0x1 betrieb

When i'm doing the same with the USR IOT or Waveshare gateway i'm getting only:

reg_soll_heizen: 42 0x2a reg_soll_kuehlen: 18 0x12 reg_hk_mode: 1 0x1 heizen. reg_hk_status: 1 0x1 ein TimeoutError: timed out

I'm using here for my programs a ESP32 WROOM board, this is running very stable, i have no problems with that device. But how stable a device is, is also depending on the librarys you are using. Some have memory leaks, then it is worth to search for other version and test again...

And i think such devices as USR IOT or Waveshare are using Chips like a ESP32 too... So it depends only on the program and librarys you are using if a device is stable or not.

budulinek commented 3 weeks ago

@StefanR71 Arduino ethernet is just crap, not industrial and not stable. Going with this, industrial and works perfectly ! https://www.pusr.com/products/din-rail-rs485-serial-to-ethernet-converter-usr-dr302.html

The Wiznet W5x00 chips are good chips. The Ethernet.h library has some minor flaws, but otherwise works well. I have several Arduino + W5x00 solutions running for years without problems. In my opinion, the problem is a poor design of some Arduino ethernet shield. I am not a HW guy, but I think the issue is linked to how RST pin of the W5x00 chip is triggered:

Most W5x00 shields have the W5x00's RST pin hard wired to Arduino's RST. Usually it works well, but sometimes the W5x00 is not reset correctly during (re)start (I blame poor shield design, missing capacitor on the RST pin). As a result, the reset signal (pull down on the RST pin) may come too early, or it is too short to trigger reset of the W5x00 chip.

Best W5x00 shields have the W5x00's RST pin hard wired to a dedicated pin (rather than Arduino's RST). I have Nano W5500 shield (unfortunately no longer in production) which has RST on pin 7. This is excellent solution because then I can reset the W5x00 programatically. Once Arduino starts, I pull down pin 7 for a while to reset W5x00 and then I continue calling the Ethernet library. ETH_RESET_PIN can be configured in advanced_settings.h. Check your ethernet shield, maybe you also have RST on a dedicated pin.

If you still want to give Arduino the chance, you may try a "bypass" solution: