platypush.backend.nodered

class platypush.backend.nodered.NoderedBackend(port: int = 5051, *args, **kwargs)[source]

This backend publishes platypush actions to a Node-RED instance. If you enable this backend on a host that runs Node-RED then a new block (platypush -> run) can be used in your flows. This block will accept JSON requests as input in the format {"type":"request", "action":"plugin.name.action_name", "args": {...}} and return the output of the action as block output, or raise an exception if the action failed.

Requires:

  • pynodered (pip install pynodered)
__init__(port: int = 5051, *args, **kwargs)[source]
Parameters:port – Listening port for the local publishing web server (default: 5051)
on_stop()[source]

Callback invoked when the process stops

run()[source]

Starts the backend thread. To be implemented in the derived classes if the loop method isn’t defined.