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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor MQTT scene to inherit MqttEntity #68883
Refactor MQTT scene to inherit MqttEntity #68883
Conversation
Hey there @emontnemery, mind taking a look at this pull request as it has been labeled with an integration ( |
b29a545
to
425cc80
Compare
PLATFORM_SCHEMA = mqtt.MQTT_BASE_PLATFORM_SCHEMA.extend( | ||
{ | ||
vol.Required(CONF_COMMAND_TOPIC): mqtt.valid_publish_topic, | ||
vol.Optional(CONF_ICON): cv.icon, | ||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, | ||
vol.Optional(CONF_PAYLOAD_ON): cv.string, | ||
vol.Optional(CONF_PAYLOAD_ON, default=DEFAULT_PAYLOAD_ON): cv.string, |
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 is in the documentation, but the default is was not set.
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 is a breaking change, let's update the documentation according to the implementation 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.
already meregd
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.
I'll open a PR to change the current docs that a default value is not set.
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.
OK, let's revert this change then.
@@ -811,7 +811,8 @@ async def _subscribe_topics(self): | |||
@property | |||
def entity_registry_enabled_default(self) -> bool: | |||
"""Return if the entity should be enabled when first added to the entity registry.""" | |||
return self._config[CONF_ENABLED_BY_DEFAULT] |
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.
a scene
cannot be disabled and will not have CONF_ENABLED_BY_DEFAULT
as configuration option, despite if what the current documentation says. The PR to correct this is attached.
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.
Why can't scene entities be disabled? Also, why do we change the common MQTTEntity
?
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.
my bad, CONF_ENABLED_BY_DEFAULT added to the schema. This option is removed from the current documentation, because it is not available in the current code.
@@ -811,7 +811,8 @@ async def _subscribe_topics(self): | |||
@property | |||
def entity_registry_enabled_default(self) -> bool: | |||
"""Return if the entity should be enabled when first added to the entity registry.""" | |||
return self._config[CONF_ENABLED_BY_DEFAULT] |
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.
Why can't scene entities be disabled? Also, why do we change the common MQTTEntity
?
PLATFORM_SCHEMA = mqtt.MQTT_BASE_PLATFORM_SCHEMA.extend( | ||
{ | ||
vol.Required(CONF_COMMAND_TOPIC): mqtt.valid_publish_topic, | ||
vol.Optional(CONF_ICON): cv.icon, | ||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, | ||
vol.Optional(CONF_PAYLOAD_ON): cv.string, | ||
vol.Optional(CONF_PAYLOAD_ON, default=DEFAULT_PAYLOAD_ON): cv.string, |
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 is a breaking change, let's update the documentation according to the implementation instead.
Correct current documentation: home-assistant/home-assistant.io#22196. |
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.
Thanks, @jbouwh 馃憤
Proposed change
Simplify MQTT scene by inheriting
MqttEntity
.TODO: The documentation about the added
enabled_by_default
config option is to be corrected innext
.Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: