-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Replace 8000 emulated_hue: with emulated_hue_hidden: for consistency. #9382
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
Replace emulated_hue: with emulated_hue_hidden: for consistency. #9382
Conversation
else: | ||
expose = False | ||
if explicit_expose: | ||
_LOGGER.warning("The attribute 'emulated_hue' is deprecated and will be removed in a" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (97 > 79 characters)
if explicit_expose is True or explicit_hidden is False : | ||
expose = True | ||
else: | ||
expose = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is not a multiple of four
|
||
explicit_hidden = entity.attributes.get (ATTR_EMULATED_HUE_HIDDEN, None) | ||
if explicit_expose is True or explicit_hidden is False : | ||
expose = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is not a multiple of four
@@ -223,17 +224,24 @@ def is_entity_exposed(self, entity): | |||
|
|||
domain = entity.domain.lower() | |||
explicit_expose = entity.attributes.get(ATTR_EMULATED_HUE, None) | |||
|
|||
explicit_hidden = entity.attributes.get (ATTR_EMULATED_HUE_HIDDEN, None) | |||
if explicit_expose is True or explicit_hidden is False : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace before ':'
@@ -223,17 +224,24 @@ def is_entity_exposed(self, entity): | |||
|
|||
domain = entity.domain.lower() | |||
explicit_expose = entity.attributes.get(ATTR_EMULATED_HUE, None) | |||
|
|||
explicit_hidden = entity.attributes.get (ATTR_EMULATED_HUE_HIDDEN, None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace before '('
line too long (80 > 79 characters)
|
||
return is_default_exposed or explicit_expose | ||
return is_default_exposed or expose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line under-indented for visual indent
domain_exposed_by_default = \ | ||
self.expose_by_default and domain in self.exposed_domains | ||
|
||
# Expose an entity if the entity's domain is exposed by default and | ||
# the configuration doesn't explicitly exclude it from being | ||
# exposed, or if the entity is explicitly exposed | ||
is_default_exposed = \ | ||
domain_exposed_by_default and explicit_expose is not False | ||
domain_exposed_by_default and expose is not False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line under-indented for visual indent
expose = False | ||
if explicit_expose: | ||
_LOGGER.warning("The attribute 'emulated_hue' is deprecated and" | ||
"will be removed in a future version use" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected indentation
else: | ||
expose = False | ||
if explicit_expose: | ||
_LOGGER.warning("The attribute 'emulated_hue' is deprecated and" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace
expose = True | ||
else: | ||
expose = False | ||
if explicit_expose: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line missing indentation or outdented
multiple statements on one line (colon)
if explicit_expose is True or explicit_hidden is False: | ||
expose = True | ||
else: | ||
expose = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected spaces around keyword / parameter equals
explicit_hidden = entity.attributes.get ATTR_EMULATED_HUE_HIDDEN, None) | ||
if explicit_expose is True or explicit_hidden is False: | ||
expose = True | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line missing indentation or outdented
multiple statements on one line (colon)
|
||
explicit_hidden = e 8000 ntity.attributes.get ATTR_EMULATED_HUE_HIDDEN, None) | ||
if explicit_expose is True or explicit_hidden is False: | ||
expose = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected spaces around keyword / parameter equals
@@ -223,17 +224,25 @@ def is_entity_exposed(self, entity): | |||
|
|||
domain = entity.domain.lower() | |||
explicit_expose = entity.attributes.get(ATTR_EMULATED_HUE, None) | |||
|
|||
explicit_hidden = entity.attributes.get ATTR_EMULATED_HUE_HIDDEN, None) | |||
if explicit_expose is True or explicit_hidden is False: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line missing indentation or outdented
multiple statements on one line (colon)
@@ -223,17 +224,25 @@ def is_entity_exposed(self, entity): | |||
|
|||
domain = entity.domain.lower() | |||
explicit_expose = entity.attributes.get(ATTR_EMULATED_HUE, None) | |||
|
|||
explicit_hidden = entity.attributes.get ATTR_EMULATED_HUE_HIDDEN, None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SyntaxError: invalid syntax
Perhaps I'm misunderstanding, but If you want to standardize it wouldn't it make more sense to have a light.bedroom:
hidden:
- emulated_hue
- homebridge
- haaska That way the implementation can scale for any number of platforms that would require certain components to be excluded from discovery. Given the popularity of the emulated_hue platform, it seems to me that this change is disruptive without actually improving anything. My two cents anyhow. ¯\_(ツ)_/¯ |
else: | ||
expose = None | ||
if explicit_expose: | ||
_LOGGER.warning("The attribute 'emulated_hue' is deprecated and" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace
Lint errors
@fronzbot We already have a hidden attribute and it's a boolean for the frontend. Any hidden attribute for other things (emulated_hue, etc) should be via it's own attribute, no overloading. So this is the right approach. |
else: | ||
expose = None | ||
if explicit_expose: | ||
_LOGGER.warning("The attribute 'emulated_hue' is deprecated and" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use helper.deprecation
helpers instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will require tests to be written.
@@ -98,6 +98,14 @@ def hass_hue(loop, hass): | |||
hass.states.async_set( | |||
kitchen_light_entity.entity_id, kitchen_light_entity.state, | |||
attributes=attrs) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line contains whitespace
Thanks! |
Seems to me that the naming is confusing. Emulated_hue_hidden: false implies it is not hidden. It should be true to hide. |
Unless it's the documentation that needs to be a bit clearer. Specifying false is relatively pointless as it's the same as default |
I agree with @nikc0069, this is very confusing. If one has expose_by_default set to false, the old way of enabling a light would have been setting emulated_hue to true. Now with emulated_hue_hidden, that would also be set to true? That makes no sense, it implies that I'm saying yes to it being hidden. Seems like haaska and emulated hue should have had their parameter changed to "visible" or "shown" so that it's clear as to what true or false does. |
Also, please don't use closed PRs for such discussions. |
Description:
I would like to propose the following code changes to standardize the way we choose to expose entity's to other platforms. This might be the wrong way to go about this but it is working in my situation.
Currently we use the following configs to get the same "hidden" result.
The code will continue to accept the current emulated_hue: attribute but will also except emulated_hue_hidden as well.
Example entry for
configuration.yaml
(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
tox
run successfully. Your PR cannot be merged unless tests passREQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices:
tox
run successfully. Your PR cannot be merged unless tests pass