make python function to Node-RED node
Project description
NodeRED.py
make python function to Node-RED node
🎛️ requirements
- node.js 18.16.1 or higher(latest stable)
- nodered.py 0.2.6 or higher, automatically download from internet if no node.js installed
- python 3.7 or higher
- tested on
OS | Tested | Pass |
---|---|---|
Mac 13(Ventura) | ✅ | ✅ |
Windows 10 | ✅ | ✅ |
Linux(WSL) | 🚫 |
🌐 install
- using pip
python -m pip install nodered.py
- using git(dev)
python -m pip install git+https://github.com/oyajiDev/NodeRED.py.git
🛠 usage
Node-RED initialize
from noderedpy import RED
red = RED(
os.path.join(__dirname, ".node-red"),
os.path.join(__dirname, "node_red_dir"),
"/node-red", "/", 1880
)
register Node
- register as decorator
- See noredpy.decorator.register function for details
from noderedpy import Node
from noderedpy.decorator import register
@register("test")
def test(node:Node, props:dict, msg:dict) -> dict:
# user codes here
return msg
- register from Node-RED object
- See noredpy.decorator.register function for details
api = API()
red.register("test", api.test)
- See noderedpy._property for details of "Property"
- See example for details.
start Node-RED
red.start({debug:bool}, {callback:MethodType})
Todos
✅ type support for "list" and "dict"
Roadmap To 2.0
✅ remove aiohttp server
🟩 flexible property ui
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nodered.py-0.2.8.tar.gz
(308.2 kB
view hashes)
Built Distribution
nodered.py-0.2.8-py3-none-any.whl
(309.1 kB
view hashes)
Close
Hashes for nodered.py-0.2.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a799725506228a29441ee6c5ff106f02a5c8c07f336391e389b7362facbb3a2 |
|
MD5 | 57c58dbbd46e134175255c56152b28e8 |
|
BLAKE2b-256 | f5622c3cd09cfac1a227c106f0c5db4ddd939891d70ca819db0eb34d5e442eea |