I was publishing sunrise &sunset time but while using in code its not working. can anyone assist me?
I am using MQTT for a small project where through openweather API and Node-red i am publishing surise time of a location which is taken as input through a form in node-red dashboard. based on this time i was trying to turn led if its night and off if its day.
but i am unable extract two values from the topic.
i was publishing sunrise and sunset time but while using in code its not working.
can anyone assist me in this?
4 Replies
Hi @Shrushti I hope you're using
JSON
node palette to process MQTT payload. In this case usemsg.payload
string and then split the payload. Please refer https://discourse.nodered.org/t/how-to-split-mqtt-tag-values/10794/3. As @techielew mentioned, we're preparing for TODAY's Engineering Hour. I'll write you detail response late evening.Jsonfy the data so it can be extracted properly @Shrushti
Please share the sample MQTT Payload that you are using and the logic to extract the values.
Solution
this is the sample payload i am publishing
it works now 👍
thanks @LMtx @Umesh Lokhande @electro_coco and @techielew