You have a debug node attached to your mqtt node. What does it show? That will tell us exactly what payload you're passing the json node and from there what is causing the error.
Nick
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/c3db2ffc-8e3c-45aa-b08d-8e9b0cd11a68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
"{dht22:{temperature:{value: 25.4},humidity:{value: 40}}}"
6.11.2017, 20:58:36node: 5a47905.5b95b7
msg : string[40]"Unexpected token d in JSON at position 1"
You are not sending valid json:
{dht22:{temperature:{value: 25.4},humidity:{value: 40}}}
None of the property names had quotes around it.
It needs to be:
{"dht22":{"temperature":{"value": 25.4}, "humidity":{"value": 40}}}
Nick
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/e70b5569-d266-45d9-b4d1-529814ef9f5f%40googlegroups.com.
Thank You very much Nick
In Linux, I have now made that command:
#mosquitto_pub -d -u user -P userpass -t /sensor/test -m "{\"dht22\":{\"temperature\":{\"value\": 25.4},\"humidity\":{\"value\": 40}}}"
With backslash, and now I have correct value:
The one major drawback to this technique is that we generally develop for the Pi, and the standard installation of NR on Raspbian Jessie seems to use a JavaScript engine that is pretty old .. so a lot of ES6 syntactical goodness is unavailable, and occasionally newer, incompatible syntax creeps into the code as it gets revised .. so we occasionally need to weed stuff a bit when the code is moved back to the Pi's NR context.
But .. it beats logging and message debug blocks when chasing a complex issue.
> standard installation of NR on Raspbian Jessie seems to use a JavaScript engine that is pretty old
Which is one reason why our Pi docs recommend you run our update script to get to latest stable node/npm/Node-RED versions.
Nick
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send an email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/0cdd414b-6ee1-4ec6-9567-0d0fe7a85cac%40googlegroups.com.
Last time I went through that process, everything worked, except for the serial blocks .. which we use extensively. I'm sure I could have fixed it, but I have a dozen other things to do on any given day (patent stuff, licensing stuff, investor meetings, legal stuff, CAD stuff etc. etc.) .. the more I screw with the platform, the less it's worth to me.
Not worth the hassle .. we ride the version train where it takes us. Configuration management is hard enough without adding the risk of extra gotchas in exchange for meager benefits.
Last time I went through that process, everything worked, except for the serial blocks .. which we use extensively. I'm sure I could have fixed it, but I have a dozen other things to do on any given day (patent stuff, licensing stuff, investor meetings, legal stuff, CAD stuff etc. etc.) .. the more I screw with the platform, the less it's worth to me.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send an email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/b4767ea5-5606-4198-bd78-f339d77f5f43%40googlegroups.com.
Then Nick offered that the guidelines suggest upgrading, and I offered that it didn't make sense for us.
I guess I should have said "minor drawback" rather than "major drawback".