Add blog about some new features (#1258)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Paulus Schoutsen 2022-03-30 17:17:31 -07:00 committed by GitHub
parent da18c9cbdb
commit 7aeb2a00ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 3 deletions

View File

@ -0,0 +1,37 @@
---
author: Paulus Schoutsen
authorURL: https://twitter.com/balloob
authorImageURL: /img/profile/paulus.jpg
authorTwitter: balloob
title: New features for developers in 2022.4
---
There are a handful of new features for developers in 2022.4.
- [Integration Type]: Integrations can now mark themselves as helper.
- [Backup platform]: Integrations can now pause work during a backup by implementing the new backup platform.
- hidden_by in entity registry: Entities can now be hidden via the entity registry. These entities should default to not be included when exposing entities to an external UI like voice assistants.
- [New and updated selectors]: We added a bunch of new selectors to be used in blueprints, services.yaml, and config flows.
- [Selectors in backend flows]: You can now use the `selector` helper in your config flows. It is configured and renders just like selectors in services.yaml/blueprints.
- [ha-form context]: Context is a new way to allow selectors to be dynamically configured based on values from other fields. Currently only available for the attribute selector.
- [config flow helper text for fields]: Config flow fields can now have a description.
- [Schema Config Flow helper]: New helper to create config flows based on a config schema. [Example implementation](https://github.com/home-assistant/core/blob/dev/homeassistant/components/switch_as_x/config_flow.py)
- [Show Menu step]: This new step in a data entry flow shows a menu to the user.
- [Fan speed]: We introduced a new format and this transition is now completed.
- [Device State Attributes]: Backwards compatibility support for this property has been removed after being deprecated since Home Assistant 2021.4. Use `extra_state_attributes` instead.
- [Cameras without width/height]: The compatbility layer for cameras without width/height has been removed.
- [Calendar offset]: Calendar method signatures for `calculate_offset` and `is_offset_reached` have changed, in preparation for typing improvements in Calendar, and potential simplification of offsets more generally.
[ha-form context]: https://github.com/home-assistant/frontend/pull/12062
[Integration Type]: /docs/creating_integration_manifest
[Backup platform]: /docs/core/platform/backup
[New and updated selectors]: https://next.home-assistant.io/docs/blueprint/selectors/
[Selectors in backend flows]: /docs/data_entry_flow_index#show-form
[config flow helper text for fields]: /docs/data_entry_flow_index#show-form
[Schema Config Flow helper]: https://github.com/home-assistant/core/blob/dev/homeassistant/helpers/schema_config_entry_flow.py
[Show Menu step]: /docs/data_entry_flow_index#show-menu
[Fan speed]: https://github.com/home-assistant/core/pull/67743
[Device State Attributes]: https://github.com/home-assistant/core/pull/67837
[Cameras without width/height]: https://github.com/home-assistant/core/pull/68039
[Calendar offset]: https://github.com/home-assistant/core/pull/68724

View File

@ -48,6 +48,12 @@ For core integrations, this should be omitted.
The version of the integration is required for custom integrations. The version needs to be a valid version recognized by [AwesomeVersion](https://github.com/ludeeus/awesomeversion) like [CalVer](https://calver.org/) or [SemVer](https://semver.org/).
## Integration Type
Define what kind of integration this is. Currently accepted values are `integration` and `helper`. Helpers are integrations that provide entities to help the user with automations like input boolean, derivative or group.
Defaults to `integration` if not set.
## Documentation
The website containing documentation on how to use your integration. If this integration is being submitted for inclusion in Home Assistant, it should be `https://www.home-assistant.io/integrations/<domain>`
@ -286,7 +292,7 @@ For example:
"serial_number": "1234*",
"manufacturer": "*midway*",
"description": "*zigbee*"
},
},
]
}
```

View File

@ -106,9 +106,11 @@ class ExampleConfigFlow(data_entry_flow.FlowHandler):
### Show Form
This result type will show a form to the user to fill in. You define the current step, the schema of the data (using voluptuous) and optionally a dictionary of errors.
This result type will show a form to the user to fill in. You define the current step, the schema of the data (using voluptuous or selectors) and optionally a dictionary of errors.
```python
from homeassistant.helpers.selector import selector
class ExampleConfigFlow(data_entry_flow.FlowHandler):
async def async_step_user(self, user_input=None):
# Specify items in the order they are to be displayed in the UI
@ -118,7 +120,11 @@ class ExampleConfigFlow(data_entry_flow.FlowHandler):
}
if self.show_advanced_options:
data_schema["allow_groups"] = bool
data_schema["allow_groups"] = selector({
"select": {
"options": ["all", "light", "switch"],
}
})
return self.async_show_form(step_id="init", data_schema=vol.Schema(data_schema))
```
@ -173,6 +179,32 @@ class ExampleConfigFlow(data_entry_flow.FlowHandler):
)
```
Translations for the step title, description and fields is added to `strings.json`. Each field can also have an optional entry in `data_description` to add extra explanatory text.
Do not put your brand title in the `title`. It will be automatically injected from your manifest.
Your description should not link to the documentation as that is linked automatically. It should also not contain "basic" information like "Here you can set up X". It can be omitted.
```json
{
"config": {
"step": {
"user": {
"title": "Add Group",
"description": "Some description",
"data": {
"entities": "Entities",
},
"data_description": {
"entities": "The entities to add to the group",
},
}
}
}
}
```
#### Multi-step flows
If the user input passes validation, you can again return one of the three return values. If you want to navigate the user to the next step, return the return value of that step: