core: Error when changing climate offset with Nibe integration since 2024.12
The problem
I have the following automation:
alias: Adjust Heating Offset at 6 AM and 7 AM Based on Temperature
triggers:
- at: "06:00:00"
trigger: time
actions:
- action: number.set_value
data:
value: "0"
target:
entity_id: number.heating_offset_climate_system_1_40031_2
- delay: "01:00:00"
- condition: numeric_state
entity_id: sensor.room_average_temp_clim_system_1_bt50_30117
below: 21.5
- target:
entity_id: number.heating_offset_climate_system_1_40031_2
data:
value: "1"
action: number.set_value
mode: single
This worked fine, but since the most recent upgrade of HA, I’m now getting this error:
Error: Unable to avoid copy while creating an array as requested. If using `np.array(obj, copy=False)` replace it with `np.asarray(obj)` to allow a copy when needed (no behavior change in NumPy 1.x). For more details, see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword.
Result:
params:
domain: number
service: set_value
service_data:
value: '0'
entity_id:
- number.heating_offset_climate_system_1_40031_2
target:
entity_id:
- number.heating_offset_climate_system_1_40031_2
running_script: false
I tried recreating the failing step, but not giving me any improvements. When trying the same script with the MyUplink integration it works fine, but I’d rather not rely on a cloud service to perform this action. Any idea what might be going wrong here? This worked fine until I upgraded to 2024.12
What version of Home Assistant Core has the issue?
2024.12
What was the last working version of Home Assistant Core?
2024.11
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
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Logger: homeassistant.helpers.script.websocket_api_script
Source: helpers/script.py:526
First occurred: 8:54:48 AM (2 occurrences)
Last logged: 8:55:12 AM
websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Unable to avoid copy while creating an array as requested. If using `np.array(obj, copy=False)` replace it with `np.asarray(obj)` to allow a copy when needed (no behavior change in NumPy 1.x). For more details, see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<9 lines>...
)
^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 727, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
hass, entity, func, data, call.context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 122, in async_set_value
await entity.async_set_native_value(native_value)
File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/number.py", line 77, in async_set_native_value
await self._async_write_coil(value)
File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/entity.py", line 44, in _async_write_coil
await self.coordinator.async_write_coil(self._coil, value)
File "/usr/src/homeassistant/homeassistant/components/nibe_heatpump/coordinator.py", line 132, in async_write_coil
await self.connection.write_coil(data)
File "/usr/local/lib/python3.13/site-packages/tenacity/asyncio/__init__.py", line 189, in async_wrapped
return await copy(fn, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/tenacity/asyncio/__init__.py", line 111, in __call__
do = await self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/tenacity/_utils.py", line 99, in inner
return call(*args, **kwargs)
File "/usr/local/lib/python3.13/site-packages/tenacity/__init__.py", line 398, in <lambda>
self._add_action_func(lambda rs: rs.outcome.result())
~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/local/lib/python3.13/site-packages/tenacity/asyncio/__init__.py", line 114, in __call__
result = await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/nibe/connection/modbus.py", line 142, in write_coil
result = await self._client.write_registers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<3 lines>...
)
^
File "/usr/local/lib/python3.13/site-packages/async_modbus/core.py", line 233, in write_registers
request = self.protocol.write_multiple_registers(
slave_id, starting_address, values
)
File "/usr/local/lib/python3.13/site-packages/umodbus/client/tcp.py", line 223, in write_multiple_registers
return _create_request_adu(slave_id, function.request_pdu)
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/async_modbus/umodbus_numpy.py", line 130, in request_pdu_registers
return pack_16bits(self.function_code, self.starting_address, self._values)
File "/usr/local/lib/python3.13/site-packages/async_modbus/umodbus_numpy.py", line 46, in pack_16bits
values = numpy.array(values, dtype=dtype, copy=False)
ValueError: Unable to avoid copy while creating an array as requested.
If using `np.array(obj, copy=False)` replace it with `np.asarray(obj)` to allow a copy when needed (no behavior change in NumPy 1.x).
For more details, see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword.
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 14
- Comments: 26 (8 by maintainers)
I’ve asked the dev from async_modbus to release, and he released 0.2.2 which contains the fix. So that’s the first step.
Its a upstream incompatibility in async_modbus. So needs to be solved there. I should think its an easy fix, but unsure how quickly it can be released even if somebody would provide a fix.
Ive reported the issue upstream. But if someone has the time to look at a fix, that would speed it along
I’ve pushed a PR to upgrade the dependency: https://github.com/home-assistant/core/pull/133125
Now we just need a new release of asymc_modbus, bump the dependency in nibe library and then bump dependency in HA
No, it is not yet fixed. A couple of minutes ago the nibe package was also released. The next step is for elupus to update that dependency and that should be merged into HA. I think 2024.12.3 will contain the fix.
The same problem with every Nibe Integration switch