Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hikvision integration crashes latest Home Assistant 2024.2 #138

Closed
gambit66 opened this issue Feb 7, 2024 · 47 comments
Closed

Hikvision integration crashes latest Home Assistant 2024.2 #138

gambit66 opened this issue Feb 7, 2024 · 47 comments
Labels
bug Something isn't working

Comments

@gambit66
Copy link

gambit66 commented Feb 7, 2024

I was unable to upgrade to Home Assistant 2024.2 without first deleting the Hikvision integration. This integration was causing Home Assistant to crash on startup. All the details about this crash is available on an issue logged with Home Assistant:

home-assistant/core#109597

@msaphoto06
Copy link

Same

@vampywiz17
Copy link

same problem

@blindguynar
Copy link

blindguynar commented Feb 8, 2024

same - deleting integration allows it to update, but of course then the integration is gone and fails to setup again.

@GroteGehaktBal
Copy link

Same here

@JohnyBeGood
Copy link

Same here on generic-x86_64

@dolenec
Copy link

dolenec commented Feb 8, 2024

Same 🫣

@Niels-Stoffer
Copy link

Same

@maciej-or maciej-or added the bug Something isn't working label Feb 8, 2024
@thefunkygibbon
Copy link

thefunkygibbon commented Feb 8, 2024

same. its relating to to the unique id being used is a list rather than a string.

from /config/.storage/core.config_entries

        "unique_id": [
          [
            "hikvision_next",
            "DS-2CD2342WD-I20160317BBWR582155793"
          ]
        ],

@thefunkygibbon
Copy link

also i moved my integration from my custom_integrations folder and it still doesnt start. I assume i must need to do something else to fully rid it from my system? going to have to roll back to 2024.1.6 for the time being

@Steve2017
Copy link

I removed the Hikvision integration (including from HACS) and that resolved the issue. I have now been able to update to 2024.2.

Unfortunately this brings me back to the Omada issue with 2024.1.6 - that is this one:
home-assistant/core#109339 (comment)
I'd been hoping that fix would be in this release but no.

@chrisuk-web
Copy link

Same here. I can delete the integration, patch HA core to 2024.2.0 but then cannot install HIKvision next as I get "unexpected error" using exactly the same field data that work if I install when core is 2024.1.6

@thefunkygibbon
Copy link

I removed the Hikvision integration (including from HACS) and that resolved the issue. I have now been able to update to 2024.2.

Unfortunately this brings me back to the Omada issue with 2024.1.6 - that is this one: home-assistant/core#109339 (comment) I'd been hoping that fix would be in this release but no.

probably isn't much use posting about omada in this repo :-)

