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
74.02k stars 31.05k forks source link

Init in ViCare integration fails due to missing device serial data point #125464

Open mgambier opened 2 months ago

mgambier commented 2 months ago

The problem

Hello, since upgrading to the latest version of both Home Assistant Core and Home Assistant OS the Vicare integration no longer works. I tried removing it and reinstalling it. It does install successfully but does not find any device after starting.

What version of Home Assistant Core has the issue?

2024-9.1

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

vicare

Link to integration documentation on our website

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

Diagnostics information

config_entry-vicare-01J75TK55DRSE049YV3NPJ6QFC.json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.number
Source: helpers/entity_platform.py:361
integration: Number (documentation, issues)
First occurred: 10:12:20 AM (4 occurrences)
Last logged: 10:46:14 AM

Error while setting up vicare platform for number
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/src/homeassistant/homeassistant/components/vicare/number.py", line 272, in async_setup_entry
    await hass.async_add_executor_job(
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/vicare/number.py", line 249, in _build_entities
    entities.extend(
  File "/usr/src/homeassistant/homeassistant/components/vicare/number.py", line 250, in <genexpr>
    ViCareNumber(
  File "/usr/src/homeassistant/homeassistant/components/vicare/number.py", line 292, in __init__
    super().__init__(description.key, device_config, device, component)
  File "/usr/src/homeassistant/homeassistant/components/vicare/entity.py", line 39, in __init__
    serial_number=device.getSerial(),
                  ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/PyViCare/PyViCareUtils.py", line 55, in feature_flag_wrapper
    return wrapper(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/PyViCare/PyViCareUtils.py", line 48, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/PyViCare/PyViCareDevice.py", line 17, in getSerial
    return self.service.getProperty("device.serial")["properties"]["value"]["value"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/PyViCare/PyViCareCachedService.py", line 26, in getProperty
    return readFeature(entities, property_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/PyViCare/PyViCareService.py", line 17, in readFeature
    raise PyViCareNotSupportedFeatureError(property_name)
PyViCare.PyViCareUtils.PyViCareNotSupportedFeatureError: device.serial

Additional information

In the logs getting errors while setting up the platform for various types as shown for the example abovve

home-assistant[bot] commented 2 months ago

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

Code owner commands Code owners of `vicare` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign vicare` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


vicare documentation vicare source (message by IssueLinks)

CFenner commented 2 months ago

@mgambier please share your diagnostics file.

@nyn3x is your error equal to this one? PyViCare.PyViCareUtils.PyViCareNotSupportedFeatureError: device.serial

mgambier commented 2 months ago

Hi thanks for the fast response attached is the diagnostic file.

And yes this is the error you list below which is being raised while setting up vicare platform for number, climate, water heater, sensor and binary_sensor

From: Christopher Fenner @.> Sent: Saturday, September 7, 2024 2:34 PM To: home-assistant/core @.> Cc: Michel Gambier @.>; Mention @.> Subject: Re: [home-assistant/core] Vicare integration no longer works after update to latest versions of Home Assistant and Home Assistant OS (Issue #125464)

@mgambierhttps://github.com/mgambier please share your diagnostics file.

@nyn3xhttps://github.com/nyn3x is your error equal to this one? PyViCare.PyViCareUtils.PyViCareNotSupportedFeatureError: device.serial

- Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/125464#issuecomment-2335173624, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AELI2LD3Y4WZ6WBZG4SLBVTZVLXDHAVCNFSM6AAAAABNZ7CVL6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZVGE3TGNRSGQ. You are receiving this because you were mentioned.Message ID: @.**@.>>

CFenner commented 2 months ago

@mgambier the file was not shared here in GitHub.

mgambier commented 2 months ago

Hum thought I included it initially in the issue report

https://github.com/user-attachments/files/16918051/config_entry-vicare-01J75TK55DRSE049YV3NPJ6QFC.json

From: Christopher Fenner @.> Sent: Saturday, September 7, 2024 4:16 PM To: home-assistant/core @.> Cc: Michel Gambier @.>; Mention @.> Subject: Re: [home-assistant/core] Vicare integration no longer works after update to latest versions of Home Assistant and Home Assistant OS (Issue #125464)

@mgambierhttps://github.com/mgambier the file was not shared here in GitHub.

- Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/125464#issuecomment-2335200557, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AELI2LF6PTPQZSDG2CD3CSDZVMDBXAVCNFSM6AAAAABNZ7CVL6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZVGIYDANJVG4. You are receiving this because you were mentioned.Message ID: @.**@.>>

nyn3x commented 2 months ago

@mgambier please share your diagnostics file.

@nyn3x is your error equal to this one? PyViCare.PyViCareUtils.PyViCareNotSupportedFeatureError: device.serial

@CFenner: yes, that's correct. When looking at the logs, that's the last line in the error PyViCare.PyViCareUtils.PyViCareNotSupportedFeatureError: device.serial.

CFenner commented 2 months ago

Can you please share the model that you have installed?

mgambier commented 2 months ago

Sure it's a Vitodens 333. Everything was working fine so far and I can still access the furnace with the ViCare app.

From: Christopher Fenner @.> Sent: Saturday, September 7, 2024 5:05 PM To: home-assistant/core @.> Cc: Michel Gambier @.>; Mention @.> Subject: Re: [home-assistant/core] Vicare integration no longer works after update to latest versions of Home Assistant and Home Assistant OS (Issue #125464)

Can you two please share the model that you have installed?

- Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/125464#issuecomment-2335378520, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AELI2LDRJH7OK6CRWL7MAF3ZVMIYFAVCNFSM6AAAAABNZ7CVL6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZVGM3TQNJSGA. You are receiving this because you were mentioned.Message ID: @.**@.>>

mgambier commented 2 months ago

And I am using a Viessmann Vitoconnect 100, Typ OPTO1 for the Wifi/Web connection

From: Michel Gambier Sent: Saturday, September 7, 2024 5:13 PM To: home-assistant/core @.***> Subject: RE: [home-assistant/core] Vicare integration no longer works after update to latest versions of Home Assistant and Home Assistant OS (Issue #125464)

Sure it's a Vitodens 333. Everything was working fine so far and I can still access the furnace with the ViCare app.

From: Christopher Fenner @.**@.>> Sent: Saturday, September 7, 2024 5:05 PM To: home-assistant/core @.**@.>> Cc: Michel Gambier @.**@.>>; Mention @.**@.>> Subject: Re: [home-assistant/core] Vicare integration no longer works after update to latest versions of Home Assistant and Home Assistant OS (Issue #125464)

Can you two please share the model that you have installed?

- Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/125464#issuecomment-2335378520, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AELI2LDRJH7OK6CRWL7MAF3ZVMIYFAVCNFSM6AAAAABNZ7CVL6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZVGM3TQNJSGA. You are receiving this because you were mentioned.Message ID: @.**@.>>

nyn3x commented 2 months ago

Can you please share the model that you have installed?

I have a Vitodens 200 WB2A with a Vitoconnect 100 OPTO1

rolandsteinmeyer commented 2 months ago

same error here with Vitodens 200 WB2A with a Vitoconnect 100 OPTO1 after update to from 2024.8.X core 2024.9.1. Viessmann App shows everything normal. ` Logger: homeassistant.components.climate Quelle: helpers/entity_platform.py:361 Integration: Klima (Dokumentation, Probleme) Erstmals aufgetreten: 09:39:52 (10 Vorkommnisse) Zuletzt protokolliert: 18:31:54

Error while setting up vicare platform for climate Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform await asyncio.shield(awaitable) File "/usr/src/homeassistant/homeassistant/components/vicare/climate.py", line 117, in async_setup_entry await hass.async_add_executor_job( File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/vicare/climate.py", line 89, in _build_entities ViCareClimate( File "/usr/src/homeassistant/homeassistant/components/vicare/climate.py", line 151, in init super().init(circuit.id, device_config, device) File "/usr/src/homeassistant/homeassistant/components/vicare/entity.py", line 39, in init serial_number=device.getSerial(), ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/PyViCare/PyViCareUtils.py", line 55, in feature_flag_wrapper return wrapper(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/PyViCare/PyViCareUtils.py", line 48, in wrapper return func(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/PyViCare/PyViCareDevice.py", line 17, in getSerial return self.service.getProperty("device.serial")["properties"]["value"]["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/PyViCare/PyViCareCachedService.py", line 26, in getProperty return readFeature(entities, property_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/PyViCare/PyViCareService.py", line 17, in readFeature raise PyViCareNotSupportedFeatureError(property_name) PyViCare.PyViCareUtils.PyViCareNotSupportedFeatureError: device.serial `

CFenner commented 2 months ago

I have an Opto1 myself with a Vitodens 300w connected. In the last update I added the device serial as an identifier to the HA device. This works in my case and for many other (E3) setups. I wonder what is different for your devices. In the API response the ‚device.serial‘ datapoint is missing completely, that is why you get the ‚feature not supported‘ issue.

Could you all please check is you have ‚remote updates‘ activated or not? I wonder if this is related to the gateway software version. The setting is a bit hidden in the vicare app: Einstellungen > Anlage > Allgemein > Software Updates

mgambier commented 2 months ago

Yes it is setup

Get Outlook for iOShttps://aka.ms/o0ukef


From: Christopher Fenner @.> Sent: Saturday, September 7, 2024 7:39:16 PM To: home-assistant/core @.> Cc: Michel Gambier @.>; Mention @.> Subject: Re: [home-assistant/core] Vicare integration no longer works after update to latest versions of Home Assistant and Home Assistant OS (Issue #125464)

I have an Opto1 myself with a Vitodens 300w connected. In the last update I added the device serial as an identifier to the HA device. This works in my case and for many other (E3) setups. I wonder what is different for your devices. In the API response the ‚device.serial‘ datapoint is missing completely, that is why you get the ‚feature not supported‘ issue.

Could you all please check is you have ‚remote updates‘ activated or not? I wonder if this is related to the gateway software version. The setting is a bit hidden in the vicare app: Einstellungen > Anlage > Allgemein > Software Updates

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/125464#issuecomment-2336190022, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AELI2LG42QPZKMU6BVRRKL3ZVM24JAVCNFSM6AAAAABNZ7CVL6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZWGE4TAMBSGI. You are receiving this because you were mentioned.Message ID: @.***>

mgambier commented 2 months ago

And note if this is useful that in the ViCare app under the boiler information area in settings it does not show a device nor a serial number.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Michel Gambier @.> Sent: Saturday, September 7, 2024 8:09:54 PM To: home-assistant/core @.> Subject: Re: [home-assistant/core] Vicare integration no longer works after update to latest versions of Home Assistant and Home Assistant OS (Issue #125464)

Yes it is setup

Get Outlook for iOShttps://aka.ms/o0ukef


From: Christopher Fenner @.> Sent: Saturday, September 7, 2024 7:39:16 PM To: home-assistant/core @.> Cc: Michel Gambier @.>; Mention @.> Subject: Re: [home-assistant/core] Vicare integration no longer works after update to latest versions of Home Assistant and Home Assistant OS (Issue #125464)

I have an Opto1 myself with a Vitodens 300w connected. In the last update I added the device serial as an identifier to the HA device. This works in my case and for many other (E3) setups. I wonder what is different for your devices. In the API response the ‚device.serial‘ datapoint is missing completely, that is why you get the ‚feature not supported‘ issue.

Could you all please check is you have ‚remote updates‘ activated or not? I wonder if this is related to the gateway software version. The setting is a bit hidden in the vicare app: Einstellungen > Anlage > Allgemein > Software Updates

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/125464#issuecomment-2336190022, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AELI2LG42QPZKMU6BVRRKL3ZVM24JAVCNFSM6AAAAABNZ7CVL6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZWGE4TAMBSGI. You are receiving this because you were mentioned.Message ID: @.***>

nyn3x commented 2 months ago

I have an Opto1 myself with a Vitodens 300w connected. In the last update I added the device serial as an identifier to the HA device. This works in my case and for many other (E3) setups. I wonder what is different for your devices. In the API response the ‚device.serial‘ datapoint is missing completely, that is why you get the ‚feature not supported‘ issue.

Could you all please check is you have ‚remote updates‘ activated or not? I wonder if this is related to the gateway software version. The setting is a bit hidden in the vicare app: Einstellungen > Anlage > Allgemein > Software Updates

Yes, it seems as if this is enabled. However, when I hit "save" in this dialog get an error "something went wrong, please try again".

I was wondering - there is also an announcement for some maintenence. Could that also be related?

nyn3x commented 2 months ago

And note if this is useful that in the ViCare app under the boiler information area in settings it does not show a device nor a serial number. Get Outlook for iOShttps://aka.ms/o0ukef

My device does show a model name as well as a serial number in the official vicare app.

CFenner commented 2 months ago

@nyn3x the data you posted in https://github.com/home-assistant/core/issues/125443#issuecomment-2335106852 definitely has no device.serial nor anything else with serial in it's name. Therefore I'm wondering where this comes from..

nyn3x commented 2 months ago

That's what I see in my vicare app

Screenshot_20240907_221522_ViCare

CFenner commented 2 months ago

Can you please check the API directly with an API call via curl.

First get a token via the developer dashboard with scope IoT.

Then get your installation with:

curl -X GET 'https://api.viessmann.com/iot/v2/equipment/installations?includeGateways=true' \
-H 'content-type: application/json' \
-H 'Authorization: Bearer <token>

This give you the installation id and gateway serial you need for the next command. Do this for device 0 and gateway:

curl -X GET 'https://api.viessmann.com/iot/v2/features/installations/<installationId>/gateways/<gatewaySerial>/devices/gateway/features?filter=device.serial' \
-H 'content-type: application/json' \
-H 'Authorization: Bearer <token>
curl -X GET 'https://api.viessmann.com/iot/v2/features/installations/<installationId>/gateways/<gatewaySerial>/devices/0/features?filter=device.serial' \
-H 'content-type: application/json' \
-H 'Authorization: Bearer <token>

Do you see the device.serial data point on any of the returns?

rolandsteinmeyer commented 2 months ago

I have created an IOT Token via Developer Portal and used it with curl as described above. The third curl call just gives back {"data":[]}

in vicare app I see the serial number and product number of the communication module with status "connected", but for the burner product name and serialnumber is just "-". It looks like the serialnumber is editable. I am not sure if this is new. Screenshot_20240908-080234

Remote software update for the gateway is disabled.

CFenner commented 2 months ago

@home-assistant rename Init in ViCare integration fails due to missing device serial data point

CFenner commented 2 months ago

@rolandsteinmeyer the second call should give a data: [] but the third should have one. Would be interesting if the software update could help here.

Meanwhile I prepared a PR to mitigate this issue. Would be nice, if you could test it.

You can use this script to pull the changes from the PR to your instance:

curl -o- -L https://gist.githubusercontent.com/bdraco/43f8043cb04b9838383fd71353e99b18/raw/core_integration_pr | bash /dev/stdin -d vicare -p 125495
vip-klaus commented 2 months ago

The same problem here. ViCare integration no longer works since the HA update to 2024-09.1.

I use a Vitoconnect OPTO2 with Vitotronic 200 KW6. Everything works in the ViCare app, the type and serial number are displayed for both devices.

rolandsteinmeyer commented 2 months ago

Tried the PR, but integration vicare fails to load. Undoing now. home-assistant_vicare_2024-09-08T06-58-53.534Z.log

CFenner commented 2 months ago

@rolandsteinmeyer you now have no longer this issue, but the other one that is referenced in the pr, the event loop is blocked.

CFenner commented 2 months ago

Hm.. I think I found that issue as well, give mit 15 minutes to fix it 🛠️

CFenner commented 2 months ago

Try again now..

rolandsteinmeyer commented 2 months ago

Tested ok. Integration loads and sensors work again. Thanks a lot, ready for winter to come.

nyn3x commented 2 months ago

Can you please check the API directly with an API call via curl. [...] Do you see the device.serial data point on any of the returns?

I executed those commands, and the last two just returend

{
    "data": []
}
nyn3x commented 2 months ago

@CFenner : I just testet the PR #125495 - which solved this problem 😄 The only thing I noticed: the labels for the sensors seem to be english now instead of german. Is this due to the PR and will not be the case once the PR is merged into the main code-base?

johannesm1 commented 2 months ago

Hi, have the same problem, but no clue, what to do with a PR. Where do I have to put the script?

CFenner commented 2 months ago

@johannesm1 you need to have the terminal & ssh add-on installed and enter the command in the terminal in the config folder. It will download the current state of the PR as a custom component overwriting the built-in vicare integration. If you do so, you will have no translation on the integration for now and when the fix is released you need to manually remove the vicare folder from the config/custom_components folder.

johannesm1 commented 2 months ago

Perfect, it worked! Thanks a lot!

vip-klaus commented 2 months ago

Before we all manually run this script: when will there be an official update of the integration?

Thank you.

CFenner commented 2 months ago

Review pending, it's flagged as fix and and blocking event loop, so I hope it will be fast. But leaving a review / approval in https://github.com/home-assistant/core/pull/125495 can be beneficial.

cagnulein commented 2 months ago

PR worked and review left on the https://github.com/home-assistant/core/pull/125495 I have to remember to revert the integration to the stock one when the PR will be merged

2000Frank2000 commented 2 months ago

is there already a date when ViCare will work again? Have no devices after setting up.

pbox commented 2 months ago

is there already a date when ViCare will work again? Have no devices after setting up.

Frenck said it's going to be part of hass 2024.10.0 next week

wachschaf commented 1 month ago

as of now, i don't see it in the PR-List for 2024.10: https://github.com/home-assistant/core/milestone/695 @CFenner are you aware of this?

CFenner commented 1 month ago

@wachschaf it's there: https://github.com/home-assistant/core/commits/rc/?author=CFenner