-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
Add initial MQTT subentry support for notify entities #138461
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
Conversation
Hey there @emontnemery, @bdraco, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
22ac94e
to
f984795
Compare
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.
Some initial comments
self._subentry_data = cast( | ||
MqttSubentryData, deepcopy(dict(reconfigure_subentry.data)) | ||
) |
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.
Interesting, should ConfigSubentryFlow
be a generic? Maybe ConfigFlow
and OptionFlow
should also be generics?
(For separate PRs though)
d335b16
to
21f5c1e
Compare
tests/components/mqtt/common.py
Outdated
MOCK_SUBENTRY_SENSOR_COMPONENT = { | ||
"sensor_bla789": { | ||
"platform": "sensor", | ||
"name": "Test sensor", | ||
"qos": 1, | ||
"state_topic": "test-topic3", | ||
"entity_picture": "https://example.com/sensor_bla789", | ||
}, | ||
} | ||
|
||
MOCK_SUBENTRY_LIGHT_COMPONENT = { | ||
"light_bla0ab": { | ||
"platform": "light", | ||
"name": "Test light", | ||
"qos": 1, | ||
"command_topic": "test-topic4", | ||
"schema": "basic", | ||
"entity_picture": "https://example.com/light_bla0ab", | ||
}, | ||
} |
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.
Isn't it a little bit weird to introduce things from the future like this? 🤔
Maybe in this PR do two notify entities, and then replace with or add other entities when they are supported?
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.
They were there for code coverage of these 4 lines:
and
I'll keep the light but add a note
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 few more minor comments. This is starting to look really good 👍
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.
Awesome, thanks a lot @jbouwh 👍
Thank you too! |
}, | ||
"entity": { | ||
"title": "Configure MQTT device \"{mqtt_device}\"", | ||
"description": "Configure the basic {platform_label}entity settings{entity_name_label}", |
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.
It looks like there are two space characters missing here around "entity settings"?
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.
They are there on purpose to allow inserting the platform and entity label if they are known, or to omit them if they are not available yet.
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.
Ah OK, the spaces are added via the variables. We need to know that for proper translation, because in German there would be a hyphen in the middle of "Plattform-Entität".
Then I remove that hyphen as another translator was already faster and added one there.
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.
Ah OK, the spaces are added via the variables. We need to know that for proper translation, because in German there would be a hyphen in the middle of "Plattform-Entität".
Then I remove that hyphen as another translator was already faster and added one there.
Right. I'd rather had proper working constant selectors, but we ended up here. The inserted variables will, if set take care of spaces.
Like:
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 went with:
"Konfiguriere die grundlegenden Einstellungen der {platform_label}Entität{entity_name_label}"
That should work with and without a platform inserted.
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.
Looks good!
Proposed change
Add initial MQTT subentry support for notify entities
In MVP is support for Notify entities. Not included yet is is availability support. This is planned with #138673
Type of change
Additional information
Checklist
ruff format 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
.To help with the load of incoming pull requests: