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

New Release 3.1.1 #737

Merged
merged 11 commits into from
Apr 13, 2024
Merged

New Release 3.1.1 #737

merged 11 commits into from
Apr 13, 2024

Conversation

petretiandrea
Copy link
Owner

No description provided.

@petretiandrea petretiandrea marked this pull request as ready for review April 8, 2024 20:51
if device.is_color:
color_modes.append(ColorMode.HS)
if device.is_brightness and not device.is_color_temperature and not device.is_color:
color_modes.append(ColorMode.BRIGHTNESS)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should just return here {ColorMode.BRIGHTNESS} and not append to the set, as the documentation states it should be the only possible color mode.
Same applies to ONOFF.

Screenshot 2024-04-13 at 09 56 38

So for example supported modes set to color_temp, brightness should never be possible.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code follows the HA algorithm describe here https://developers.home-assistant.io/docs/core/entity/light/#color-modes. Don't you agree?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's also the resource where my screenshot is from.
So this is not correct, as in the current implementation you have now there could potentially be scenarios where brightness could be mixed with other color modes in the supported_color_modes, but it has to be the only one.

See also the explanation how to correctly determine the color modes:

Screenshot 2024-04-13 at 12 43 09

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if has the and not device.is_color_temperature and not device.is_color so cannot be mixed with other color modes. No?

Copy link

@bramstroker bramstroker Apr 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I see you are correct about that.
However I see potential issue with the last condition:

if not device.is_color_temperature and not device.is_color:
        color_modes.append(ColorMode.ONOFF)

This does not check for brightness.
So you'll end up with brightness, onoff as supported color modes, which is not valid.

Maybe rewrite to:

if not color_modes:
     color_modes.append(ColorMode.ONOFF)

Similarly as HA suggests in their approach.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now It's clear and I agree with you

Copy link

github-actions bot commented Apr 13, 2024

Coverage

Coverage Report
FileStmtsMissCoverMissing
custom_components/tapo
   __init__.py67396%63, 73–74
   config_flow.py1776364%79, 138–171, 180, 185–194, 214, 222, 237–245, 274, 304, 309–315, 320–323, 326–330, 336, 342–347
   coordinators.py55296%90, 92
   diagnostics.py13130%1–22
   discovery.py20860%17–22, 31–35
   errors.py7186%6
   hass_tapo.py42198%67
   helpers.py38879%20, 28, 40, 66, 70–74
   light.py1311092%64, 67–72, 89–90, 211, 213
   migrations.py18950%14–30
   setup_helpers.py24292%37–38
   update.py792766%50, 54, 58–64, 84–87, 93–103, 108, 112–113, 119–120, 124–125
custom_components/tapo/hub
   binary_sensor.py661774%34–39, 48, 52, 56, 67, 71, 75, 84, 88, 92, 103–105, 109, 113, 117
   climate.py65494%26–28, 73
   hass_tapo_hub.py51884%65–69, 91, 113, 119
   number.py62494%29–31, 85
   sensor.py1233472%43–53, 64–65, 69, 73, 77, 81, 85–87, 100–102, 106, 110, 114, 118–123, 127, 169–171, 175, 179, 183, 187, 191
   siren.py48198%100
   switch.py751185%21–27, 43, 47, 50–51, 54–55
custom_components/tapo/sensors
   __init__.py54787%27, 42, 72, 88–89, 104, 119
   tapo_sensor_source.py8275%8, 11
TOTAL145423584% 

Tests Skipped Failures Errors Time
67 0 💤 0 ❌ 0 🔥 4.468s ⏱️

@petretiandrea petretiandrea merged commit 3897af7 into main Apr 13, 2024
4 of 6 checks passed
Copy link

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants