Skip to content

Commit 0cd6923

Browse files
committed
deprecate services.mqtt.publish()
Add DeprecationWarning via warnings.warn() to Services.MQTT.publish(), signaling that Legacy MQTT will be removed in a future major version and users should migrate to the new MQTT connector or HTTP API.
1 parent f1a44ea commit 0cd6923

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • src/tagoio_sdk/modules/Services

src/tagoio_sdk/modules/Services/MQTT.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
from typing import Optional
23
from typing import TypedDict
34
from typing import Union
@@ -20,6 +21,19 @@ class MQTTData(TypedDict):
2021

2122
class MQTT(TagoIOModule):
2223
def publish(self, mqtt: MQTTData) -> str:
24+
"""Publish an MQTT message.
25+
26+
.. deprecated::
27+
Legacy MQTT is deprecated. Use the new MQTT connector or HTTP API instead.
28+
See: https://docs.tago.io/docs/tagoio/integrations/networks/mqtt/
29+
"""
30+
warnings.warn(
31+
"services.mqtt.publish() is deprecated and will be removed in a future major version. "
32+
"Migrate to the new MQTT connector or use the HTTP API. "
33+
"See: https://docs.tago.io/docs/tagoio/integrations/networks/mqtt/",
34+
DeprecationWarning,
35+
stacklevel=2,
36+
)
2337
result = self.doRequest(
2438
{
2539
"path": "/analysis/services/mqtt/publish",

0 commit comments

Comments
 (0)