zwave.mqtt

Platypush documentation

zwave.mqtt#

Description#

This plugin allows you to manage a Z-Wave network over MQTT through zwave-js-ui.

Configuration required on the zwave-js-ui gateway:

  • Install the gateway following the instructions reported here.

  • Configure the following settings from the zwave-js-ui web panel:

    • Zwave -> Serial Port: The path to your Z-Wave adapter.

    • Disabled MQTT Gateway: Set to false.

    • Configure the MQTT server that should be used by the service.

    • Mqtt -> Name: Unique name that identifies your gateway.

    • Mqtt -> Prefix: Prefix name for the topics published to MQTT.

    • Gateway -> Topic type: Set to “ValueID topics”.

    • Gateway -> Payload type: Set to “JSON Time-Value”.

    • Gateway -> Use nodes name instead of numeric nodeIDs: Set to false.

    • Gateway -> Send Zwave Events: Set to true.

    • Gateway -> Include Node Info: Set to true.

param tls_cafile:

If the connection requires TLS/SSL, specify the certificate authority file (default: None)

Configuration#

zwave.mqtt:
  # [Required]
  # Gateway name, as configured from the zwavejs2mqtt web
  # panel from Mqtt -> Name.
  name:   # type=str

  # [Optional]
  # MQTT broker host, as configured from the zwavejs2mqtt web
  # panel from Mqtt -> Host
  # host:   # type=str

  # [Optional]
  # MQTT broker listen port, as configured from the
  # zwavejs2mqtt web panel from Mqtt -> Port (default: 1883).
  # port: 1883  # type=int

  # [Optional]
  # MQTT topic prefix, as specified from the
  # zwavejs2mqtt web panel from Mqtt -> Prefix (default: ``zwave``).
  # topic_prefix: zwave  # type=str

  # [Optional]
  # If the command expects from a response, then this
  # timeout value will be used (default: 10 seconds).
  # timeout: 10  # type=int

  # [Optional]
  # If the connection requires TLS/SSL, specify the
  # certificate file (default: None)
  # tls_certfile:   # type=Optional[str]

  # [Optional]
  # If the connection requires TLS/SSL, specify the key
  # file (default: None)
  # tls_keyfile:   # type=Optional[str]

  # [Optional]
  # If the connection requires TLS/SSL, specify the
  # minimum TLS supported version (default: None)
  # tls_version:   # type=Optional[str]

  # [Optional]
  # If the connection requires TLS/SSL, specify the
  # supported ciphers (default: None)
  # tls_ciphers:   # type=Optional[str]

  # [Optional]
  # If the connection requires user authentication,
  # specify the username (default: None)
  # username:   # type=Optional[str]

  # [Optional]
  # If the connection requires user authentication,
  # specify the password (default: None)
  # password:   # type=Optional[str]

  # [Optional]
  # If a default ``host`` is specified, then this list will
  # include a default list of topics that should be subscribed on that
  # broker at startup.
  # topics:   # type=Optional[Iterable[str]]

  # [Optional]
  # If a default host is set and requires TLS/SSL,
  # specify the certificate authority file (default: None)
  # tls_cafile:   # type=Optional[str]

  # [Optional]
  # Set to True to ignore TLS insecure warnings
  # (default: False).
  # tls_insecure: False  # type=bool

  # [Optional]
  # ID used to identify the client on the MQTT server
  # (default: None). If None is specified then
  # ``Config.get('device_id')`` will be used.
  # client_id:   # type=Optional[str]

  # [Optional]
  # If specified, the MQTT plugin will listen for
  # messages on a topic in the format `{run_topic_prefix}/{device_id}.
  # When a message is received, it will interpret it as a JSON request
  # to execute, in the format
  # ``{"type": "request", "action": "plugin.action", "args": {...}}``.
  #
  # .. warning:: This parameter is mostly kept for backwards
  #     compatibility, but you should avoid it - unless the MQTT broker
  #     is on a personal safe network that you own, or it requires
  #     user authentication and it uses SSL. The reason is that the
  #     messages received on this topic won't be subject to token
  #     verification, allowing unauthenticated arbitrary command
  #     execution on the target host. If you still want the ability of
  #     running commands remotely over an MQTT broker, then you may
  #     consider creating a dedicated topic listener with an attached
  #     event hook on
  #     `MQTTMessageEvent <https://docs.platypush.tech/platypush/events/mqtt.html#platypush.message.event.mqtt.MQTTMessageEvent>`_. The
  #     hook can implement whichever authentication logic you like.
  # run_topic_prefix:   # type=Optional[str]

  # [Optional]
  # If specified, the MQTT plugin will listen for
  # messages on these topics. Use this parameter if you also want to
  # listen on other MQTT brokers other than the primary one. This
  # parameter supports a list of maps, where each item supports the
  # same arguments passed to the main configuration (host, port, topic,
  # password etc.). If host/port are omitted, then the host/port value
  # from the plugin configuration will be used. If any of the other
  # fields are omitted, then their default value will be used (usually
  # null). Example:
  #
  #     .. code-block:: yaml
  #
  #         listeners:
  #             # This listener use the default configured host/port
  #             - topics:
  #                   - topic1
  #                   - topic2
  #                   - topic3
  #
  #             # This will use a custom MQTT broker host
  #             - host: sensors
  #               port: 11883
  #               username: myuser
  #               password: secret
  #               topics:
  #                   - topic4
  #                   - topic5
  # listeners:   # type=Optional[Iterable[dict]]

  # [Optional]
  # How often the `RunnablePlugin.loop <https://docs.platypush.tech/platypush/plugins/.html#platypush.plugins.RunnablePlugin.loop>`_ function should be
  # executed (default: 15 seconds). *NOTE*: For back-compatibility
  # reasons, the `poll_seconds` argument is also supported, but it's
  # deprecated.
  # poll_interval: 15  # type=Optional[float]

  # [Optional]
  # How long we should wait for any running
  # threads/processes to stop before exiting (default: 5 seconds).
  # stop_timeout: 5  # type=Optional[float]

  # [Optional]
  # If set to True then the plugin will not monitor
  # for new events. This is useful if you want to run a plugin in
  # stateless mode and only leverage its actions, without triggering any
  # events. Defaults to False.
  # disable_monitor: False  # type=bool

Dependencies#

pip

pip install paho-mqtt

Debian

apt install python3-paho-mqtt

Alpine

apk add py3-paho-mqtt

Fedora

yum install python-paho-mqtt

Arch Linux

pacman -S python-paho-mqtt

Triggered events#

Actions#

Module reference#

class platypush.plugins.zwave.mqtt.ZwaveMqttPlugin(*_, **__)[source]#

Bases: MqttPlugin, RunnablePlugin, DimmerEntityManager, EnumSwitchEntityManager, LightEntityManager, SensorEntityManager, SwitchEntityManager

This plugin allows you to manage a Z-Wave network over MQTT through zwave-js-ui.

Configuration required on the zwave-js-ui gateway:

  • Install the gateway following the instructions reported here.

  • Configure the following settings from the zwave-js-ui web panel:

    • Zwave -> Serial Port: The path to your Z-Wave adapter.

    • Disabled MQTT Gateway: Set to false.

    • Configure the MQTT server that should be used by the service.

    • Mqtt -> Name: Unique name that identifies your gateway.

    • Mqtt -> Prefix: Prefix name for the topics published to MQTT.

    • Gateway -> Topic type: Set to “ValueID topics”.

    • Gateway -> Payload type: Set to “JSON Time-Value”.

    • Gateway -> Use nodes name instead of numeric nodeIDs: Set to false.

    • Gateway -> Send Zwave Events: Set to true.

    • Gateway -> Include Node Info: Set to true.

__init__(name: str, host: str, port: int = 1883, topic_prefix: str = 'zwave', timeout: int = 10, tls_certfile: str | None = None, tls_keyfile: str | None = None, tls_version: str | None = None, tls_ciphers: str | None = None, username: str | None = None, password: str | None = None, **kwargs)[source]#
Parameters:
  • name – Gateway name, as configured from the zwavejs2mqtt web panel from Mqtt -> Name.

  • host – MQTT broker host, as configured from the zwavejs2mqtt web panel from Mqtt -> Host

  • port – MQTT broker listen port, as configured from the zwavejs2mqtt web panel from Mqtt -> Port (default: 1883).

  • topic_prefix – MQTT topic prefix, as specified from the zwavejs2mqtt web panel from Mqtt -> Prefix (default: zwave).

  • timeout – If the command expects from a response, then this timeout value will be used (default: 10 seconds).

  • tls_cafile – If the connection requires TLS/SSL, specify the certificate authority file (default: None)

  • tls_certfile – If the connection requires TLS/SSL, specify the certificate file (default: None)

  • tls_keyfile – If the connection requires TLS/SSL, specify the key file (default: None)

  • tls_version – If the connection requires TLS/SSL, specify the minimum TLS supported version (default: None)

  • tls_ciphers – If the connection requires TLS/SSL, specify the supported ciphers (default: None)

  • username – If the connection requires user authentication, specify the username (default: None)

  • password – If the connection requires user authentication, specify the password (default: None)

activate_scene(scene_id: int | None = None, scene_label: str | None = None, **kwargs)[source]#

Activate a scene.

Parameters:
add_node(name: str, location: str = '', do_security: bool = False, timeout: int = 30, **kwargs)[source]#

Start the inclusion process to add a node to the network.

Parameters:
  • name – Name of the node to be added.

  • location – Location of the node (default: empty).

  • do_security – Whether to initialize the Network Key on the device if it supports the Security CC

  • timeout – How long the inclusion process should last, in seconds (default: 30). Specify zero or null for no timeout.

  • kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

add_node_to_group(group_id: str | None = None, node_id: int | None = None, endpoint: int | None = None, **kwargs)[source]#

Add a node to a group.

Parameters:
  • group_id – Group ID.

  • node_id – Node ID to be added.

  • endpoint – Add a specific endpoint of the node to the group (default: add a node association).

  • kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

controller_status(**kwargs) Dict[str, Any][source]#

Get the status of the controller.

Parameters:

kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

create_scene(label: str, **kwargs)[source]#

Create a new scene.

Parameters:
get_battery_levels(node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str, Any][source]#

Get the battery levels of a node or of all the nodes on the network.

Parameters:
get_bulbs(node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str, Any][source]#

Get the bulbs/LEDs on the network or associated to a node.

Parameters:
get_dimmers(node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str, Any][source]#

Get the dimmers on the network or associated to a node.

Parameters:
get_doorlocks(node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str, Any][source]#

Get the doorlocks on the network or associated to a node.

Parameters:
get_groups(**kwargs) Dict[str | int, dict][source]#

Get the groups on the network.

Parameters:

kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

Returns:

A list of the available groups. Example:

{
  "2-2": {
    "label": "Motion",
    "multichannel": true,
    "max_associations": 10,
    "group_id": "2-2",
    "node_id": 2,
    "index": 2,
    "associations": [
      3,
      4
    ]
  },
  "5-3": {
    "label": "Tamper",
    "multichannel": true,
    "max_associations": 10,
    "group_id": "5-3",
    "node_id": 5,
    "index": 3,
    "associations": [
      2,
      3,
      4
    ]
  }
]

get_locks(node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str, Any][source]#

Get the locks on the network or associated to a node.

Parameters:
get_node_config(node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str, Any][source]#

Get the configuration values of a node or of all the nodes on the network.

Parameters:
get_nodes(node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str | int, dict] | None[source]#

Get the nodes associated to the network.

Parameters:
Returns:

List of paired devices. Example output:

{
  "1": {
    "node_id": 1,
    "device_id": "0115-0400-0001",
    "name": "Controller",
    "capabilities": [
      "beaming",
      "routing"
    ],
    "manufacturer_id": "0x0115",
    "manufacturer_name": "Z-Wave.Me",
    "location": "Living Room",
    "status": "Alive",
    "is_available": true,
    "is_awake": true,
    "is_beaming_device": true,
    "is_controller": true,
    "is_failed": false,
    "is_frequent_listening_device": false,
    "is_info_received": true,
    "is_initialized": true,
    "is_listening_device": true,
    "is_ready": true,
    "is_routing_device": true,
    "is_security_device": false,
    "is_sleeping": false,
    "last_update": "2021-04-05T19:38:07.202000",
    "product_id": null,
    "product_type": null,
    "product_name": "UZB Z-Wave USB Stick",
    "baud_rate": 100000,
    "max_baud_rate": null,
    "device_class": {
      "basic": 2,
      "generic": 2,
      "specific": 1
    },
    "specific": 1,
    "firmware_version": null,
    "keep_awake": false,
    "db_link": "https://devices.zwave-js.io/?jumpTo=0x0115:0x0400:0x0001:0.0",
    "zwave_plus_version": null,
    "zwave_plus_node_type": null,
    "zwave_plus_role_type": null,
    "neighbours": [
      3,
      4
    ],
    "groups": {},
    "values": {}
  },
  "4": {
    "node_id": 4,
    "device_id": "010f-0602-1003",
    "name": "TV Switch",
    "capabilities": [
      "beaming",
      "routing",
      "zwave_plus"
    ],
    "manufacturer_id": "0x010f",
    "manufacturer_name": "FibaroGroup",
    "location": "Living Room",
    "status": "Alive",
    "is_available": true,
    "is_awake": true,
    "is_beaming_device": true,
    "is_controller": false,
    "is_failed": false,
    "is_frequent_listening_device": false,
    "is_info_received": true,
    "is_initialized": true,
    "is_listening_device": true,
    "is_ready": true,
    "is_routing_device": true,
    "is_security_device": false,
    "is_sleeping": false,
    "last_update": "2021-04-06T00:07:44.081000",
    "product_id": null,
    "product_type": null,
    "product_name": "Metered Wall Plug Switch",
    "baud_rate": 100000,
    "max_baud_rate": null,
    "device_class": {
      "basic": 4,
      "generic": 16,
      "specific": 1
    },
    "specific": 1,
    "firmware_version": "3.2",
    "keep_awake": false,
    "db_link": "https://devices.zwave-js.io/?jumpTo=0x010f:0x0602:0x1003:3.2",
    "zwave_plus_version": 1,
    "zwave_plus_node_type": 0,
    "zwave_plus_role_type": 5,
    "neighbours": [
      1
    ],
    "groups": {
      "1": {
        "label": "Lifeline",
        "index": 1,
        "multichannel": true,
        "max_associations": 1
      },
      "2": {
        "label": "On/Off (Button)",
        "index": 2,
        "multichannel": true,
        "max_associations": 10
      },
      "3": {
        "label": "On/Off (Power)",
        "index": 3,
        "multichannel": true,
        "max_associations": 10
      }
    },
    "values": {
      "4-37-0-currentValue": {
        "id": "4-37-0-currentValue",
        "id_on_network": "4-37-0-currentValue",
        "value_id": "4-37-0-currentValue",
        "data": true,
        "data_items": null,
        "label": "Current value",
        "property_id": "currentValue",
        "help": null,
        "node_id": 4,
        "parent_id": 4,
        "type": "Bool",
        "default": null,
        "endpoint": 0,
        "stateless": false,
        "command_class": 37,
        "command_class_name": "Binary Switch",
        "units": null,
        "min": null,
        "max": null,
        "is_read_only": true,
        "is_write_only": false,
        "last_update": "2021-04-05T19:38:07.587000"
      }
    }
  }
}

get_power_levels(node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str, Any][source]#

Get the power levels of this node.

Parameters:
get_protections(node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str, Any][source]#

Get the protection-compatible devices on the network or associated to a node.

Parameters:
get_scene_values(scene_id: int | None = None, scene_label: str | None = None, **kwargs) dict[source]#

Get the values associated to a scene.

Parameters:
get_scenes(**kwargs) Dict[str | int, dict][source]#

Get the scenes configured on the network.

Parameters:

kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

Returns:

dict with the following format:

{
  1: {
    "scene_id": 1,
    "label": "Scene 1",
    "values": {
      "4-37-0-targetValue": {
         "node_id": 4,
         "value_id": "4-37-0-targetValue"
         "data": true
      },
      "3-112-0-Temperature": {
        "node_id": 3,
        "value_id": "3-112-0-Temperature",
        "data": true
      }
    }
  }
}

get_sensors(node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str, Any][source]#

Get the sensors on the network or associated to a node.

Parameters:
get_switches(node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str, Any][source]#

Get the switches on the network or associated to a node.

Parameters:
get_thermostats(node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str, Any][source]#

Get the thermostats on the network or associated to a node.

Parameters:
get_usercodes(node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str, Any][source]#

Get the usercodes on the network or associated to a node.

Parameters:
get_value(value_id: str | None = None, id_on_network: str | None = None, value_label: str | None = None, node_id: int | None = None, node_name: str | None = None, **kwargs) Dict[str, Any][source]#

Get a value on the network.

Parameters:
  • value_id – Select by value_id.

  • id_on_network – Select value by id_on_network.

  • value_label – Select value by [node_id/node_name, value_label]

  • node_id – Select value by [node_id/node_name, value_label]

  • node_name – Select value by [node_id/node_name, value_label]

  • kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

hard_reset(**_)[source]#

Perform a hard reset of the controller. It erases its network configuration settings. The controller becomes a primary controller ready to add devices to a new network.

heal(*_, timeout: int | None = 60, **kwargs)[source]#

Heal network by requesting nodes rediscover their neighbours.

Parameters:
  • timeout – Duration of the healing process in seconds (default: 60). Set to zero or null for no timeout.

  • kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

main()[source]#

Implementation of the main loop of the plugin.

node_heal(node_id: int | None = None, node_name: str | None = None, **kwargs)[source]#

Heal network node by requesting the node to rediscover their neighbours.

Parameters:
node_network_update(node_id: int | None = None, node_name: str | None = None, **kwargs)[source]#

Update the controller with network information (same as platypush.plugins.zwave.mqtt.ZwaveMqttPlugin.node_heal()).

Parameters:
node_refresh_info(node_id: int | None = None, node_name: str | None = None, **kwargs)[source]#

Fetch up-to-date information about the node.

Parameters:
node_update_neighbours(node_id: int | None = None, node_name: str | None = None, **kwargs)[source]#

Ask a node to update its neighbours table (same as platypush.plugins.zwave.mqtt.ZwaveMqttPlugin.node_heal()).

Parameters:
off(device: str, *_, **kwargs)[source]#

Turn off a switch on a device.

Parameters:
on(device: str, *_, **kwargs)[source]#

Turn on a switch on a device.

Parameters:
on_exec_message(client: MqttClient, msg)#

Message handler for (legacy) application requests over MQTT.

on_mqtt_message()[source]#

Default MQTT message handler. It forwards a platypush.message.event.mqtt.MQTTMessageEvent event to the bus.

publish(topic: str, msg: Any, qos: int = 0, reply_topic: str | None = None, **mqtt_kwargs)#

Sends a message to a topic.

Parameters:
  • topic – Topic/channel where the message will be delivered

  • msg – Message to be sent. It can be a list, a dict, or a Message object.

  • qos – Quality of Service (_QoS_) for the message - see MQTT QoS (default: 0).

  • reply_topic – If a reply_topic is specified, then the action will wait for a response on this topic.

  • mqtt_kwargs – MQTT broker configuration (host, port, username, password etc.). See __init__() parameters.

publish_entities(entities: Collection[Any] | None, callback: Callable[[Entity], Any] | None = None, **kwargs) Collection[Entity]#

Publishes a list of entities. The downstream consumers include:

It also accepts an optional callback that will be called when each of the entities in the set is flushed to the database.

You usually don’t need to override this class (but you may want to extend transform_entities() instead if your extension doesn’t natively handle Entity objects).

remove_failed_node(node_id: int | None = None, node_name: str | None = None, **kwargs)[source]#

Remove a failed node from the network.

Parameters:
remove_node(timeout: int = 30, **kwargs)[source]#

Remove a node from the network (or, better, start the exclusion process).

Parameters:
  • timeout – How long the exclusion process should last, in seconds (default: 30).

  • kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

remove_node_from_group(group_id: str | None = None, node_id: int | None = None, endpoint: int | None = None, **kwargs)[source]#

Remove a node from a group.

Parameters:
  • group_id – Group ID.

  • node_id – Node ID to be added.

  • endpoint – Node endpoint to remove (default: remove node association).

  • kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

remove_scene(scene_id: int | None = None, scene_label: str | None = None, **kwargs)[source]#

Remove a scene.

Parameters:
replace_failed_node(node_id: int | None = None, node_name: str | None = None, **kwargs)[source]#

Replace a failed node on the network.

Parameters:
request_network_update(node_id: int | None = None, node_name: str | None = None, **kwargs)[source]#

Request a network update to a node.

Parameters:
request_node_neighbour_update(*_, **kwargs)[source]#

Request a neighbours list update.

Parameters:

kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

