mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-13 20:36:29 +00:00
Add blog post about new signature of HomeAssistant (#1892)
* Add blog post about new signature of HomeAssistant * Update 2023-08-29-homeassistant-changed-signature.md * Update blog/2023-08-29-homeassistant-changed-signature.md Co-authored-by: Joakim Sørensen <joasoe@gmail.com> --------- Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
This commit is contained in:
parent
03abe62825
commit
d482a8e8d3
18
blog/2023-08-29-homeassistant-changed-signature.md
Normal file
18
blog/2023-08-29-homeassistant-changed-signature.md
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
author: Erik Montnémery
|
||||
authorURL: https://github.com/emontnemery
|
||||
title: "HomeAssistant.__init__ requires passing a string to it"
|
||||
---
|
||||
|
||||
The signature of `HomeAssistant.__init__` has been changed from no arguments to require the configuration directory as a string to be passed to it. Scripts, tests etc. outside of the HomeAssistant core repo which create `HomeAssistant` objects will need to be updated.
|
||||
|
||||
The change was introduced in [core PR#98442](https://github.com/home-assistant/core/pull/98442)
|
||||
|
||||
If backwards compatibility is important, this is a way to achieve it:
|
||||
|
||||
```python
|
||||
try:
|
||||
hass = HomeAssistant() # pylint: disable=no-value-for-parameter
|
||||
except TypeError:
|
||||
hass = HomeAssistant(config_dir) # pylint: disable=too-many-function-args
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user