Don't think it's related to language.
Sure helps. And what does the updates
object contain?
It contains { '3f7e8703.c86ea8': { online: true, on: true } }
Looks like the devices.find
fails.
I also tried devices.find(function (d) { return d.id == id; });
, devices.find(d => d.id == this.id)
with this.
and without. Changing ===
to ==
did not work either.
What version of node.js are you using? Try using the latest LTS (version 10). What plugins are you using?
Either the node.js you are using doesn't have the find method (I doubt it, it should be since v4), or some plugin overrides it in a very weird way.
Open node and run [{id:1},{id:2}].find(i => i.id === 2)
. It should ouput { id: 2 }
.
var device = devices.filter(d => id === d.id)[0]
works...
Yeah, this works!
I have nothing installed but node-red as far as i know.
In that case... what other plugins do you have (other than node-red-contrib-nora)?
node-red-contrib-fritz
node-red-contrib-fritzbox-presence
node-red-contrib-ibm-watson-iot
node-red-contrib-opcua
node-red-node-pi-sense-hat
I try deactivating one by one
EDIT:
I found the reason: shelljs
Link in its the readme file: https://www.npmjs.com/package/shelljs
It was located in the node_modules
folder. I moved it somewhere else and now it works like a charm!
Seems like this is automatically added to the node-red installation on the RPi.
But i'm still not sure why it happend inside docker on my windows machine.
How could somebody just overwrite neseccary standard functions...
Thanks for your help! I will donate as soon as my new credit card arrives
Keep going your great work!
Greetings Robert
You're welcome!
It is kinda weird... I'll look into it, but I don't think shelljs is the culprit. Maybe some other thing that depends on it and fails if it's missing...
And we reached at some point 100 online users
Some stats:
335 registered users
5662 monthly conversations (1 error - probably during a deploy)
633 devices (3 offline): 289 lights, 176 switches, 70 scenes, 47 outlets, 39 thermostats, 8 blinds, 4 speakers
Btw, now and then I see some errors during the sync/update. For example when you try to send the ambient humidity for the thermostat with a value greater than 100%. Keep in mind that sync/update objects that don't respect the schema are rejected all together.
Hi All!
I just started using this today and I'm a bit stuck.
I've a temperature (parsed number from a sonoff) I want to pass into the thermostat Node.
Is there a guide on this apart from the one pager setup on the git?
Hi All,
I'm trying this for the first time today and I noticed that although Google Home will think it turned off a light, sometimes this fails to go through (however the light still shows as off in google home). When this happens, I can see the following error in Node Red:
"nora (GrXDY): disconnected (io client disconnect)"
Does anyone know what's causing this? Is the server just having issues?
As a secondary question, is it a bug that google home will show the light as being turned off, when the request never reached node red?
Thanks for any help!
You just need to send a payload (to the thermostat node) that contains a temperature
property as a number.
[{"id":"a05c5394.b829a","type":"inject","z":"5ae7227d.929fac","name":"","topic":"","payload":"{\"temperature\":25}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":160,"wires":[["94a56f8d.a8a4"]]},{"id":"94a56f8d.a8a4","type":"nora-thermostat","z":"5ae7227d.929fac","devicename":"Thermostat","roomhint":"","name":"","modes":"off,heat,on","unit":"C","topic":"","passthru":false,"nora":"7253437d.6deb9c","x":410,"y":160,"wires":[[]]},{"id":"7253437d.6deb9c","type":"nora-config","z":"","name":"nora config","group":"home"}]
Are you sure the disconnected event is at the exact same time you turned off the light? Does your node-red instance restart? The disconnect happens once a day when the heroku dyno is restarted. I can't stop that happening but node-red should reconnect in a few seconds... If you happen to issue a command in those seconds a day, google home will tell you your device is not available (see below).
Also the light node in node-red shows the state in the status of the node. Can you check if that's in sync?
The way it works is that if node-red is not connected to NORA, google will say the light is not available. Also in google home, the device will show as unavailable. Soon as node-red connects again to NORA, the state is synced from node-red to NORA to Google Home (so make sure your node is kept in sync with the actual device state and google will be in sync too).
It's very unlikely that google home said something happened and the message never reached node-red. But there is a small timeout (I think 5 seconds) until NORA detects that you're instance of node-red is not connected anymore - if the connection isn't closed properly. That's because of how the internet works.
You can start with a very simple flow (inject -> light -> debug) and see if that works. If this works, it might be something else in your flow. Something like this:
[{"id":"ca96c565.ff7748","type":"inject","z":"88c7a7ea.ec29c8","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":120,"wires":[["39a01118.9df90e"]]},{"id":"7d5a0282.f61a6c","type":"inject","z":"88c7a7ea.ec29c8","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":160,"wires":[["39a01118.9df90e"]]},{"id":"39a01118.9df90e","type":"nora-switch","z":"88c7a7ea.ec29c8","devicename":"Switch","roomhint":"","name":"","passthru":false,"nora":"7253437d.6deb9c","topic":"","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":300,"y":140,"wires":[["c550c657.33a9e8"]]},{"id":"c550c657.33a9e8","type":"debug","z":"88c7a7ea.ec29c8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":470,"y":140,"wires":[]},{"id":"7253437d.6deb9c","type":"nora-config","z":"","name":"nora config","group":"home"}]
Are you sure the disconnected event is at the exact same time you turned off the light?
It's hard to give a definite yes, but I watched the logs and sat turning the light on/off until it failed and I would see that message around the same time.
The disconnect happens once a day when the heroku dyno is restarted.
I haven't had time to look at it today, but basically I was getting disconnects every few minutes (I don't know if there's a debug log in node red somewhere that would still have this recorded?). This doesn't seem to be happening this evening.
Does your node-red instance restart?
No.
If you happen to issue a command in those seconds a day, google home will tell you your device is not available (see below).
This is what I would expect.
Also the light node in node-red shows the state in the status of the node. Can you check if that's in sync?
No, it would go out of sync. So for example google would say that it just turned off the light, however the light would still be on physically and in node red.
EDIT: However, if I waited a few seconds and refreshed the light on the google home app, it would show the correct state of the light.
It's very unlikely that google home said something happened and the message never reached node-red. But there is a small timeout (I think 5 seconds) until NORA detects that you're instance of node-red is not connected anymore - if the connection isn't closed properly. That's because of how the internet works.
So Nora does respond to googles server before it gets back anything back my from Node red, correct?
I'm battling with a head cold at the minute so I'm a bit fuzzy, sorry if I wasn't clear here or missed anything important.
Thanks for your work on this btw, apart from this issue yesterday, Nora's fantastic!
J
Also Google Home widgets don't update realtime. I noticed if you open a light (or other widget) and send a change from node-red or from another google home, it won't update.
Yes, it does. A command from Google updates the internal state immediately and after that it's sent to node-red and back to google home, but that only if there is an active connection to node-red. I did think about making it so that commands go to node-red first, not sure why I left it this way... Maybe in a future version.
Glad to hear
Ah ok, so whatever was happening with my install causing constant disconnects was the culprit. That seems to have resolved itself and everything is running smoothly now
I noticed the "speaker" node. Is there any chance this might be able to broadcast messages in the future? I have the home phone hooked into node-red now, so I could get google home to say the callers name out loud
Nope, it's something entirely different. However, there already is this available:
or this:
Thanks for that! I have the google home calling out who's calling the landline now
Here's one for you. I created a control to control my heating. The heating works over SMS, so I have no feedback to go into the google control.
If I turn it off, then it sends an off SMS to the controller, if I turn it on it sends an on SMS. Now, the issue is that if the control is off, and I tell google home to turn the heating off, it does nothing as the control is already off. However someone may have turned on the heating outside of the node red switch and I want it to send the SMS.
Have you any suggestions on making the switch always work? So if the control is off and it gets an off command it still runs?
This is an interesting topic (MQTT pun!), but it has already been done...
See gbridge.io
Hosted:
4 devices for free
Unlimited devices for a monthly donation
There is a free docker image available to set up your own server; you just need to connect it with your own Google developer account.
I am currently testing using the free account, and have found it to be 100% reliable during two weeks testing.
My next step is to try the docker configuration.
gbridge.io uses MQTT for control; very easy to configure using node red on Raspberry Pi.
Perhaps you could review the above project; are you proposing a different solution?
Seems to me it is the other way around gbridge.io is interesting, but it has already been done before by Andrei.
However, the documentation provided by gbridge.io is excellent!!
Does it really matter who did what first?
They are both great contributions, and both work equally well.
I appreciate the efforts of both developers, and both deserve a big thanks.