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

INCOMPATIBILITY WITH FUTURE HA Core 2025.1 #221

Closed
ecchodun opened this issue Jan 5, 2024 · 33 comments
Closed

INCOMPATIBILITY WITH FUTURE HA Core 2025.1 #221

ecchodun opened this issue Jan 5, 2024 · 33 comments
Labels
enhancement New feature or request

Comments

@ecchodun
Copy link

ecchodun commented Jan 5, 2024

I'm using Blue Iris integration to show cameras.

I found this in the log:

Logger: homeassistant.components.camera
Source: helpers/deprecation.py:204
Integration: Camera (documentation, issues)
First occurred: 8:56:53 AM (4 occurrences)
Last logged: 8:57:00 AM

SUPPORT_STREAM was used from blueiris, this is a deprecated constant which will be removed in HA Core 2025.1. Use CameraEntityFeature.STREAM instead, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues
SUPPORT_STREAM was used from dahua, this is a deprecated constant which will be removed in HA Core 2025.1. Use CameraEntityFeature.STREAM instead, please create a bug report at https://github.com/rroller/dahua/issues

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:1520
First occurred: 8:56:55 AM (10 occurrences)
Last logged: 8:57:00 AM

Entity camera.house_num_4 (<class 'custom_components.blueiris.camera.BlueIrisCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature: 0>, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Entity camera.house_num_5 (<class 'custom_components.blueiris.camera.BlueIrisCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature: 0>, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Entity camera.house_front_door (<class 'custom_components.blueiris.camera.BlueIrisCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature: 0>, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Entity camera.front_doorbell_main (<class 'custom_components.dahua.camera.DahuaCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature.STREAM: 2>, please create a bug report at https://github.com/rroller/dahua/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Entity camera.front_doorbell_sub (<class 'custom_components.dahua.camera.DahuaCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature.STREAM: 2>, please create a bug report at https://github.com/rroller/dahua/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation

@kramttocs kramttocs added the enhancement New feature or request label Jan 5, 2024
@kramttocs
Copy link
Collaborator

Thanks. Seeing the same

@morikplay
Copy link

thank you @kramttocs and @elad-bar for offering a fix. I'm running v1.0.16 (installed today) of this plugin, and i still see both errors:

  • SUPPORT_STREAM (as mentioned above)
  • Entity camera.house_num_x (also mentioned above)

e.g.

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:1520
First occurred: 12:44:42 PM (19 occurrences)
Last logged: 12:44:43 PM

Entity camera.esco_eyes_tesla_sideyard (<class 'custom_components.blueiris.camera.BlueIrisCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature: 0>, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Entity camera.esco_eyes_east_backyard (<class 'custom_components.blueiris.camera.BlueIrisCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature: 0>, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Entity camera.esco_eyes_west_backyard (<class 'custom_components.blueiris.camera.BlueIrisCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature: 0>, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Entity camera.esco_eyes_garage (<class 'custom_components.blueiris.camera.BlueIrisCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature: 0>, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Entity camera.esco_eyes_front_doorbell (<class 'custom_components.blueiris.camera.BlueIrisCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature: 0>, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation

@kramttocs
Copy link
Collaborator

kramttocs commented Jan 9, 2024

Hi @morikplay ,
Sorry, this one hasn't been merged to main or released yet. Should be before too long though - I just want to run with it awhile. You can manually apply the files from the PR if you want though.

@olympia
Copy link

olympia commented Jan 9, 2024

@morikplay well, the fix (PR) is not merged yet. You need to run the code from #222
to get rid of the SUPPORT_STREAM issues. I still see the Entity camera.xxx issues with the fixed code as well though.

@morikplay
Copy link

Hi @morikplay ,

You can manually apply the files from the PR if you want though.

Ah. I now see that the commit has yet to be merged. I can try to manually copy over the changed files. Could the copy-over work without HA restart?

@olympia
Copy link

olympia commented Jan 10, 2024

Best would be to download the entire code from the PR as a zip and then copy-replace all files (without trying to figure out what files were changed).
...and HA needs to be restarted.

@morikplay
Copy link

morikplay commented Jan 10, 2024

@olympia much obliged. Took your advice. Replaced blueiris w/ this all files from commit. See verification from e.g. camera.py:

line#14 and such use new code:

from homeassistant.components.camera import (
    DOMAIN as DOMAIN_CAMERA,
    Camera,
    CameraEntityFeature,
)
...
from .helpers.const import (
    BI_CAMERA_ATTR_GROUP_CAMERAS,
    CONF_CONTENT_TYPE,
    CONF_FRAMERATE,
    CONF_LIMIT_REFETCH_TO_URL_CHANGE,
    CONF_STILL_IMAGE_URL,
    CONF_STREAM_SOURCE,
    CONF_SUPPORT_STREAM,
    DOMAIN,
    NOT_AVAILABLE,
    SERVICE_MOVE_TO_PRESET,
    SERVICE_TRIGGER_CAMERA,
)

Restarted haos. Still seeing entity errors:

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:1520
First occurred: 11:13:50 AM (19 occurrences)
Last logged: 11:13:51 AM

Entity camera.aaa (<class 'custom_components.blueiris.camera.BlueIrisCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature: 0>, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Entity camera.bbb (<class 'custom_components.blueiris.camera.BlueIrisCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature: 0>, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Entity camera.ccc (<class 'custom_components.blueiris.camera.BlueIrisCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature: 0>, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Entity camera.ddd (<class 'custom_components.blueiris.camera.BlueIrisCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature: 0>, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
Entity camera.eee (<class 'custom_components.blueiris.camera.BlueIrisCamera'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <CameraEntityFeature: 0>, please create a bug report at https://github.com/elad-bar/ha-blueiris/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation

@olympia
Copy link

olympia commented Jan 10, 2024

Yes, same for me, that's what I meant above.

There was another issue with "SUPPORT_STREAM" being used by Blue Iris as described in the original post of this issue. That has been fixed/ gone using the code from the PR, but we still see the Entity camera.xxx issues being logged.

@morikplay
Copy link

morikplay commented Jan 11, 2024

Yes, same for me, that's what I meant above.

There was another issue with "SUPPORT_STREAM" being used by Blue Iris as described in the original post of this issue. That has been fixed/ gone using the code from the PR, but we still see the Entity camera.xxx issues being logged.

Ah. Sorry, slow learner over here. Now, I'm all caught up. If i understand the camera.xxx supported features error then @kramttocs and @elad-bar would need to change e.g. camera.py ln#104 from

self._supported_features = stream_support_flag

to something like:

i_on_off = 1 # for setting ON_OFF flag
self._supported_features = i_on_off | stream_support_flag

@kramttocs
Copy link
Collaborator

kramttocs commented Jan 11, 2024

elad-bar already took care of that part of the code so it conforms now.
I need to look into it more (sorry, only had a couple minutes right now) but I think what the message is telling us is simply to change this:

   def supported_features(self):
        """Return supported features for this camera."""
        return self._supported_features

to

def supported_features(self) -> CameraEntityFeature: 
      """Return supported features for this camera."""
      return self._supported_features

Or it may not like the use of _supported_features at all in the init method...

@olympia
Copy link

olympia commented Jan 11, 2024

Non of the two (@morikplay's and @kramttocs') above proposed change fixes the camera.xxx supported features warning at my side.

@kramttocs
Copy link
Collaborator

Please try the code from #223

@olympia
Copy link

olympia commented Jan 11, 2024

@kramttocs camera.xxx supported features warnings have been disappeared with this PR :)
Many thanks!

@kramttocs
Copy link
Collaborator

elad-bar may have a better suggestion than the code change I made but at least we know what will make HA happy :)

@morikplay
Copy link

Thank you @olympia and @kramttocs. Supported features documentation said that the feature set is now a bitwise OR. Hence | needs to be used to create the composite feature support matrix per HA guidelines. I hadn't looked into what was being returned 😀 (which is what #223) seems to have fixed. Returning individual elements is likely to cause future incompatibility, imho.

@olympia
Copy link

olympia commented Jan 11, 2024

For me now Supported features returns a big 0 individually. I am far for being an expert, I am just a user and can only test things out. :)

@kramttocs
Copy link
Collaborator

Hey @morikplay - can you elaborate on your concern with the individual elements?
The bitwise or is needed if we have multiples but in this case we are only using the one Stream feature. Honestly, I haven't looked to see what the on_off does but since we are pulling from the BI API I am not sure how that would be applicable. Unless it would provide a method to implement a way to enable/disable the camera in BI...

@kramttocs
Copy link
Collaborator

@olympia You don't have 'Support stream component (Requires restart)' checked in the Configure options, right?

@morikplay
Copy link

Honestly, I haven't looked to see what the on_off does but since we are pulling from the BI API I am not sure how that would be applicable. Unless it would provide a method to implement a way to enable/disable the camera in BI...

Indeed. Camera's supported features has two defined values:

  • ON_OFF
  • STREAMS

Each of which corresponds to certain methods eg turn_on etc which have been implemented in the code. My assumption is that once supported feature is set appropriately, when called by UI (initiated by eg user clicking On/OFF button, or stream checkbox in config), HA will call above methods if supported features values are set appropriately. So, even though the warnings may temporarily disappear, using above fixes, the code may not work as intended.

Of course this is my first time looking into the innards of HA. So, please take anything I say with a grain of salt. Thank you for taking my comments into consideration.

@olympia
Copy link

olympia commented Jan 11, 2024

@olympia You don't have 'Support stream component (Requires restart)' checked in the Configure options, right?

Correct, I have this unchecked. Shall I turn this on now for testing or in general?

@kramttocs
Copy link
Collaborator

@morikplay And if you are curious you can see another implementation here: https://github.com/home-assistant/core/blob/dev/homeassistant/components/netatmo/camera.py

Sorry, I am still not understanding what your concern with the fixes are - and I am asking in the "if there's a better way, let's do it that way" attitude. As far as I can tell from the doc, setting them this way is equivalent to how they are showing it.

@olympia Good - was hoping you didn't have it checked and it was still showing 0. As for turning it on, that's up to you if you want to use the stream component. I don't actually show any camera feeds in HA so am not a good person to ask 😁

@morikplay
Copy link

morikplay commented Jan 11, 2024

@morikplay And if you are curious you can see another implementation here: https://github.com/home-assistant/core/blob/dev/homeassistant/components/netatmo/camera.py

Sorry, I am still not understanding what your concern with the fixes are - and I am asking in the "if there's a better way, let's do it that way" attitude. As far as I can tell from the doc, setting them this way is equivalent to how they are showing it.

Thank you for the reference @kramttocs. I certainly wasn't questioning either your judgement or implementation 😃. I will defer the eventual solution to your wisdom. Thank you for being open to other ways of fixing the issue.

Looking at the reference lines 180-187 I do see the use of bit wise or | wrt usage of Supported Features. This is what I was trying to illustrate with my suggestion.

I do have steaming enabled in my setup.

I'm happy to study it further if you think there's merit in it.

@kramttocs
Copy link
Collaborator

@morikplay Oh please question away! There are a lot of things I don't fully have my head wrapped around in this custom component so am often just standing on the shoulders of giants.

I follow now - yes, if we were using both of the features, we would | them but since we are just using 1 (like line 184 in that netatmo example if line 185 returned false), I am just assigning it.

That's good that you have streaming enabled - please look at the camera in Developer Tools to ensure the support_features shows the Stream value and then keep us updated if you see anything odd with the camera streams.

@morikplay
Copy link

Thank you @kramttocs. Supported features has a big fat 0 despite streaming enabled :(

@kramttocs
Copy link
Collaborator

Thanks! I'll look into it.

@kingracefan
Copy link

Is there any progress in addressing this issue? I'm really maried to BI and HA for many reasons. P.S. You folks that have the know how to fix such things is realy appreciated.

@kramttocs
Copy link
Collaborator

I have a pr for it - just need to merge it and push a release

@SgtFlippy
Copy link

I have a pr for it - just need to merge it and push a release

I don't have a clue how this all works or how long things take, but any update on this? Was just checking logs and saw this again and wondered if there was any news.

Either way thank you very much for keeping this integration working!

@kramttocs
Copy link
Collaborator

Sorry, it won't take long - I just need to find the time to do it. I'll make a note to try to work on it this weekend.

@SgtFlippy
Copy link

Sorry, it won't take long - I just need to find the time to do it. I'll make a note to try to work on it this weekend.

No pressure, all good. It should still be good to 2025 😁 Was just wondering!

@kramttocs
Copy link
Collaborator

Go ahead and give it a go - v1.0.18 is out there. Admittedly I didn't really test my latest changes but they are just around logging so pretty safe. The other change in there were tested previously in this thread so those shouldn't cause any grief.

Let me know how it goes.

@SgtFlippy
Copy link

Awesome, rebooted and only error left for me is HACS accessing front-end. Nothing else!

@ecchodun
Copy link
Author

Well. This solved this error. Thank you a bunch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants