Difference between revisions of "MQTT-flex"
(Created page with "MQTT is implemented as M2M API protocol, where NETIO device is publisher providing output status and subscriber allowing control of NETIO power outputs (power sockets 230V or...") |
|||
Line 83: | Line 83: | ||
• netio/<DEVICE_NAME>/output/1/state with payload providing output 1 state value - published when the output state change | • netio/<DEVICE_NAME>/output/1/state with payload providing output 1 state value - published when the output state change | ||
• netio/<DEVICE_NAME>/output/1/load with payload providing actual load of output 1 – published every 1111 seconds or when load change by 1W | • netio/<DEVICE_NAME>/output/1/load with payload providing actual load of output 1 – published every 1111 seconds or when load change by 1W | ||
+ | |||
+ | MQTT is implemented as M2M API protocol, where NETIO device is publisher providing output status and subscriber allowing control of NETIO power outputs (power sockets 230V or power outlets | ||
+ | IEC-320 110/230V). With MQTT-flex the users can easily define the MQTT topics and payloads. | ||
+ | |||
+ | PowerCable firmware – 2.1.0 and later | ||
+ | |||
+ | |||
+ | Config example | ||
+ | { | ||
+ | "config":{ | ||
+ | "broker":{ | ||
+ | "url":"broker.hivemq.com", | ||
+ | "protocol":"mqtt", | ||
+ | "port":1883, | ||
+ | "ssl":false, | ||
+ | "type":"generic", | ||
+ | "username":"freedom", | ||
+ | "password":"peace|LOVE|empathy4ALL" | ||
+ | }, | ||
+ | "subscribe":[ | ||
+ | { | ||
+ | "topic":"netio/${DEVICE_NAME}/output/1/action", | ||
+ | "qos":0, | ||
+ | "target":"OUTPUTS/1/ACTION", | ||
+ | "action":"${payload}" | ||
+ | } | ||
+ | ], | ||
+ | "publish":[ | ||
+ | { | ||
+ | "topic":"netio/${DEVICE_NAME}/output/1/state", | ||
+ | "qos":0, | ||
+ | "retain":true, | ||
+ | "payload":"${OUTPUTS/1/STATE}", | ||
+ | "events":[ | ||
+ | { | ||
+ | "type":"change", | ||
+ | "source":"OUTPUTS/1/STATE" | ||
+ | } | ||
+ | ] | ||
+ | }, | ||
+ | { | ||
+ | "topic":"netio/${DEVICE_NAME}/output/1/load", | ||
+ | "qos":0, | ||
+ | "retain":false, | ||
+ | "payload":"${OUTPUTS/1/LOAD}", | ||
+ | "events":[ | ||
+ | { | ||
+ | "type":"timer", | ||
+ | "period":1111 | ||
+ | }, | ||
+ | { | ||
+ | "type":"delta", | ||
+ | "source":"OUTPUTS/1/LOAD", | ||
+ | "delta":1 | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | |||
+ | description/details: | ||
+ | |||
+ | Broker section | ||
+ | |||
+ | Parameters: | ||
+ | Item Description Example/values | ||
+ | url MQTT broker URL broker.hivemq.com (mqtts://broker.your-lovely-domain.com - to connect to SSL capable MQTT broker) | ||
+ | Port MQTT broker port 1883 | ||
+ | Ssl SSL security selector [false|true] | ||
+ | Type Communication/setup type option [generic] (reserved for future use) | ||
+ | username Credentials for MQTT broker - username freedom | ||
+ | password Credentials for MQTT broker - password peace|LOVE|empathy4ALL | ||
+ | clientid [optional] MQTT clientid. Max. 32 characters. Variables ${DEVICE_MAC} or ${DEVICE_NAME} can be used. myUniqueID1234 | ||
+ | keepalive [optional] MQTT keep alive period in seconds 90 | ||
+ | |||
+ | Subscribe topic for control of the output: | ||
+ | |||
+ | • netio/<DEVICE_NAME>/output/1/action with payload for output control : (0 – off, 1 – on, 2 – short off, 3 – short on, 4 – toggle, 5 – no change) | ||
+ | |||
+ | Publish topics for monitoring of the output state and load: | ||
+ | |||
+ | • netio/<DEVICE_NAME>/output/1/state with payload providing output 1 state value - published when the output state change | ||
+ | • netio/<DEVICE_NAME>/output/1/load with payload providing actual load of output 1 – published every 1111 seconds or when load change by 1W | ||
+ | |||
+ | possible source: | ||
+ | |||
+ | OUTPUTS/X/VOLTAGE", | ||
+ | OUTPUTS/X/CURRENT" | ||
+ | OUTPUTS/X/POWER_FACTOR .exp = 100, .div = 1}, | ||
+ | OUTPUTS/X/LOAD .exp = 1, .div = 1000}, | ||
+ | OUTPUTS/X/STATE | ||
+ | OUTPUTS/X/ACTION | ||
+ | OUTPUTS/X/DELAY &uintValidator, .exp = 1, .div = 1 | ||
+ | OUTPUTS/X/NAME", | ||
+ | OUTPUTS/X/FREQUENCY", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 1, .div = 1000}, | ||
+ | OUTPUTS/X/ENERGY", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 1, .div = 10}, | ||
+ | OUTPUTS/X/ENERGY_START", | ||
+ | OUTPUTS/X/ENERGY_START_FMT", | ||
+ | OUTPUTS/TOTAL/ENERGY", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 1, .div = 10}, | ||
+ | OUTPUTS/TOTAL/LOAD", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 1, .div = 1000}, | ||
+ | OUTPUTS/TOTAL/CURRENT" | ||
+ | OUTPUTS/TOTAL/VOLTAGE", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 1, .div = 100}, | ||
+ | OUTPUTS/TOTAL/POWER_FACTOR", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 100, .div = 1}, | ||
+ | OUTPUTS/TOTAL/FREQUENCY", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 1, .div = 1000}, | ||
+ | |||
+ | available variables: | ||
+ | |||
+ | DEVICE_NAME | ||
+ | DEVICE_MAC | ||
+ | BRAND_NAME | ||
+ | BRAND_TYPE |
Revision as of 12:26, 17 July 2019
MQTT is implemented as M2M API protocol, where NETIO device is publisher providing output status and subscriber allowing control of NETIO power outputs (power sockets 230V or power outlets IEC-320 110/230V). With MQTT-flex the users can easily define the MQTT topics and payloads.
PowerCable firmware – 2.1.0 and later
Config example
{
"config":{ "broker":{ "url":"broker.hivemq.com", "protocol":"mqtt", "port":1883, "ssl":false, "type":"generic", "username":"freedom", "password":"peace|LOVE|empathy4ALL" }, "subscribe":[ { "topic":"netio/${DEVICE_NAME}/output/1/action", "qos":0, "target":"OUTPUTS/1/ACTION", "action":"${payload}" } ], "publish":[ { "topic":"netio/${DEVICE_NAME}/output/1/state", "qos":0, "retain":true, "payload":"${OUTPUTS/1/STATE}", "events":[ { "type":"change", "source":"OUTPUTS/1/STATE" } ] }, { "topic":"netio/${DEVICE_NAME}/output/1/load", "qos":0, "retain":false, "payload":"${OUTPUTS/1/LOAD}", "events":[ { "type":"timer", "period":1111 }, { "type":"delta", "source":"OUTPUTS/1/LOAD", "delta":1 } ] } ] }
}
description/details:
Broker section
Parameters: Item Description Example/values url MQTT broker URL broker.hivemq.com Protocol Protocol used for communication with broker [mqtt] Port MQTT broker port 1883 Ssl SSL security selector [false|true] Type Communication/setup type option [generic] username Credentials for MQTT broker - username freedom password Credentials for MQTT broker - password peace|LOVE|empathy4ALL clientid [optional] MQTT clientid. Max. 32 characters. Variables ${MAC} or ${DEVICE_NAME} can be used. myUniqueID1234 keepalive [optional] MQTT keep alive period in seconds 90
Subscribe topic for control of the output:
• netio/<DEVICE_NAME>/output/1/action with payload for output control : (0 – off, 1 – on, 2 – short off, 3 – short on, 4 – toggle, 5 – no change)
Publish topics for monitoring of the output state and load:
• netio/<DEVICE_NAME>/output/1/state with payload providing output 1 state value - published when the output state change • netio/<DEVICE_NAME>/output/1/load with payload providing actual load of output 1 – published every 1111 seconds or when load change by 1W
MQTT is implemented as M2M API protocol, where NETIO device is publisher providing output status and subscriber allowing control of NETIO power outputs (power sockets 230V or power outlets IEC-320 110/230V). With MQTT-flex the users can easily define the MQTT topics and payloads.
PowerCable firmware – 2.1.0 and later
Config example
{
"config":{ "broker":{ "url":"broker.hivemq.com", "protocol":"mqtt", "port":1883, "ssl":false, "type":"generic", "username":"freedom", "password":"peace|LOVE|empathy4ALL" }, "subscribe":[ { "topic":"netio/${DEVICE_NAME}/output/1/action", "qos":0, "target":"OUTPUTS/1/ACTION", "action":"${payload}" } ], "publish":[ { "topic":"netio/${DEVICE_NAME}/output/1/state", "qos":0, "retain":true, "payload":"${OUTPUTS/1/STATE}", "events":[ { "type":"change", "source":"OUTPUTS/1/STATE" } ] }, { "topic":"netio/${DEVICE_NAME}/output/1/load", "qos":0, "retain":false, "payload":"${OUTPUTS/1/LOAD}", "events":[ { "type":"timer", "period":1111 }, { "type":"delta", "source":"OUTPUTS/1/LOAD", "delta":1 } ] } ] }
}
description/details:
Broker section
Parameters: Item Description Example/values url MQTT broker URL broker.hivemq.com (mqtts://broker.your-lovely-domain.com - to connect to SSL capable MQTT broker) Port MQTT broker port 1883 Ssl SSL security selector [false|true] Type Communication/setup type option [generic] (reserved for future use) username Credentials for MQTT broker - username freedom password Credentials for MQTT broker - password peace|LOVE|empathy4ALL clientid [optional] MQTT clientid. Max. 32 characters. Variables ${DEVICE_MAC} or ${DEVICE_NAME} can be used. myUniqueID1234 keepalive [optional] MQTT keep alive period in seconds 90
Subscribe topic for control of the output:
• netio/<DEVICE_NAME>/output/1/action with payload for output control : (0 – off, 1 – on, 2 – short off, 3 – short on, 4 – toggle, 5 – no change)
Publish topics for monitoring of the output state and load:
• netio/<DEVICE_NAME>/output/1/state with payload providing output 1 state value - published when the output state change • netio/<DEVICE_NAME>/output/1/load with payload providing actual load of output 1 – published every 1111 seconds or when load change by 1W
possible source:
OUTPUTS/X/VOLTAGE", OUTPUTS/X/CURRENT" OUTPUTS/X/POWER_FACTOR .exp = 100, .div = 1}, OUTPUTS/X/LOAD .exp = 1, .div = 1000}, OUTPUTS/X/STATE OUTPUTS/X/ACTION OUTPUTS/X/DELAY &uintValidator, .exp = 1, .div = 1 OUTPUTS/X/NAME", OUTPUTS/X/FREQUENCY", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 1, .div = 1000}, OUTPUTS/X/ENERGY", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 1, .div = 10}, OUTPUTS/X/ENERGY_START", OUTPUTS/X/ENERGY_START_FMT", OUTPUTS/TOTAL/ENERGY", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 1, .div = 10}, OUTPUTS/TOTAL/LOAD", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 1, .div = 1000}, OUTPUTS/TOTAL/CURRENT" OUTPUTS/TOTAL/VOLTAGE", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 1, .div = 100}, OUTPUTS/TOTAL/POWER_FACTOR", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 100, .div = 1}, OUTPUTS/TOTAL/FREQUENCY", .param = nullptr, .translateFunc = nullptr, .validator = nullptr, .exp = 1, .div = 1000},
available variables:
DEVICE_NAME DEVICE_MAC BRAND_NAME BRAND_TYPE