mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-19 07:16:29 +00:00
Deprecated callback removed for MQTT subscribe (#1692)
* Deprecated callback removed for MQTT subscribe * Update blog/2023-02-21-deprecated-callback-removed.md Co-authored-by: Erik Montnemery <erik@montnemery.com> --------- Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
parent
234fd01d65
commit
34e70778a5
33
blog/2023-02-21-deprecated-callback-removed.md
Normal file
33
blog/2023-02-21-deprecated-callback-removed.md
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
author: Jan Bouwhuis
|
||||
authorURL: https://twitter.com/jbouwh
|
||||
title: Deprecated callback signatures for MQTT subscribe removed
|
||||
---
|
||||
|
||||
Home Assistant's MQTT integration [no longer supports](https://github.com/home-assistant/core/pull/88543)
|
||||
deprecated callback signatures for MQTT subscribe.
|
||||
|
||||
Custome integrations that still used the deprecated callback signature for the callback function on MQTT subscribe will break unless updated. An exception will be raised if a not supported callback type is detected.
|
||||
|
||||
Examples of deprecated callback functions that will no longer work:
|
||||
|
||||
```python
|
||||
async def async_deprecated_callback1(topic: str, payload: ReceivePayloadType, qos: int) -> None:
|
||||
"""Deprecated async callback example 1."""
|
||||
...
|
||||
|
||||
|
||||
@callback
|
||||
def async_deprecated_callback2(topic: str, payload: ReceivePayloadType, qos: int) -> None:
|
||||
"""Deprecated async callback example 2."""
|
||||
...
|
||||
```
|
||||
|
||||
Example of a correct callback signature:
|
||||
|
||||
```python
|
||||
@callback
|
||||
def async_correct_callback(msg: msg: ReceiveMessage) -> None:
|
||||
"""Callback example 1."""
|
||||
...
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user