Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an if clause for all_status #122

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

## [10.13.6] - 2023-06-13
### added support for the shelly cloud "status_all" command which gives a listing of all devices with their status

## [10.13.5] - 2023-06-13
## [10.13.4] - 2023-06-13
### added support for shelly plus wall dimmer - [#115](https://github.com/windkh/node-red-contrib-shelly/issues/115)
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -697,13 +697,23 @@ You can get the status of a device by simply triggering the node using a msg.pay
contains the id of the device



```
{
type : 'status',
id : 'your device id here in hex',
}
```

## Listing all devices
Similar to retrieving the status of a device, you can retrieve the status of all devices by changing the type to "status_all" and removing the "id" line:

```
{
type : 'status_all'
}
```


## Relay
You can control relays as follows:
Expand Down
2 changes: 1 addition & 1 deletion examples/cloud.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"id":"24478206439723cf","type":"shelly-cloud","z":"3d8bc5187eb93fc0","server":"46da28b11bef0677","description":"","outputs":1,"x":530,"y":420,"wires":[["87f25c1f03f2ea51"]]},{"id":"af310bf981dcfe86","type":"inject","z":"3d8bc5187eb93fc0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":300,"wires":[["a0a876d89193603d"]]},{"id":"87f25c1f03f2ea51","type":"debug","z":"3d8bc5187eb93fc0","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":420,"wires":[]},{"id":"a0a876d89193603d","type":"function","z":"3d8bc5187eb93fc0","name":"light on","func":"msg.payload = {\n type : 'light',\n channel : 0,\n \n id : '8caab55397c7',\n turn : 'on',\n \n // see also\n // brightness : 0,\n // white : 0,\n // red : 0,\n // green : 0,\n // blue : 0\n // gain : 0\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":300,"wires":[["24478206439723cf"]]},{"id":"c7b829258ab69dcd","type":"function","z":"3d8bc5187eb93fc0","name":"light off","func":"msg.payload = {\n type : 'light',\n channel : 0,\n \n id : '8caab55397c7',\n turn : 'off',\n \n // see also\n // brightness : 0,\n // white : 0,\n // red : 0,\n // green : 0,\n // blue : 0\n // gain : 0\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":340,"wires":[["24478206439723cf"]]},{"id":"efd08433b4011f91","type":"inject","z":"3d8bc5187eb93fc0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":340,"wires":[["c7b829258ab69dcd"]]},{"id":"d34a1e57e41bb6a2","type":"inject","z":"3d8bc5187eb93fc0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":400,"wires":[["0cea585ae5f0fd06"]]},{"id":"0cea585ae5f0fd06","type":"function","z":"3d8bc5187eb93fc0","name":"relay on","func":"msg.payload = {\n type : 'relay',\n channel : 0,\n \n id : 'F13f0d',\n turn : 'on',\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":400,"wires":[["24478206439723cf"]]},{"id":"a4b32cc943d61bc0","type":"function","z":"3d8bc5187eb93fc0","name":"relay off","func":"msg.payload = {\n type : 'relay',\n channel : 0,\n \n id : 'F13f0d',\n turn : 'off',\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":440,"wires":[["24478206439723cf"]]},{"id":"17105d5b43df3bc5","type":"inject","z":"3d8bc5187eb93fc0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":440,"wires":[["a4b32cc943d61bc0"]]},{"id":"2e9574d75fb35f32","type":"comment","z":"3d8bc5187eb93fc0","name":"","info":"// see https://shelly-api-docs.shelly.cloud/cloud-control-api/communication\n","x":120,"y":220,"wires":[]},{"id":"e1dad63c08bc265e","type":"inject","z":"3d8bc5187eb93fc0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":500,"wires":[["0e3b1973509902da"]]},{"id":"0e3b1973509902da","type":"function","z":"3d8bc5187eb93fc0","name":"roller 80%","func":"msg.payload = {\n type : 'roller',\n channel : 0,\n \n id : '...',\n pos : '80',\n \n // see also \n // direction : open close stop\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":500,"wires":[["24478206439723cf"]]},{"id":"ea57af39ee6b7540","type":"inject","z":"3d8bc5187eb93fc0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":540,"wires":[["f35b2c678ad63e3f"]]},{"id":"f35b2c678ad63e3f","type":"function","z":"3d8bc5187eb93fc0","name":"roller 0%","func":"msg.payload = {\n type : 'roller',\n channel : 0,\n \n id : '...',\n pos : '0',\n \n // see also \n // direction : open close stop\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":540,"wires":[["24478206439723cf"]]},{"id":"b0ef6591d077580c","type":"inject","z":"3d8bc5187eb93fc0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":600,"wires":[["2aa48d0dbac7bbb3"]]},{"id":"2aa48d0dbac7bbb3","type":"function","z":"3d8bc5187eb93fc0","name":"relays on","func":"msg.payload = {\n type : 'relays',\n turn : 'on',\n\n devices : [{\n id : 'F13f0d',\n channel : '0',\n }]\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":600,"wires":[["24478206439723cf"]]},{"id":"9053635c722588a3","type":"function","z":"3d8bc5187eb93fc0","name":"relays off","func":"msg.payload = {\n type : 'relays',\n turn : 'off',\n \n devices : [{\n id : 'F13f0d',\n channel : '0',\n }]\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":640,"wires":[["24478206439723cf"]]},{"id":"c8882235791c04c8","type":"inject","z":"3d8bc5187eb93fc0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":640,"wires":[["9053635c722588a3"]]},{"id":"1b1917ab3759932b","type":"inject","z":"3d8bc5187eb93fc0","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":260,"wires":[["fed1f5bb2531b237"]]},{"id":"fed1f5bb2531b237","type":"function","z":"3d8bc5187eb93fc0","name":"status","func":"msg.payload = {\n type : 'status',\n id : '8caab55397c7'\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":260,"wires":[["24478206439723cf"]]},{"id":"46da28b11bef0677","type":"shelly-cloud-server","description":""}]
[{"id":"67151b7d3283ab91","type":"shelly-cloud","z":"8b03c2fe854ef2fd","server":"46da28b11bef0677","description":"","outputs":1,"x":750,"y":440,"wires":[["00ae4e9d02b673b1"]]},{"id":"256e9fe84dc0e6e4","type":"inject","z":"8b03c2fe854ef2fd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":320,"wires":[["4d9b749b5d9aaf79"]]},{"id":"00ae4e9d02b673b1","type":"debug","z":"8b03c2fe854ef2fd","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":440,"wires":[]},{"id":"4d9b749b5d9aaf79","type":"function","z":"8b03c2fe854ef2fd","name":"light on","func":"msg.payload = {\n type : 'light',\n channel : 0,\n \n id : '8caab55397c7',\n turn : 'on',\n \n // see also\n // brightness : 0,\n // white : 0,\n // red : 0,\n // green : 0,\n // blue : 0\n // gain : 0\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":320,"wires":[["67151b7d3283ab91"]]},{"id":"3e2a54b54bbd0912","type":"function","z":"8b03c2fe854ef2fd","name":"light off","func":"msg.payload = {\n type : 'light',\n channel : 0,\n \n id : '8caab55397c7',\n turn : 'off',\n \n // see also\n // brightness : 0,\n // white : 0,\n // red : 0,\n // green : 0,\n // blue : 0\n // gain : 0\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":360,"wires":[["67151b7d3283ab91"]]},{"id":"d6e9efef9cb387c5","type":"inject","z":"8b03c2fe854ef2fd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":360,"wires":[["3e2a54b54bbd0912"]]},{"id":"26011e50fbaeeba6","type":"inject","z":"8b03c2fe854ef2fd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":420,"wires":[["2cad1ff50c2a1666"]]},{"id":"2cad1ff50c2a1666","type":"function","z":"8b03c2fe854ef2fd","name":"relay on","func":"msg.payload = {\n type : 'relay',\n channel : 0,\n \n id : 'F13f0d',\n turn : 'on',\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":420,"wires":[["67151b7d3283ab91"]]},{"id":"2f4f8492e1e2fe82","type":"function","z":"8b03c2fe854ef2fd","name":"relay off","func":"msg.payload = {\n type : 'relay',\n channel : 0,\n \n id : 'F13f0d',\n turn : 'off',\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":460,"wires":[["67151b7d3283ab91"]]},{"id":"01d56d049bd78ea8","type":"inject","z":"8b03c2fe854ef2fd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":460,"wires":[["2f4f8492e1e2fe82"]]},{"id":"396277be24a38f1f","type":"comment","z":"8b03c2fe854ef2fd","name":"","info":"// see https://shelly-api-docs.shelly.cloud/cloud-control-api/communication\n","x":340,"y":160,"wires":[]},{"id":"270440c87cccdb97","type":"inject","z":"8b03c2fe854ef2fd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":520,"wires":[["55bf3e433261a9ae"]]},{"id":"55bf3e433261a9ae","type":"function","z":"8b03c2fe854ef2fd","name":"roller 80%","func":"msg.payload = {\n type : 'roller',\n channel : 0,\n \n id : '...',\n pos : '80',\n \n // see also \n // direction : open close stop\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":520,"wires":[["67151b7d3283ab91"]]},{"id":"f448bd2cb6717f8b","type":"inject","z":"8b03c2fe854ef2fd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":560,"wires":[["c37ee3c1e961a74a"]]},{"id":"c37ee3c1e961a74a","type":"function","z":"8b03c2fe854ef2fd","name":"roller 0%","func":"msg.payload = {\n type : 'roller',\n channel : 0,\n \n id : '...',\n pos : '0',\n \n // see also \n // direction : open close stop\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":560,"wires":[["67151b7d3283ab91"]]},{"id":"096c401b56b8ea5e","type":"inject","z":"8b03c2fe854ef2fd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":620,"wires":[["681a443d1412fbe0"]]},{"id":"681a443d1412fbe0","type":"function","z":"8b03c2fe854ef2fd","name":"relays on","func":"msg.payload = {\n type : 'relays',\n turn : 'on',\n\n devices : [{\n id : 'F13f0d',\n channel : '0',\n }]\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":620,"wires":[["67151b7d3283ab91"]]},{"id":"26e92be748e40b6b","type":"function","z":"8b03c2fe854ef2fd","name":"relays off","func":"msg.payload = {\n type : 'relays',\n turn : 'off',\n \n devices : [{\n id : 'F13f0d',\n channel : '0',\n }]\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":660,"wires":[["67151b7d3283ab91"]]},{"id":"3c27aea055845fd4","type":"inject","z":"8b03c2fe854ef2fd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":660,"wires":[["26e92be748e40b6b"]]},{"id":"c145b236970a3ff4","type":"inject","z":"8b03c2fe854ef2fd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":260,"wires":[["8ab8f7e4620bb37f"]]},{"id":"8ab8f7e4620bb37f","type":"function","z":"8b03c2fe854ef2fd","name":"status all","func":"msg.payload = {\n type : 'status_all'\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":260,"wires":[["67151b7d3283ab91"]]},{"id":"07598bf542b6d779","type":"inject","z":"8b03c2fe854ef2fd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":360,"y":220,"wires":[["e2aeae72c9ca1ac8"]]},{"id":"e2aeae72c9ca1ac8","type":"function","z":"8b03c2fe854ef2fd","name":"status","func":"msg.payload = {\n type : 'status',\n id : '8caab55397c7'\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":220,"wires":[["67151b7d3283ab91"]]},{"id":"46da28b11bef0677","type":"shelly-cloud-server","description":""}]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-shelly",
"version": "10.13.5",
"version": "10.13.6",
"description": "Shelly nodes.",
"node-red": {
"version": ">=0.1.0",
Expand Down
7 changes: 7 additions & 0 deletions shelly/99-shelly.js
Original file line number Diff line number Diff line change
Expand Up @@ -2581,6 +2581,13 @@ module.exports = function (RED) {
} else if (type === 'status'){
route = '/device/status';

let data = {
id : msg.payload.id
};
params = encodeParams(data);
} else if (type === 'all_status'){
route = '/device/all_status';

let data = {
id : msg.payload.id
};
Expand Down
Loading