mypyllant-component icon indicating copy to clipboard operation
mypyllant-component copied to clipboard

service: mypyllant.report : AttributeError: module 'custom_components.mypyllant.datetime' has no attribute 'now'

Open heinemannj opened this issue 1 year ago • 4 comments
trafficstars

Before submitting a new issue

Problem description

service: mypyllant.report data: year: 2023

image

image

image

Logs

Logger: homeassistant.helpers.script.websocket_api_script
Source: helpers/script.py:527
First occurred: 12:56:50 (1 occurrences)
Last logged: 12:56:50

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: module 'custom_components.mypyllant.datetime' has no attribute 'now'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 527, 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(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 2731, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2774, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mypyllant/__init__.py", line 167, in handle_report
    year=int(call.data.get("year", datetime.now().year)),
                                   ^^^^^^^^^^^^
AttributeError: module 'custom_components.mypyllant.datetime' has no attribute 'now'

heinemannj avatar Jul 30 '24 11:07 heinemannj

Hi, my first comment on GitHub, so please be patient and give me some credit... I had exactly the same issue. It could be resolved by editing:

'handle_report'-function in file custom_components/mypyllant/init.py:

change line 166 of the current version v0.9.1 from: year=int(call.data.get("year", datetime.now().year)) to:
year=int(call.data.get("year", dt.now().year))

After the change mypyllant.report and mypyllant.export scripts provide the requested data. I'm not really a programmer so hopefully the code-owner can change this in a future release. Thanks a lot for this great HA-component.

spooky124 avatar Nov 26 '24 17:11 spooky124

I don't want to create a new thread. I keep getting these 2 errors in my logs:

Could not get energy management data Could not get rooms data

I have a Protherm RAY 9KE electric boiler.

Logger: myPyllant.api Zdroj: /usr/local/lib/python3.13/site-packages/myPyllant/api.py:1328 Prvýkrát sa vyskytol: 15:19:30 (46 výskytov) Naposledy prihlásený: 16:05:10

Could not get energy management data Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/myPyllant/api.py", line 1323, in get_energy_management response = await self.aiohttp_session.get( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... ) ^ File "/usr/local/lib/python3.13/site-packages/myPyllant/http_client.py", line 30, in _request return await super()._request(method, url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/client.py", line 832, in _request await raise_for_status(resp) File "/usr/local/lib/python3.13/site-packages/myPyllant/http_client.py", line 83, in on_raise_for_status response.raise_for_status() ~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/client_reqrep.py", line 1161, in raise_for_status raise ClientResponseError( ...<5 lines>... ) aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url='https://api.vaillant-group.com/service-connected-control/end-user-app-api/v1/eebus/energy-management/e903d434-a9c7-4ea0-8200-d825b723b547'

Logger: myPyllant.api Zdroj: /usr/local/lib/python3.13/site-packages/myPyllant/api.py:1405 Prvýkrát sa vyskytol: 15:19:30 (46 výskytov) Naposledy prihlásený: 16:05:10

Could not get rooms data Traceback (most recent call last): File "/usr/local/lib/python3.13/site-packages/myPyllant/api.py", line 1400, in get_ambisense_rooms response = await self.aiohttp_session.get( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... ) ^ File "/usr/local/lib/python3.13/site-packages/myPyllant/http_client.py", line 30, in _request return await super()._request(method, url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/client.py", line 832, in _request await raise_for_status(resp) File "/usr/local/lib/python3.13/site-packages/myPyllant/http_client.py", line 83, in on_raise_for_status response.raise_for_status() ~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/local/lib/python3.13/site-packages/aiohttp/client_reqrep.py", line 1161, in raise_for_status raise ClientResponseError( ...<5 lines>... ) aiohttp.client_exceptions.ClientResponseError: 409, message='Conflict', url='https://api.vaillant-group.com/service-connected-control/end-user-app-api/v1/api/v1/ambisense/facilities/e903d434-a9c7-4ea0-8200-d825b723b547/rooms'

purplesticks avatar Mar 14 '25 15:03 purplesticks

@heinemannj is this still an issue?

boelle avatar May 13 '25 08:05 boelle

@signalkraft think we can close this one as @heinemannj does not have an issue anymore

boelle avatar Oct 26 '25 08:10 boelle