scene_add_value(data: Any | None = None, value_id: str | None = None, id_on_network: str | None = None, value_label: str | None = None, scene_id: int | None = None, scene_label: str | None = None, node_id: int | None = None, node_name: str | None = None, **kwargs)[source]#

Add a value to a scene.

Parameters:
  • data – Data to set for the value (default: current value data).

  • value_id – Select value by value_id.

  • id_on_network – Select value by id_on_network.

  • value_label – Select value by [node_id/node_name, value_label]

  • node_id – Select value by [node_id/node_name, value_label]

  • node_name – Select value by [node_id/node_name, value_label]

  • scene_id – Select scene by scene_id.

  • scene_label – Select scene by scene label.

  • kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

scene_remove_value(value_id: str | None = None, id_on_network: str | None = None, value_label: str | None = None, scene_id: int | None = None, scene_label: str | None = None, node_id: int | None = None, node_name: str | None = None, **kwargs)[source]#

Remove a value from a scene.

Parameters:
  • value_id – Select value by value_id.

  • id_on_network – Select value by id_on_network.

  • value_label – Select value by [node_id/node_name, value_label]

  • node_id – Select value by [node_id/node_name, value_label]

  • node_name – Select value by [node_id/node_name, value_label]

  • scene_id – Select scene by scene_id.

  • scene_label – Select scene by scene label.

  • kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

send_message(*args, **kwargs)#

Legacy alias for platypush.plugins.mqtt.MqttPlugin.publish().

set(entity: str, value: Any, **kwargs)#

Set the value of an entity.

Parameters:
  • entity – The entity to set the value for. It’s usually the ID of the entity provided by the plugin.

  • value – The value to set the entity to.

set_lights(lights, **kwargs)[source]#

Set the state for one or more Z-Wave lights.

set_node_location(location: str, node_id: int | None = None, node_name: str | None = None, **kwargs)[source]#

Set the location of a node.

Parameters:
  • location – Node location.

  • node_id – Filter by node_id.

  • node_name – Filter by current node name.

  • kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

set_node_name(new_name: str, node_id: int | None = None, node_name: str | None = None, **kwargs)[source]#

Rename a node on the network.

Parameters:
  • new_name – New name for the node.

  • node_id – Filter by node_id.

  • node_name – Filter by current node name.

  • kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

set_value(*args, data=None, value_id: str | None = None, id_on_network: str | None = None, value_label: str | None = None, node_id: int | None = None, node_name: str | None = None, **kwargs)[source]#

Set a value.

Parameters:
  • data – Data to set for the value.

  • value_id – Select value by value_id.

  • id_on_network – Select value by id_on_network.

  • value_label – Select value by [node_id/node_name, value_label]

  • node_id – Select value by [node_id/node_name, value_label]

  • node_name – Select value by [node_id/node_name, value_label]

  • kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

start()#

Start the plugin.

status(*_, **kwargs) Dict[str, Any][source]#

Get the current status of the Z-Wave values.

Parameters:

kwargs – Extra arguments to be passed to platypush.plugins.mqtt.MqttPlugin.publish() (default: query the default configured device).

stop()#

Disconnect all the clients upon plugin stop.

subscribe(topic: str, **mqtt_kwargs)#

Programmatically subscribe to a topic on an MQTT broker.

Messages received on this topic will trigger a platypush.message.event.mqtt.MQTTMessageEvent event that you can subscribe to.

Parameters:
  • topic – Topic to subscribe to.

  • mqtt_kwargs – MQTT broker configuration (host, port, username, password etc.). See __init__() parameters.

toggle(device: str, *_, **kwargs) dict[source]#

Toggle a switch on a device.

Parameters:
transform_entities(entities: Iterable[dict]) Collection[Entity][source]#

This method takes a list of entities in any (plugin-specific) format and converts them into a standardized collection of Entity objects. Since this method is called by publish_entities() before entity updates are published, you may usually want to extend it to pre-process the entities managed by your extension into the standard format before they are stored and published to all the consumers.

unsubscribe(topic: str, **mqtt_kwargs)#

Programmatically unsubscribe from a topic on an MQTT broker.

Parameters:
  • topic – Topic to unsubscribe from.

  • mqtt_kwargs – MQTT broker configuration (host, port, username, password etc.). See __init__() parameters.

wait_stop(timeout=None)#

Wait until a stop event is received.