@abstract-entity/node-red-oklyn 中文文档教程
node-red-oklyn
这套node-red节点与oklyn cloud API通信,如果你喜欢我的作品可以给我留言,star github repo and/or buy me a coffee it always pleasant
Install
使用 Node-RED 编辑器菜单中的管理调色板选项,或者在您的Node-RED 用户目录 - 通常为“~/.node-red”
npm i @abstract-entity/node-red-oklyn
Flow example
下面的链接向您展示了每个带有手动触发器的 oklyn 节点的实现
Flow example
API Usage
Configuration
要找到您的 api 密钥,请按照以下步骤操作:
- Open your Oklyn mobile app, and go to 'my account'
- Open 'API Access' at the bottom of page
- Activate API access
- Copy your API key
在 node-red 配置中添加你的 api key:
- Drag any oklyn node in your flow panel
- Double click the node
- For the 'Config' property select 'Add new oklyn-config', then click the 'edit pen'
- Paste your API key in 'Api key' peroperty, then click add
List devices
Configuration
- Name (optionnal): Name to display for the node
- Config (required): Oklyn api key to use for the call
Payload Input
- No particular payload required
< strong>有效载荷输出
输出
[ {"id":228,"用户名":"第一个游泳池"}, {"id":229,"username":"二级家庭游泳池"}, {"id":230,"用户名":"第三游泳池"} ]
Read measures
配置
- Name (optionnal): Name to display for the node
- Config (required): Oklyn api key to use for the call
- Device id (required): Id of the device, if you manage multiple device you can specify the id of device to connect to. if you got only one device use 'my' to select it without knowing id
- Measure (required): Name of the measure to read, can be: air, water, ph, or orp
有效载荷输入
没有预期的特定有效载荷输入.
您可以覆盖节点的设备 ID,方法是将其添加到 msg.deviceId(在有效负载之外)
{ “设备编号”:228 }
有效载荷输出
输出
{ “记录”:“2022-03-06T13:45:04+00:00”, “价值”:8.61, “状态”:“危险”, “原始值”:8.61 }
Read pump state
配置
- Name (optionnal): Name to display for the node
- Config (required): Oklyn api key to use for the call
- Device id (required): Id of the device, if you manage multiple device you can specify the id of device to connect to. if you got only one device use 'my' to select it without knowing id
负载输入
没有预期的特定负载输入。
您可以覆盖节点的设备 ID,方法是将其添加到 msg.deviceId(在有效负载之外)
{ “设备编号”:228 }
负载输出
输出
{ “泵”:“自动”, “状态”:“关闭”, “changed_at”:“2022-03-07T05:00:01+00:00” }
Write pump state
Configuration
- Name (optionnal): Name to display for the node
- Config (required): Oklyn api key to use for the call
- Device id (required): Id of the device, if you manage multiple device you can specify the id of device to connect to. if you got only one device use 'my' to select it without knowing id
Payload Input
您可以通过以下值更改泵的状态:on、off、auto
{ “泵”:“自动” )
您可以覆盖节点的设备 ID,方法是将其添加到 msg.deviceId(在有效负载之外
{ “设备编号”:228 }
负载输出
输出
{ “泵”:“自动”, “状态”:“关闭”, “changed_at”:“2022-03-07T05:00:01+00:00” }
Read auxiliary contact state
Configuration
- Name (optionnal): Name to display for the node
- Config (required): Oklyn api key to use for the call
- Device id (required): Id of the device, if you manage multiple device you can specify the id of device to connect to. if you got only one device use 'my' to select it without knowing id
Payload Input
您可以覆盖节点的设备 ID,方法是将其添加到 msg.deviceId(在有效负载之外)
{ “设备编号”:228 }
负载输出
输出
{ “辅助”:“关闭”, “状态”:“关闭”, “changed_at”:“2022-03-07T08:49:40+00:00” }
Write auxiliary contact state
Configuration
- Name (optionnal): Name to display for the node
- Config (required): Oklyn api key to use for the call
- Device id (required): Id of the device, if you manage multiple device you can specify the id of device to connect to. if you got only one device use 'my' to select it without knowing id
Payload Input
您可以通过以下值更改辅助触点的状态:on、off
{ “辅助”:“关闭” )
您可以覆盖节点的设备 ID,方法是将其添加到 msg.deviceId(在有效负载之外
{ “设备编号”:228 }
负载输出
输出
{ “辅助”:“关闭”, “状态”:“关闭”, “changed_at”:“2022-03-07T08:49:40+00:00” }
node-red-oklyn
This set of node-red nodes communicate with oklyn cloud API, if you like my work you can leave me a message, star github repo and/or buy me a coffee it's always pleasant
Install
Either use the Manage Palette option in the Node-RED Editor menu, or run the following command in your Node-RED user directory - typically '~/.node-red'
npm i @abstract-entity/node-red-oklyn
Flow example
Link below show you an implementation of each oklyn node with manual trigger
Flow example
API Usage
Configuration
To find your api key follow this steps:
- Open your Oklyn mobile app, and go to 'my account'
- Open 'API Access' at the bottom of page
- Activate API access
- Copy your API key
To add your api key in node-red configuration:
- Drag any oklyn node in your flow panel
- Double click the node
- For the 'Config' property select 'Add new oklyn-config', then click the 'edit pen'
- Paste your API key in 'Api key' peroperty, then click add
List devices
Configuration
- Name (optionnal): Name to display for the node
- Config (required): Oklyn api key to use for the call
Payload Input
- No particular payload required
Payload output
output
[ {"id":228,"username":"first swimming pool"}, {"id":229,"username":"Secondary home swimming pool"}, {"id":230,"username":"Third swimming pool"} ]
Read measures
Configuration
- Name (optionnal): Name to display for the node
- Config (required): Oklyn api key to use for the call
- Device id (required): Id of the device, if you manage multiple device you can specify the id of device to connect to. if you got only one device use 'my' to select it without knowing id
- Measure (required): Name of the measure to read, can be: air, water, ph, or orp
Payload Input
No particular payload input expected.
You can override device id of the node, by adding it to msg.deviceId (outside of the payload)
{ "deviceId": 228 }
Payload output
output
{ "recorded": "2022-03-06T13:45:04+00:00", "value": 8.61, "status": "danger", "value_raw": 8.61 }
Read pump state
Configuration
- Name (optionnal): Name to display for the node
- Config (required): Oklyn api key to use for the call
- Device id (required): Id of the device, if you manage multiple device you can specify the id of device to connect to. if you got only one device use 'my' to select it without knowing id
Payload Input
No particular payload input expected.
You can override device id of the node, by adding it to msg.deviceId (outside of the payload)
{ "deviceId": 228 }
Payload output
output
{ "pump": "auto", "status": "off", "changed_at": "2022-03-07T05:00:01+00:00" }
Write pump state
Configuration
- Name (optionnal): Name to display for the node
- Config (required): Oklyn api key to use for the call
- Device id (required): Id of the device, if you manage multiple device you can specify the id of device to connect to. if you got only one device use 'my' to select it without knowing id
Payload Input
You can change the state of the pump by following values: on, off, auto
{ "pump": "auto" }
You can override device id of the node, by adding it to msg.deviceId (outside of the payload)
{ "deviceId": 228 }
Payload output
output
{ "pump": "auto", "status": "off", "changed_at": "2022-03-07T05:00:01+00:00" }
Read auxiliary contact state
Configuration
- Name (optionnal): Name to display for the node
- Config (required): Oklyn api key to use for the call
- Device id (required): Id of the device, if you manage multiple device you can specify the id of device to connect to. if you got only one device use 'my' to select it without knowing id
Payload Input
You can override device id of the node, by adding it to msg.deviceId (outside of the payload)
{ "deviceId": 228 }
Payload output
output
{ "aux": "off", "status": "off", "changed_at": "2022-03-07T08:49:40+00:00" }
Write auxiliary contact state
Configuration
- Name (optionnal): Name to display for the node
- Config (required): Oklyn api key to use for the call
- Device id (required): Id of the device, if you manage multiple device you can specify the id of device to connect to. if you got only one device use 'my' to select it without knowing id
Payload Input
You can change the state of the auxiliary contact by following values: on, off
{ "aux": "off" }
You can override device id of the node, by adding it to msg.deviceId (outside of the payload)
{ "deviceId": 228 }
Payload output
output
{ "aux": "off", "status": "off", "changed_at": "2022-03-07T08:49:40+00:00" }