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:
Jan Bouwhuis 2023-02-21 22:28:27 +01:00 committed by GitHub
parent 234fd01d65
commit 34e70778a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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."""
...
```