Do i need to actually delete the integration completely? from within the GUI? i don't fancy doing that as it means i'd have to re-set up all of my automations and everything else which uses my hikvision entities :-( not ideal. fingers crossed that this integration is not dead and that the dev is happy to fix.

@dolenec
Copy link

dolenec commented Feb 8, 2024

Will be there any fix of HikVision integration or we must move to forward with new/other solutions?

@maciej-or
Copy link
Owner

@dolenec sure, I'm going to fix that

@ON4AHV
Copy link

ON4AHV commented Feb 8, 2024

Same

@Rolax68
Copy link

Rolax68 commented Feb 8, 2024

the same, Sorry

@dolenec
Copy link

dolenec commented Feb 8, 2024

@dolenec sure, I'm going to fix that

And when we can expect hotfix? Will there be need to remove and reinstall integration or there should be update which will fix the problem with updating HA and it is worth of waiting.

@brave0d
Copy link

brave0d commented Feb 8, 2024

wow, guys, be patient... @maciej-or said he is on it, so he will fix it and let us know what to do to apply the fix...

there is no really point saying "me too", "same", ... etc, as the bug has been confirmed and EVERYONE who wants to use 2024.2 with this component is affected.

development is not digging rows, PATIENCE!

@dolenec
Copy link

dolenec commented Feb 8, 2024

Not being patient.. simple normal question if there is any timeline.. nothing else.. not pushing anybody anywhere..

@xoferz
Copy link

xoferz commented Feb 8, 2024

Not being patient.. simple normal question if there is any timeline.. nothing else.. not pushing anybody anywhere..

Well, the time the author spends on estimating the timeline and answering this to you and others, is the time he is not spending on fixing the issue...
It has not yet been a day since HA 2024-02 release. If you need a fix in less than 24 hours you can either pay someone to fix it or download the source, find the issue and fix it yourself (and share).

@arsenal3008
Copy link

I understand that no one can enter 192.168.1.67:8123?

@HuffYk
Copy link

HuffYk commented Feb 8, 2024

same. its relating to to the unique id being used is a list rather than a string.

from /config/.storage/core.config_entries

        "unique_id": [
          [
            "hikvision_next",
            "DS-2CD2342WD-I20160317BBWR582155793"
          ]
        ],

this exactly seems to be problem... Except uninstall I tried to fix it directly in /config/.storage/core.config_entries so above example (just to be sure: don't use this exact unique_id but fix yours in config!) will look like this:

"unique_id": "DS-2CD2342WD-I20160317BBWR582155793",

...and upgrade went ok + also hikvision integration after upgrade still works. However I'm not sure if this fix it correct one and it doesn't corrupt future upgrades - @maciej-or please comment if we can use this quick fix so far...

@maciej-or
Copy link
Owner

this line might be wrong:
https://github.com/maciej-or/hikvision_next/blob/main/custom_components/hikvision_next/config_flow.py#L68
could you confirm if:
await self.async_set_unique_id(isapi.device_info.serial_no)
fixes that?
(remember to restart HA after file change)

@blindguynar
Copy link

blindguynar commented Feb 8, 2024

await self.async_set_unique_id(isapi.device_info.serial_no)

That fix allowed me to add back the integration and at a glance it seems working. All cameras are displaying and all automations/entities are present.

Not sure if that will fix an integration that wasn't removed. i.e. i removed the integration and updated then couldn't add it back. this allowed me to add it back.

@brave0d
Copy link

brave0d commented Feb 8, 2024

@maciej-or

await self.async_set_unique_id(isapi.device_info.serial_no)

I am not a specialist here, but maybe better concatenate DOMAIN and serial_no?

@blindguynar
Copy link

@maciej-or

await self.async_set_unique_id(isapi.device_info.serial_no)

I am not a specialist here, but maybe better concatenate DOMAIN and serial_no?

i doubt its needed. The serial# should be unique enough without requiring the domain.

@smeegoan
Copy link

smeegoan commented Feb 8, 2024

I did the same fix as above before checking here first and it works await self.async_set_unique_id(isapi.device_info.serial_no)

@KostuaD
Copy link

KostuaD commented Feb 8, 2024

this line might be wrong: https://github.com/maciej-or/hikvision_next/blob/main/custom_components/hikvision_next/config_flow.py#L68 could you confirm if: await self.async_set_unique_id(isapi.device_info.serial_no) fixes that? (remember to restart HA after file change)

It worked! Thank you!

@diepeterpan
Copy link

same. its relating to to the unique id being used is a list rather than a string.
from /config/.storage/core.config_entries

        "unique_id": [
          [
            "hikvision_next",
            "DS-2CD2342WD-I20160317BBWR582155793"
          ]
        ],

this exactly seems to be problem... Except uninstall I tried to fix it directly in /config/.storage/core.config_entries so above example will look like this:

"unique_id": "DS-2CD2342WD-I20160317BBWR582155793",

...and upgrade went ok + also hikvision integration after upgrade still works. However I'm not sure if this fix it correct one and it doesn't corrupt future upgrades - @maciej-or please comment if we can use this quick fix so far...

Applied this config change and the code change recommended, did a core restart, and then the update succeeded and the cameras are all still working.

@pepsonEL
Copy link

pepsonEL commented Feb 8, 2024

when i have installed your integration i can not update HA Core to new version 2024.2.0. It start install update but after reboot still go back to 2024.1.6
Probably it is your integration. I chanege code as you write buty nothing. Still is the same problem.

@diepeterpan
Copy link

diepeterpan commented Feb 8, 2024

when i have installed your integration i can not update HA Core to new version 2024.2.0. It start install update but after reboot still go back to 2024.1.6 Probably it is your integration. I chanege code as you write buty nothing. Still is the same problem.

You must also change /config/.storage/core.config_entries as discussed above.

@blindguynar
Copy link

blindguynar commented Feb 8, 2024

same. its relating to to the unique id being used is a list rather than a string.
from /config/.storage/core.config_entries

        "unique_id": [
          [
            "hikvision_next",
            "DS-2CD2342WD-I20160317BBWR582155793"
          ]
        ],

this exactly seems to be problem... Except uninstall I tried to fix it directly in /config/.storage/core.config_entries so above example will look like this:

"unique_id": "DS-2CD2342WD-I20160317BBWR582155793",

...and upgrade went ok + also hikvision integration after upgrade still works. However I'm not sure if this fix it correct one and it doesn't corrupt future upgrades - @maciej-or please comment if we can use this quick fix so far...

i wonder how many people are going to update their config file to exactly what you've put here? :) Not use their own serial # i mean and simply copy/paste yours ... i'd hope not, but then i watch the news and nothing surprises me afterwards!

@pepsonEL
Copy link

pepsonEL commented Feb 8, 2024

when i have installed your integration i can not update HA Core to new version 2024.2.0. It start install update but after reboot still go back to 2024.1.6 Probably it is your integration. I chanege code as you write buty nothing. Still is the same problem.

You must also change /config/.storage/core.config_entries as discussed above.

Ok change and now updated ok.... Thanks.

I am waiting for update integration from @maciej-or and maybe also update to start working motion from NVR and cameras in this integration. Now motion detect no working.

@HuffYk
Copy link

HuffYk commented Feb 8, 2024

same. its relating to to the unique id being used is a list rather than a string.
from /config/.storage/core.config_entries

        "unique_id": [
          [
            "hikvision_next",
            "DS-2CD2342WD-I20160317BBWR582155793"
          ]
        ],

this exactly seems to be problem... Except uninstall I tried to fix it directly in /config/.storage/core.config_entries so above example will look like this:

"unique_id": "DS-2CD2342WD-I20160317BBWR582155793",

...and upgrade went ok + also hikvision integration after upgrade still works. However I'm not sure if this fix it correct one and it doesn't corrupt future upgrades - @maciej-or please comment if we can use this quick fix so far...

i wonder how many people are going to update their config file to exactly what you've put here? :) Not use their own serial # i mean and simply copy/paste yours ... i'd hope not, but then i watch the news and nothing surprises me afterwards!

I thought exactly about this, so rather updated my post 😁

@cp3pl
Copy link

cp3pl commented Feb 8, 2024

Dzięki działa :)
await self.async_set_unique_id(isapi.device_info.serial_no)
Pozdro.

@thefunkygibbon
Copy link

thefunkygibbon commented Feb 9, 2024

so is /has / will the integration been updated or do we just need to do this fix manually and that's it? will the fix survive a reload of the integration or further updates? or adding new devices

@tomecki88
Copy link

this line might be wrong: https://github.com/maciej-or/hikvision_next/blob/main/custom_components/hikvision_next/config_flow.py#L68 could you confirm if: await self.async_set_unique_id(isapi.device_info.serial_no) fixes that? (remember to restart HA after file change)

Hi @maciej-or,
this fix for me is also working perfectly. Core updated and hikvision integration works perfectly.

@blindguynar
Copy link

Screenshot 2024-02-09 at 8 47 10 AM

2024.2.1 (just released) might make the issue mute. Not sure as i've already applied the fix.

@msaphoto06
Copy link

I reinstalled with hacs. and HA starts.
I didn't make any changes

@JohnyBeGood
Copy link

v2024.2.1 updated just fine for me and I did not have to make any manual changes.

@thefunkygibbon
Copy link

updated HA and had added it back and it seems to be fine. I would suggest that the integration still needs changing somewhat as i am sure that they reverted the code in HA which checks and fails for these unique id's being just strings. it really doesnt NEED to be anything other than a string. so if (or more likely when) they bring back the check for string, the integration likely won't work again (but hopefully shouldnt cause the whole of HA to not bootup)

@msaphoto06
Copy link

Impossib

J'ai réinstallé avec hacs. et HA démarre. je n'ai fait aucune modification

impossible to add the camera however

@blindguynar
Copy link

updated HA and had added it back and it seems to be fine. I would suggest that the integration still needs changing somewhat as i am sure that they reverted the code in HA which checks and fails for these unique id's being just strings. it really doesnt NEED to be anything other than a string. so if (or more likely when) they bring back the check for string, the integration likely won't work again (but hopefully shouldnt cause the whole of HA to not bootup)

Agree, but now the owner doesn't have the pressure. I think the code fix is rather trivial based on single line that needed adjusted above. However, I'm unsure if it will also need to go through the config flow again to correct the core.config_entries file though. I don't know if that file is regenerated on HA update, restart, reconfiguration of an integration, and/or integration update or none or all of the above. That's just my lack of knowledge on inner workings of HA. Might be just new release of the hacs integration and done for all i know.

@T0tof
Copy link

T0tof commented Feb 9, 2024

Code fix is ok :
upgrade to 2024.2.1 is not enough
Change code :
https://github.com/maciej-or/hikvision_next/blob/main/custom_components/hikvision_next/config_flow.py#L68 : await self.async_set_unique_id(isapi.device_info.serial_no)
Reboot
Add my cameras Annke C800

Works fine !
Thanks

@msaphoto06
Copy link

Code fix is ok : upgrade to 2024.2.1 is not enough Change code : https://github.com/maciej-or/hikvision_next/blob/main/custom_components/hikvision_next/config_flow.py#L68 : await self.async_set_unique_id(isapi.device_info.serial_no) Reboot Add my cameras Annke C800

Works fine ! Thanks

Top!
Work fine

@xoferz
Copy link

xoferz commented Feb 10, 2024

FWIW upgrade from 2024.1.5 to 2024.2.1 worked fine for me without any modification to hikvision_next. All cameras and their smart events continued working.

@maciej-or
Copy link
Owner

Hello, the new version is now available. It generates valid unique IDs and updates old ones. The workaround introduced in Home Assistant version 2024.2.1 is temporary, so please update the integration to v1.0.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests