Closed majorcs closed 6 years ago
I did a quick test, and seems this dirty hack can be a workaround
diff --git a/lib/api.js b/lib/api.js
index ed4a0bd..3d44769 100644
--- a/lib/api.js
+++ b/lib/api.js
@@ -139,6 +139,9 @@ class evok extends client {
parse(message) {
// handle devices
+ if (!Array.isArray(message)) {
+ message = [message]
+ }
message.forEach((device) => {
let previous = this.device(device.dev, device.circuit)
Hey, I haven't managed to wire any 1wire devices up just yet so never tested them (https://github.com/phillipsnick/unipi-evok/issues/6).
If that fix resolves the issue, feel free to submit a PR and I'll run a quick test later and release.
Fixed under #13
Thanks for your effort to create this lib and the NodeRed extension as it makes the UniPi a really good player with NodeRed. I managed to implement some similar functionality within NodeRed but it's quite difficult to maintain, your library and nodes makes it really easy.
There is a small issue. My UniPi (Neuron L203) has a OneWire sensor and it generates payload on the websocket with a little bit different structure than the other I/Os.
{"interval":15,"value":24.05,"circuit":"28409D1F0000801E","address":"28409D1F0000801E","time":1525949750.997278,"typ":"DS18B20","lost":true,"dev":"temp"}
I think the issue is the payload in this case is just a hash not an array. This results the following traceback: