Validation Error: Timeout on Writing to Nibe Heat Pump During Configuration
The problem
Bug Description for Nibe F1255 When attempting to configure the Nibe heat pump, a validation error occurs. The error happens during the connectivity check and results in a FieldError.
Steps to Reproduce
- Navigate to the configuration page of the Nibe heat pump in Home Assistant.
- Enter the necessary connection details.
- Start the connectivity check.
- The error occurs when attempting to perform a write operation to the heat pump.
Expected Behavior The configuration should be validated and saved successfully without triggering a WriteException.
Actual Behavior The validation fails, and a WriteException with the message "Heatpump denied writing alarm-reset-45171" is triggered, followed by a FieldError.
Additional Information Home Assistant Version: 2024.6.3 Nibe Integration Version: newest
I checked that general UDP packets arrive at Home Assistant via nc -tpl 19999 (I can see the name of the heat pump, so the communication from the ESP and the heat pump should be working?) and also checked that the port was bound when the setup started. It has already been tested that the UDP packets are received back on port 19999, and packets are indeed reported back at that port.
What version of Home Assistant Core has the issue?
2024.6.3
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
nibe_heatpump
Link to integration documentation on our website
https://www.home-assistant.io/integrations/nibe_heatpump
Diagnostics information
Example YAML snippet
esphome:
name: nibegw
comment: Nibegw
platform: ESP32
board: esp32dev
# General ESPHome setup
api:
reboot_timeout: 0s
ota:
platform: esphome
password: ******
logger:
wifi:
ssid: 24GhzHistoricHub
password: *********
fast_connect: true # Fast connect to connect to my hidden network
# It is recommended to disable powersave mode on wifi, to make sure the device does not miss UDP requests sent.
power_save_mode: none
# The device needs a static IP. Either do that here with the manual_ip node, or do it via another way (router)
# Load nibe component
external_components:
- source: github://elupus/esphome-nibe
# Set pins required for LilyGo T-CAN485 board
output:
- platform: gpio
id: ENABLE_PIN # Enable the chip
pin:
number: GPIO19
inverted: true
- platform: gpio
id: SE_PIN # Enable autodirection
pin:
number: GPIO17
inverted: true
- platform: gpio
id: ENABLE_5V_PIN # Enable 5V pin for RS485 chip
pin:
number: GPIO16
inverted: true
# Configure uart that will be used
uart:
rx_pin: GPIO21
tx_pin: GPIO22
baud_rate: 9600
# Configure NibeGW
nibegw:
udp:
# The target address(s) to send data to. May be a multicast address.
# When using Home Assistant: this is your Home Assistant IP.
target:
- ip: 192.168.1.182
port: 19999 #The Nibe Home Assistant integration listens to 9999 by default
# List of source address to accept data from, may be empty for no filter
#source:
# - 192.168.1.182
# Optional port this device will listen to to receive read requests. Defaults to 9999
#read_port: 9999
# Optional port this device will listen to to receive write request. Defaults to 10000
#write_port: 10000
acknowledge:
- MODBUS40
# Constant replies to certain requests cabe made
constants:
- address: MODBUS40
token: ACCESSORY
data: [
0x0A, # MODBUS version low
0x00, # MODBUS version high
0x01, # MODBUS address?
]
# Some helper functions to restart ESPHome from HA
button:
- platform: restart
name: Nibegw Restart
- platform: safe_mode
name: Nibegw Safe Mode Boot
Anything in the logs that might be useful for us?
2024-06-20 14:38:58.623 ERROR (MainThread) [homeassistant.components.nibe_heatpump] Validation error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/config_flow.py", line 111, in validate_nibegw_input
await connection.verify_connectivity()
File "/usr/local/lib/python3.12/site-packages/nibe/connection/nibegw.py", line 468, in verify_connectivity
await verify_connectivity_read_write_alarm(self, self._heatpump)
File "/usr/local/lib/python3.12/site-packages/nibe/connection/__init__.py", line 96, in verify_connectivity_read_write_alarm
await connection.write_coil(coil_data)
File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 142, in async_wrapped
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 58, in __call__
do = await self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 110, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 78, in inner
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 390, in
self._add_action_func(lambda rs: rs.outcome.result())
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/local/lib/python3.12/site-packages/tenacity/_asyncio.py", line 61, in __call__
result = await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/nibe/connection/nibegw.py", line 369, in write_coil
raise WriteException(f"Heatpump denied writing {coil.name}")
nibe.exceptions.WriteException: Heatpump denied writing alarm-reset-45171
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/config_flow.py", line 218, in async_step_nibegw
title, data = await validate_nibegw_input(self.hass, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/config_flow.py", line 119, in validate_nibegw_input
raise FieldError("Timeout on writing to pump", "base", "write") from exception
homeassistant.components.nibe_heatpump.config_flow.FieldError: Timeout on writing to pump
Additional information
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 closeCloses the issue. -
@home-assistant rename Awesome new titleRenames the issue. -
@home-assistant reopenReopen the issue. -
@home-assistant unassign nibe_heatpumpRemoves the current integration label and assignees on the issue, add the integration domain after the command. -
@home-assistant add-label needs-more-informationAdd a label (needs-more-information, problem in dependency, problem in custom component) to the issue. -
@home-assistant remove-label needs-more-informationRemove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.
(message by CodeOwnersMention)
nibe_heatpump documentation nibe_heatpump source (message by IssueLinks)
Are you using the lilygo t-can485 board? Which revision of it? Do you have any firewalls or routers between the devices? The data might looks corrct, more used to it in hex.
Actually. The pump looks to actually be responding to the request. It rejecting it. That might actually be a valid response. Either that or we have the wrong parameter number for that pump.
Which exact model heat pump is it?
Are you using the LilyGO T-CAN485 board? Which revision of it? Yes, but I would need to disassemble it again to find out the revision. Where can I find the revision information?
Do you have any firewalls or routers between the devices? Yes, it's a Unifi network, but the UDP packets from the last screenshot were from the terminal inside Home Assistant. So, I guess at least on the way back from the heat pump, everything seems to be normal.
Which exact model heat pump is it? It's a Nibe F1255-6 E EM with an FLM ventilation system. Could the FLM be causing the issue?
Or is it because i updated on the 04.06.2024 to the new software Version: 9699R4 from the Heatpump?
Ok. Lets try something weird.. :). Go into the extra settings on the pump and enable the RMU40 accessory. This should cause your pump to go into alarm. Dont clear it, but try to add the system in HA while the pump is showing an alarm on screen.
This might work, if the pump is rejecting the write request to clear alarms when there are none. Worth a shot.
The you can disable the RMU40 accessory again and clear any alarms.
As I was writing this, I reset the Nibe back to software version 9443R7. Guess what, that fixed it! However, Nibe wanted me to upgrade because of the change from Nibe Uplink to MyUplink. I thought they wouldn't touch the Modbus, but reverting the software made it pass on the first try. I've now been working on it for 2 days 😄
Do you know if Nibe changed something with the modbus with the shift to MyUplink? I didn't read anything in the changelog.
---old text--- Sadly, that didn't help. I activated the first RMU in the menu and tried multiple times to activate it via HA. Unfortunately, the error message in the log remained the same.
Oh! So they changed some behavior there. I was afraid they might.
Crap i need to take the time and update my pump and see what others stuff they might have broken.
Upgraded my F1255 to 9699R4 (and now also to 9699R5) and running into the same issue as described by @Puma7 .
Fetching data via modbus still works, however setting data seems to be rejected (resetting alarm or setting temperatures for example).
logging shows: nibe.exceptions.WriteException: Heatpump denied writing alarm-reset-45171
@elupus if there is any way in helping you in terms of providing data or debugging: please let me know!
It is fully possible that they have blocked the ability to set data. I will change the config flow check so it allow adding. But no idea what they allow setting now.
It is fully possible that they have blocked the ability to set data. I will change the config flow check so it allow adding. But no idea what they allow setting now.
If they changed the workflow, they also need to update the original Modbus accessory, right? Or do they automatically update the Modbus device with the heat pump update?
Have been playing a bit more on firmware 9699R5 and i now observe that it is actually setting data:
- change in HA is also visible in the changelog on the F1255 itself (in the service menu, hold the back button on the device for 7 seconds to be able to access that)
- you can see the change in the myUplink app
- i was able to reset an alarm with HA
but you will still get an error message Failed to call service climate/set_temperature. Heatpump denied writing room-sensor-cool-setpoint-s1-48785
stacktrace: 20240704_stacktrace_nibe_denied_writing.txt
I ran into the same (or similar) issue. Can I just add that here or should I open a new issue? Nibe F1155, FW 9699R5. I have just installed the lilygo board and I am trying to install the nibegw integration. But can't actually finish the install due to the mentioned write error.
When I force an incorrect port number for the Read port, I get a different error. So I assume cabling and hardware is ok.
Not had time to look at it. We need to differentiate the write error in the lib and accept a write error during config flow.
I am experiencing the same issue. Not sure if this helps resolving the issue or not: I had the integration configured and working with modbus rtu, that i had in my /dev/ttyUSB0. I then tried to move this to a clean install of home assistant and it failed to install with same parameters. While trying to figure out the reason, I uninstalled it from the original home assistant installation and tried to re-install it there with same parameters, but same issue. After restoring it from the backup it was working again. So the hardware and settings work, but installing the integration after upgrading to myuplink doesn't. I have warnings after writing variables, but those I have had also before. The writes seem to go through though. So something has definitely changed in the upgrade of nibe and that is not necessarile related to writing variables, but maybe some changes in responses, that are not handled right while installation of the integration?
It should not be an issue anymore with latest release of HA
It should not be an issue anymore with latest release of HA
Then it must be something else, since the version I am using is: Core 2024.8.3 Supervisor 2024.08.0 Operating System 13.1 Frontend 20240809.0 As far as I know, that is the latest release(?)
Anyway, I am unable to add the integration to a clean install of homeassistant using same hardware and parameters, than in the old and working installation.
Can you check the log for errors?
very little information there: 2024-09-04 20:27:31.357 INFO (SyncWorker_46) [homeassistant.loader] Loaded nibe_heatpump from homeassistant.components.nibe_heatpump 2024-09-04 20:27:39.047 DEBUG (MainThread) [nibe.nibe.connection.modbus] Sending read request 2024-09-04 20:27:40.908 INFO (MainThread) [nibe.nibe.connection.modbus] Coil alarm-reset-45171, value: 0 2024-09-04 20:27:40.908 DEBUG (MainThread) [nibe.nibe.connection.modbus] Sending write request 2024-09-04 20:27:42.901 DEBUG (MainThread) [nibe.nibe.connection.modbus] Sending write request 2024-09-04 20:27:44.908 DEBUG (MainThread) [nibe.nibe.connection.modbus] Sending write request
and then the config dialog states:
Error on write request to pump. Verify your Remote write port or Remote address.
The parameters used were: "model": "F1155", "modbus_url": "serial:///dev/ttyUSB0", "modbus_unit": 0, "connection_type": "modbus"
btw, just upgraded to 2024.9.0 to see if it makes a difference
Hmm. So you have a real modbus40 device. I have never actually used that. Im not sure we looked at that case.
Tested writing with the old configuration and got a lot more in the logs:
2024-09-04 21:04:57.400 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139812234878480] Unexpected exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2763, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2806, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/switch.py", line 53, in async_turn_off
await self._async_write_coil("OFF")
File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/coordinator.py", line 224, in _async_write_coil
await self.coordinator.async_write_coil(self._coil, value)
File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/coordinator.py", line 137, in async_write_coil
await self.connection.write_coil(data)
File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/init.py", line 189, in async_wrapped
return await copy(fn, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/init.py", line 111, in call
do = await self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/init.py", line 153, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/_utils.py", line 99, in inner
return call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/init.py", line 398, in
However, the write is a success as verified with MyUpLink
That is even weirder. That is a failure in the communication between HA and the modbus40 device. Did the modbus40 device also get some updates?
I am experiencing similar difficulties as the others in this thread.
I am running an F1255-6 R EM, and since updating to the 9699R5 firmware I cannot reset the alarm using HA any more. Everything worked perfectly before the transition to MyUplink firmware. Now the integration is giving me “Heat pump denied writing alarm-reset-45171” at every attempt.
My HA Core version is 2024.8.2, and I am running the NibeGW firmware on a PRODINo MKR Zero Ethernet.
This is what I am getting in the logs:
2024-09-05 09:39:38.086 WARNING (MainThread) [nibe.nibe.connection.nibegw] Ignoring packet from ('192.168.0.253', 9999) due to parse error: 0c161f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004c616e6761746f6e20322e3400000000000000000000000000000000000000003235352e3235352e3235352e300000000000000000000000000000000000000052542d4158383855000000000000000000000000000000000000000000000000332e302e302e342e33383800000000000004d4c450e00002000000000000000000000000000000008280590000021f9200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009600a8c0000101bb000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000000000001060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004d4c450e00000000000000000000000000000000000000000000000000000000000000000000000: Error in path (parsing) -> start_byte
parsing expected 92 but parsed 12
2024-09-05 09:39:41.384 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139903239924048] Unexpected exception
Traceback (most recent call last):
File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/nibe/connection/nibegw.py", line 367, in write_coil
await asyncio.wait_for(self._futures["write"], timeout)
File "/usr/local/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
async with timeouts.timeout(timeout):
File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
raise TimeoutError from exc_val
TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2763, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2806, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/button/__init__.py", line 132, in _async_press_action
await self.async_press()
File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/button.py", line 55, in async_press
await self.coordinator.async_write_coil(self._reset_coil, 1)
File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/coordinator.py", line 137, in async_write_coil
await self.connection.write_coil(data)
File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 189, in async_wrapped
return await copy(fn, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 111, in __call__
do = await self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/_utils.py", line 99, in inner
return call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 418, in exc_check
raise retry_exc.reraise()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 185, in reraise
raise self.last_attempt.result()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 114, in __call__
result = await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/nibe/connection/nibegw.py", line 376, in write_coil
raise WriteTimeoutException(
nibe.exceptions.WriteTimeoutException: Timeout waiting for write feedback for alarm-reset-45171
Hi, did some testing with the home assistant modbus integration by adding an include in configuration.yaml to include the modbus.yaml as this:
- name: "nibe_modbus"
type: serial
method: rtu
port: /dev/ttyUSB0
baudrate: 9600
stopbits: 1
bytesize: 8
parity: N
sensors:
- name: "Pool Temperature"
unit_of_measurement: "°C"
address: 40042
input_type: holding
data_type: int16
scale: 0.1
precision: 1 scan_interval: 60 unique_id: "pool_1_temperature_sensor" device_class: "temperature" switches: - name: "Pool Heating Activation" address: 48094 write_type: holdings # NOTICE; 'holding' FAILS; MUST BE 'holdings' command_on: 1 command_off: 0 verify: input_type: holding scan_interval: 10 unique_id: "pool_1_heating_activation" device_class: "switch"
- name: "Pool Temperature"
unit_of_measurement: "°C"
address: 40042
input_type: holding
data_type: int16
scale: 0.1
First the write was failing, but once I changed the write_type from 'holding' to 'holdings' it started to work without any errors. I hope this helps sorting it out!
Same thing with F370 and new firmware: Heatpump denied writing alarm-reset-45171 Not sure if it was the firmware or some other updates in esp or homeassistant, but it seems like it's the nibe firmware when others here seems to have that issue after firmware update.
Resetting alarm does not work, but setting the heatcurve, water temperature mode and fan speed for example works.
Update: fan speed does not work either.
For me it was clearly the Nibe firmware update as I have not changed anything else that could be relevant.
I ran into this issue today as I was setting up nibegw on latest F750 firmware. I was able to by pass the issue by upgrading my home assistant to 2024.8.3 from 2024.6.3. After the setup was complete Alarm reset seems to be unavailable.
I'm having the same issue after updating the HeatPump and hope it will be somehow get fixed:
HA. Core 2024.9.1 Supervisor 2024.09.1 Operating System 13.1 Frontend 20240906.0
lilygo t-can485 board ESPHome 2024.8.3
F1155 - 6 - PC Firmware: 9699 (was forced to update because of switch from Nibe Uplink to MyUplink)
Reading works flawless, but writing stopped working. Even reseting an Alarm does noch work. "Heatpump denied writing alarm-reset-45171"
By the way: is it normal to receive an error from the heat pump everytime updating ESPhome? Just wondering. I switched from NibePi to ESPhome/NibeGW earlier and NipePi does not have this problem (actually not a real problem)
Thanks in advance for the effort to fix this.
Yes error from heatpump on esp update is expected. It will stop talking to the heatpump, causing it to error.
Most writes does seem to worl for me, but alarm reset still does not here either. The pump reject the command. Unsure why.