elupus / hass_nibe

Home Assistant Nibe Uplink Integration
183 stars 54 forks source link

Error when turning on Holiday-mode #145

Open pthelin opened 1 year ago

pthelin commented 1 year ago

Failed to call service switch/turn_off. FORMAT_ERROR: Input format error. {'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-03T06:36:13.7202729Z', 'details': ['Error 14: 48043'], 'data': None}

frli4797 commented 1 year ago

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/nibe/switch.py:75 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 20:07:03 (1 occurrences) Last logged: 20:07:03

[547660718976] FORMAT_ERROR: Input format error. {'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-09T18:07:03.8070734Z', 'details': ['Error 14: 48043'], 'data': None}
aiohttp.client_exceptions.ClientResponseError: 400, message="{'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-09T18:07:03.8070734Z', 'details': ['Error 14:  48043'], 'data': None}", url=URL('https://api.nibeuplink.com/api/v1/systems/46893/parameters')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
    await result
  File "/config/custom_components/nibe/switch.py", line 75, in async_turn_on
    await self._uplink.put_parameter(self._system_id, self._parameter_id, "1")
  File "/usr/local/lib/python3.10/site-packages/nibeuplink/uplink.py", line 176, in put_parameter
    result = await self.put(
  File "/usr/local/lib/python3.10/site-packages/nibeuplink/uplink.py", line 87, in put
    return await self.session.request(
  File "/usr/local/lib/python3.10/site-packages/nibeuplink/session.py", line 186, in request
    await raise_for_status(response)
  File "/usr/local/lib/python3.10/site-packages/nibeuplink/session.py", line 26, in raise_for_status
    raise UplinkResponseException(data.get("errorCode"), data) from e
nibeuplink.exceptions.UplinkResponseException: FORMAT_ERROR: Input format error.
{'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-09T18:07:03.8070734Z', 'details': ['Error 14:  48043'], 'data': None}
pthelin commented 1 year ago

The holiday mode needs a start and end date, i guess thats whats missing (it can't only be a switch if you dont use todays date and a end date that is really far in the future).

The smart home-mode needs to be turned off to make the vacation mode work.

elupus commented 1 year ago

Maybe. Could also simple be a string "1" vs number 1.

elupus commented 1 year ago

You can try by changing this line: https://github.com/elupus/hass_nibe/blob/8a133a2f72e59c84447e2a4da229cb11abe74234/switch.py#L74

You need to restart HA after editing file.

pthelin commented 1 year ago

I tried changing from "1" to 1 and "0" to 0 but still get this error after reboot "Misslyckades med att anropa tjänsten switch/turn_off. FORMAT_ERROR: Input format error. {'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-09T19:57:21.4094107Z', 'details': ['Error 14: 48043'], 'data': None}"

[140051611584640] FORMAT_ERROR: Input format error. {'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-09T19:52:20.3141772Z', 'details': ['Error 14: 48043'], 'data': None}
[140050457377808] FORMAT_ERROR: Input format error. {'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-09T19:57:21.4094107Z', 'details': ['Error 14: 48043'], 'data': None}

aiohttp.client_exceptions.ClientResponseError: 400, message="{'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-09T19:52:20.3141772Z', 'details': ['Error 14: 48043'], 'data': None}", url=URL('https://api.nibeuplink.com/api/v1/systems/98379/parameters')

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call await result File "/config/custom_components/nibe/switch.py", line 79, in async_turn_off await self._uplink.put_parameter(self._system_id, self._parameter_id, 0) File "/usr/local/lib/python3.10/site-packages/nibeuplink/uplink.py", line 176, in put_parameter result = await self.put( File "/usr/local/lib/python3.10/site-packages/nibeuplink/uplink.py", line 87, in put return await self.session.request( File "/usr/local/lib/python3.10/site-packages/nibeuplink/session.py", line 186, in request await raise_for_status(response) File "/usr/local/lib/python3.10/site-packages/nibeuplink/session.py", line 26, in raise_for_status raise UplinkResponseException(data.get("errorCode"), data) from e nibeuplink.exceptions.UplinkResponseException: FORMAT_ERROR: Input format error. {'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-09T19:52:20.3141772Z', 'details': ['Error 14: 48043'], 'data': None}

elupus commented 1 year ago

Can you try "active", "inactive"

pthelin commented 1 year ago

Misslyckades med att anropa tjänsten switch/turn_on. FORMAT_ERROR: Input format error. {'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-09T22:10:12.2492155Z', 'details': ['Error 14: 48043'], 'data': None}

aiohttp.client_exceptions.ClientResponseError: 400, message="{'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-09T22:09:55.4202289Z', 'details': ['Error 14: 48043'], 'data': None}", url=URL('https://api.nibeuplink.com/api/v1/systems/98379/parameters')

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call await result File "/config/custom_components/nibe/switch.py", line 75, in async_turn_on await self._uplink.put_parameter(self._system_id, self._parameter_id, "active") File "/usr/local/lib/python3.10/site-packages/nibeuplink/uplink.py", line 176, in put_parameter result = await self.put( File "/usr/local/lib/python3.10/site-packages/nibeuplink/uplink.py", line 87, in put return await self.session.request( File "/usr/local/lib/python3.10/site-packages/nibeuplink/session.py", line 186, in request await raise_for_status(response) File "/usr/local/lib/python3.10/site-packages/nibeuplink/session.py", line 26, in raise_for_status raise UplinkResponseException(data.get("errorCode"), data) from e nibeuplink.exceptions.UplinkResponseException: FORMAT_ERROR: Input format error. {'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-09T22:09:55.4202289Z', 'details': ['Error 14: 48043'], 'data': None}

elupus commented 1 year ago

Did you test inactive? (Just to see if the service will accept that)

pthelin commented 1 year ago

Yes, I did.

aiohttp.client_exceptions.ClientResponseError: 400, message="{'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-09T22:49:11.9736972Z', 'details': ['Error 14: 48043'], 'data': None}", url=URL('https://api.nibeuplink.com/api/v1/systems/98379/parameters')

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/core.py", line 1756, in catch_exceptions await coro_or_task File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call await result File "/config/custom_components/nibe/switch.py", line 79, in async_turn_off await self._uplink.put_parameter(self._system_id, self._parameter_id, "inactive") File "/usr/local/lib/python3.10/site-packages/nibeuplink/uplink.py", line 176, in put_parameter result = await self.put( File "/usr/local/lib/python3.10/site-packages/nibeuplink/uplink.py", line 87, in put return await self.session.request( File "/usr/local/lib/python3.10/site-packages/nibeuplink/session.py", line 186, in request await raise_for_status(response) File "/usr/local/lib/python3.10/site-packages/nibeuplink/session.py", line 26, in raise_for_status raise UplinkResponseException(data.get("errorCode"), data) from e nibeuplink.exceptions.UplinkResponseException: FORMAT_ERROR: Input format error. {'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-09T22:49:11.9736972Z', 'details': ['Error 14: 48043'], 'data': None}

elupus commented 1 year ago

Strange. Then i don't really know.

frli4797 commented 1 year ago

Hmm. I don't really get the difference between parameterId=48043 holiday and SmartHome mode ({{baseurl}}/v1/systems/{{systemId}}/smarthome/mode/) VACATION. Me and Mr Postman spending a couple of hours together had me testing combinations of these two. Holiday mode seems to be alway on, regardless of what I set SmartHome mode to. I'm grateful for any clarification on the matter.

Also, it'd be cool to be able to pull (GET) the SmartHome mode from my F370 using this integration. Right now I can only PUT it.

pthelin commented 1 year ago

It seems as you can only activate the vacation mode but not actually start it. But you could build a function that simulates the vacation-mode, turns off water-heating, lowering the fan and setting a lower heat curve.

pthelin commented 1 year ago

I think parameter 48043 can be 0=inactive, 10=active. You also have parameter 41265 that can have values 0=Default,1=Away from home,2=Vacation. Still I don't think it actually starts it.

elupus commented 1 year ago

Most parameters cant be set thou. Its limited by the API.

elupus commented 1 year ago

Aaah, so we should be sending 10, for active.

pthelin commented 1 year ago

I have tried with both "10", "0" and 10, 0 but I still get the same type of error.

aiohttp.client_exceptions.ClientResponseError: 400, message="{'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-10T20:59:32.3417109Z', 'details': ['Error 14:  48043'], 'data': None}", url=URL('https://api.nibeuplink.com/api/v1/systems/98379/parameters')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
    await result
  File "/config/custom_components/nibe/switch.py", line 75, in async_turn_on
    await self._uplink.put_parameter(self._system_id, self._parameter_id, "10")
  File "/usr/local/lib/python3.10/site-packages/nibeuplink/uplink.py", line 176, in put_parameter
    result = await self.put(
  File "/usr/local/lib/python3.10/site-packages/nibeuplink/uplink.py", line 87, in put
    return await self.session.request(
  File "/usr/local/lib/python3.10/site-packages/nibeuplink/session.py", line 186, in request
    await raise_for_status(response)
  File "/usr/local/lib/python3.10/site-packages/nibeuplink/session.py", line 26, in raise_for_status
    raise UplinkResponseException(data.get("errorCode"), data) from e
nibeuplink.exceptions.UplinkResponseException: FORMAT_ERROR: Input format error.
{'httpStatusCode': 400, 'errorCode': 1, 'timestamp': '2022-09-10T20:59:32.3417109Z', 'details': ['Error 14:  48043'], 'data': None}
NickSutton commented 1 year ago

Hmm, I wondered why nothing seemed to change with my ASHP when I spent 3 weeks travelling after telling HA I was on holiday!