home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.74k stars 30.85k forks source link

Nibe Heatpump connection with NibeGW devices crashes #85246

Closed frank8the9tank closed 1 year ago

frank8the9tank commented 1 year ago

The problem

Hi have the strangest problem with my connection to my nibe heatpump using the integration and the NibeGW modbus gateway.

My setup is as following: Unifi controller with different switches and access points. Nibe VVM500 heatpump Prodino with NibeGW software HA with the nibe integration.

All is working fine until:

When i switch off my unifi controller my heatpump goes with a couple seconds in a error mode. The modbus gateway is not respondigs, i get error 251 on my heatpump. When i look at the prodino (with the NibeGW software) leds it looks like the devices with rebooting every couple of seconds. When i restart my unifi controller and reset the error on the heatpump the error goes away. I have tried many things over weeks time, but i can boil it now down to the unifi controller beeing off.

but WHY??? i cant think of any thing why this whould be.

What version of Home Assistant Core has the issue?

2023.1.0

What was the last working version of Home Assistant Core?

when the integration was introduced

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Nibe Heat Pump

Link to integration documentation on our website

https://www.home-assistant.io/integrations/nibe_heatpump/

Diagnostics information

I have opend a telnet connection to the nibe gateway and i get this:

data out: 5C002B9000BB data out: 5C002BA0026400ED data out: 5C002B550200007C data out: 5C00206A06ECB80A00000012 data out: 5C002B9000BB data out: 5C0020EE00CE data out: 5C0020EE00CE data out: 5C002BA0026400ED data out: 5C002B550200007C data in: C06902EFB8FC data out: 5C0019600079 data out: 5C002B9000BB data out: 5C002BA0026400ED data out: 5C002B550200007C data out: 5C00206A06EFB83C00000027 data in: C0690205B917 data out: 5C00206850FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF000018 data out: 5C002B9000BB data out: 5C002BA0026400ED data out: 5C002B550200007C data out: 5C00206A0605B901000000F1 data in: C069020AB918 data out: 5C001962196500EF01A5000000CF0000000000000A19142C000100000900A0 data out: 5C002B9000BB data out: 5C002BA0026400ED data out: 5C002B55020092EE data out: 5C00206A060AB900000100FE data in: C069020BB919 data out: 5C002B9000BB data out: 5C002BA0026400ED data out: 5C002B550200007C data out: 5C00206A060BB901000000FF data in: C069020CB91E data out: 5C0019600079 data out: 5C002B9000BB data out: 5C002BA0026400ED data out: 5C002B550200007C data out: 5C00206A060CB900000000F9 data in: 0206007F02000AF492BFA3BE11C0A80427010006F492BFA3BE110A000400008DBA0B000D5377697463682D4C6976696E670C000655534D494E49030009312E382E362E363934160009312E382E362E36393415000655534D494E491700010018000100190001011A000101130006F492BFA3BE11120004000000391B0005312E372E33

And at this point i have a error on my heatpump

Looking at the data the only think of is that the "data in" string is way to long for the device to handle and chrashes.

The problem for my is way to big. my unifi controller is running in docker on synology, but i cannot reboot my synology without my heatpump going into error.

WHY, WHY WHY?????

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

using NibeGwW version 5.00 link: https://github.com/openhab/openhab-addons/tree/main/bundles/org.openhab.binding.nibeheatpump/contrib/NibeGW/Arduino/NibeGW

settings in arduino software:

// ######### BOARD SELECTION #######################

// Enable if you use ProDiNo NetBoard V2.1 board //#define PRODINO_BOARD

// Enable if you use PRODINo ESP32 Ethernet v1 (Enable also HARDWARE_SERIAL_WITH_PINS in NibeGW.h)

define PRODINO_BOARD_ESP32

// Enable if ENC28J60 LAN module is used //#define TRANSPORT_ETH_ENC28J60

// ######### CONFIGURATION #######################

// Enable dynamic configuration mode via WiFi connection (supported only by the PRODINO_BOARD_ESP32 board) // Dynamic configuration mode is loaded if input 0 is ON during boot // When dynamic configuration mode is activated, login to the 'Bleeper' WiFi Access point: // 1. Configuration page is available on IP 192.168.4.1 port 80 (http://192.168.4.1). // 2. OTA update page is available on IP 192.168.4.1 port 8080 (http://192.168.4.1:8080/update). // Install following libraries via Arduino IDE library manager: // 1. Bleeper (tested with version 1.1.0) // 2. ElegantOTA (tested with version 2.2.9)

define ENABLE_DYNAMIC_CONFIG

// Enable debug printouts.

define ENABLE_DEBUG

define VERBOSE_LEVEL 1

define ENABLE_SERIAL_DEBUG

define ENABLE_REMOTE_DEBUG // Remote debug is available in telnet port 23

define BOARD_NAME "Arduino NibeGW"

// Ethernet configuration

define BOARD_MAC "DA:CD:BB:EB:FB:CE"

define BOARD_IP "192.168.4.53"

define DNS_SERVER "192.168.4.2"

define GATEWAY_IP "192.168.4.1"

define NETWORK_MASK "255.255.255.0"

// UDP ports for incoming messages

define INCOMING_PORT_READCMDS 10000

define INCOMING_PORT_WRITECMDS 10001

// Target IP address and port where Nibe UDP packets are send

define TARGET_IP "192.168.4.18"

define TARGET_PORT 9999

// Delay before initialize ethernet on startup in seconds

define ETH_INIT_DELAY 5

// Send acknowledge PDU's to Nibe

define SEND_ACK true

// Ack following periperial messages

define ACK_MODBUS40 true

define ACK_SMS40 false

define ACK_RMU40 false

// Used serial port and direction change pin for RS-485 port

if defined(PRODINO_BOARD)

define RS485_PORT Serial1

define RS485_DIRECTION_PIN 3

elif defined(PRODINO_BOARD_ESP32)

define WDT_TIMEOUT 2

define RS485_RX_PIN 4

define RS485_TX_PIN 16

define RS485_DIRECTION_PIN 2

else

define RS485_PORT Serial

define RS485_DIRECTION_PIN 2

endif

home-assistant[bot] commented 1 year ago

Hey there @elupus, mind taking a look at this issue as it has been labeled with an integration (nibe_heatpump) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `nibe_heatpump` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Change the title of the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign nibe_heatpump` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


nibe_heatpump documentation nibe_heatpump source (message by IssueLinks)

elupus commented 1 year ago

My guess the prodino arduino code does not handle loss of wifi and reconnection. I have not worked anything with that solution.

Ive only worked with the esphome adaption. So I suggest you either switch to some linux based gw or an esp based used my esphome addon.

frank8the9tank commented 1 year ago

The prodino (there is an esp32 in here) i have has an ethernet connection, so reconnection cannot be an issue i think. Then the unifi controller does not need to be online/running for my switch gear to work. but still this has influence on this. (and it only effects this, no other network device) And the code that i use is used by many people more, So idont know wear to look now to solve this.

@elupus Do you run the actual code that is on the HA website for esphome? No modifications? https://github.com/elupus/esphome-nibe

elupus commented 1 year ago

Yup i run that. Can likely be adapted for ethernet without to much trouble.

elupus commented 1 year ago

I have an idea. Something on your network. Likely the unify access points are broadcasting on the same udp port 9999 or 10000 that is the default address. As long as you are not running nibepi, you can change the defaults to something else. I run 10090, 10091, 10092 .

The esphome code likely works with original address too since it protects source ip address better. I do think it has pk protection for message size too.

frank8the9tank commented 1 year ago

That sound like valid points, Question is there a way to change the port on the HA side without removing the integration? I have renamed a lot of them, and removing and re-adding the integration with new port numbers will cause a lot of work.

atleast port 10001 udp is in use. https://help.ui.com/hc/en-us/articles/218506997-UniFi-Network-Required-Ports-Reference

elupus commented 1 year ago

There is no GUI method to change them. You have to edit .storage/config_entries.json file.

frank8the9tank commented 1 year ago

how do i get to that file?

elupus commented 1 year ago

Its in your config folder. Its not meant to be edited by user, so be careful.

frank8the9tank commented 1 year ago

we talk about this: image

elupus commented 1 year ago

Yup

frank8the9tank commented 1 year ago

changed it to listening_port: 10090 read: 100091 write: 10092

unifi controller is OFF, and no errors so far.

Berjastein commented 1 year ago

Im also having isue adding the integration, tried to change ports but that did not help. Any idea?

elupus commented 1 year ago

Im also having isue adding the integration, tried to change ports but that did not help. Any idea?

Not much to go on..... This issue is resolved though. It was s problem with the android gw

frank8the9tank commented 1 year ago

I have not seen the problem until now, so marking this as solved is okay. Should we change the port numbers in the documentation on the HA integration page? Or at least tell that port 10000 UDP is also used in unifi, and could give problems.

elupus commented 1 year ago

I think that might be prudent yes.