ph_mqttunsub PowerHome formula function
Description
Allows the specified PowerHome MQTT
controller to unsubscribe
from topics
Syntax
ph_mqttunsub ( as_ctlr, as_topic, ai_type )
Argument | Description |
as_ctlr | String. The ID of the PowerHome MQTT controller |
as_topic | String. The topic you wish to unsubscribe from |
ai_type | Integer. Specifies how the unsubscription
request is handled within PowerHome. A value of 0 will queue the request
with the specified controller. Any other value will cause the the
controller to immediately send the unsubscribe request and receive
feedback of success/failure |
Return value
Integer. Returns 0
if request to unsubscribe was queued successfully when ai_type =
0. Returns 0 if topic unsubscribe was successful when ai_type
<> 0. Returns -1 if the controller ID is not found. Returns -51 if
the command is not supported by the controller. Returns -11 if an error occurs
during unsubscribing from topic when ai_type <> 0
Usage
Use this function
to unsubscribe from MQTT topics using a currently
connected PowerHome MQTT controller. You should only use this function to
unsubscribe from topics that were previously subscribed to with the ph_mqttsub(
) function.
Examples
The following examples demonstrate typical syntax/usage for this function.
• ph_mqttunsub("MQTT","home/1stfloor/+/temperature",0)
- Returns a 0 if the unsubscribe
topic
was successfully
queued.