Firebase and nodered help!

I am trying to retrieved the data stored in firebase and put it into a chart in nodered. However, it seems like the chart is limited which means that it only able to show the limited number of datapoint. For example, i have to all the temperature value from 14Jan until 1Feb....when i try to put them into the chart....it will only appear the temperature value on 1Feb

any solution on this?or do i need to put it as array first?

Hi @alex1

what chart are you using? Node-RED Dashboard or something else?

How are you trying to insert data into the chart? Can you share any more specific details? What format have you got the data in?

the format is " temperature value, time ".....i am using line chart..and the flow is ...

[{"id":"8a4f6d41.549f8","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"ce8cdade.b01b38","type":"debug","z":"8a4f6d41.549f8","name":"3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":2750,"y":280,"wires":[]},{"id":"aa7e3e88.cc06f","type":"function","z":"8a4f6d41.549f8","name":"","func":"values = msg.payload.split(\",\");\nmsg.payload=parseInt(values[0]);\nmsg.timestamp=parseInt(values[1]);\n\nreturn msg;","outputs":1,"noerr":0,"x":2630,"y":240,"wires":[["f5098894.0b28d8","ce8cdade.b01b38"]]},{"id":"7b7e063f.9e2268","type":"split","z":"8a4f6d41.549f8","name":"","splt":",","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":2510,"y":280,"wires":[["c477c82b.2ab838","aa7e3e88.cc06f"]]},{"id":"c477c82b.2ab838","type":"debug","z":"8a4f6d41.549f8","name":"5","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":2570,"y":340,"wires":[]},{"id":"f5098894.0b28d8","type":"ui_chart","z":"8a4f6d41.549f8","name":"","group":"47decfa0.89c29","order":3,"width":"0","height":"0","label":"Temperature","chartType":"line","legend":"false","xformat":"Y-M-D","interpolate":"linear","nodata":"","dot":true,"ymin":"0","ymax":"50","removeOlder":1,"removeOlderPoints":"50000","removeOlderUnit":"1","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":2770,"y":200,"wires":[[],[]]},{"id":"adfb2739.5d02d8","type":"firebase.once","z":"8a4f6d41.549f8","name":"","firebaseconfig":"","childpath":"Temperature","repeatifnull":false,"eventType":"value","queries":[],"x":2340,"y":160,"wires":[["7b7e063f.9e2268"]]},{"id":"2a93bee5.97e672","type":"ui_button","z":"8a4f6d41.549f8","name":"","group":"47decfa0.89c29","order":1,"width":0,"height":0,"passthru":false,"label":"Refresh","tooltip":"","color":"black","bgcolor":"yellow","icon":"","payload":"","payloadType":"date","topic":"","x":2140,"y":300,"wires":[["adfb2739.5d02d8"]]},{"id":"47decfa0.89c29","type":"ui_group","z":"","name":"Data Logger","tab":"49f9e7de.cba258","order":2,"disp":true,"width":"6","collapse":false},{"id":"49f9e7de.cba258","type":"ui_tab","z":"","name":"Smoke Detector 1","icon":"donut_large","order":1,"disabled":false,"hidden":false}]

Some pointers that should help:

  1. When sharing flows on the forum please read this post : How to share code or flow json
  2. The dashboard chart does support passing in an object of historic data, you just have to get the format right. This page describes how to do it: https://github.com/node-red/node-red-dashboard/blob/master/Charts.md#stored-data

I did see this page before. But the example shown in the page is like the value and number of points is fixed and known...but if retrieve from database is really different, somehow im new to json. Do I need to change the data to array first? because current the format of payload is "object" not "array"

[{"id":"8a4f6d41.549f8","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"ce8cdade.b01b38","type":"debug","z":"8a4f6d41.549f8","name":"3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":2750,"y":280,"wires":[]},{"id":"aa7e3e88.cc06f","type":"function","z":"8a4f6d41.549f8","name":"","func":"values = msg.payload.split(\",\");\nmsg.payload=parseInt(values[0]);\nmsg.timestamp=parseInt(values[1]);\n\nreturn msg;","outputs":1,"noerr":0,"x":2630,"y":240,"wires":[["f5098894.0b28d8","ce8cdade.b01b38"]]},{"id":"7b7e063f.9e2268","type":"split","z":"8a4f6d41.549f8","name":"","splt":",","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":2510,"y":280,"wires":[["c477c82b.2ab838","aa7e3e88.cc06f"]]},{"id":"c477c82b.2ab838","type":"debug","z":"8a4f6d41.549f8","name":"5","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":2570,"y":340,"wires":[]},{"id":"f5098894.0b28d8","type":"ui_chart","z":"8a4f6d41.549f8","name":"","group":"47decfa0.89c29","order":3,"width":"0","height":"0","label":"Temperature","chartType":"line","legend":"false","xformat":"Y-M-D","interpolate":"linear","nodata":"","dot":true,"ymin":"0","ymax":"50","removeOlder":1,"removeOlderPoints":"50000","removeOlderUnit":"1","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":2770,"y":200,"wires":[[],[]]},{"id":"adfb2739.5d02d8","type":"firebase.once","z":"8a4f6d41.549f8","name":"","firebaseconfig":"","childpath":"Temperature","repeatifnull":false,"eventType":"value","queries":[],"x":2340,"y":160,"wires":[["7b7e063f.9e2268"]]},{"id":"2a93bee5.97e672","type":"ui_button","z":"8a4f6d41.549f8","name":"","group":"47decfa0.89c29","order":1,"width":0,"height":0,"passthru":false,"label":"Refresh","tooltip":"","color":"black","bgcolor":"yellow","icon":"","payload":"","payloadType":"date","topic":"","x":2140,"y":300,"wires":[["adfb2739.5d02d8"]]},{"id":"47decfa0.89c29","type":"ui_group","z":"","name":"Data Logger","tab":"49f9e7de.cba258","order":2,"disp":true,"width":"6","collapse":false},{"id":"49f9e7de.cba258","type":"ui_tab","z":"","name":"Smoke Detector 1","icon":"donut_large","order":1,"disabled":false,"hidden":false}]

Yes you need to transform the data into the format the chart requires.

If you add a Debug node after the firebase node, you can then show us the exact format of data you get back from that node. Then we can help you get it into the right format. (Although, I'm signing off for the night now)

{"-LVrkAn5YwnkuoAQB62T":"30,1547123604828","-LVrkCghGv-KShFjbFlw":"30,1547123612611","-LVrkHED2vZtEuJfmUlj":"30,1547123631204","-LVrkZgRUUM2HNPfyns0":"30,1547123706803","-LVrkZkzteXGF-LIYBUO":"30,1547123707094","-LYFMW3Dsx878BSwB1pM":"25,1549684052375","-LYFMcjYiipNeS24MMIY":"25,1549684083820","-LYFMckzUaGiIYgj3Shv":"25,1549684083912","-LYFMcnkBHs8d1MfhTGk":"25,1549684084089","-LYFMcp4vyAHuILvFM_x":"25,1549684084175","-LYFMcs5HVH2LbHmVni-":"25,1549684084368","-LYFMcszjLXlZMrOvngZ":"25,1549684084424","-LYFMcx-RfsGw1unaNWb":"25,1549684084682","-LYFMcy0Z8qzOL_70gMk":"25,1549684084747","-LYFMd0Kwwxe-9D5T6Ts":"25,1549684084959","-LYFMd1aAm-INIS10Q3z":"25,1549684085040"}

image

image

What are you trying to graph?
Generally for temperature I would have expected temperature plotted against time.

But I don’t see time in your data example

There is data stored in the format >>>25,1549684052375
25 is temperature and 1549684052375 is time

Aaaahhh! That makes more sense! It's early!

Are the attribute names to be ignored (the long sequences of apparently random characters)?

I manage to get it done after some learning of JSON. Thanks.

@alex1 @ukmoose Hey, How did you get ur node red accout authenticated? Was it through gmail? When I typed the email credentials and tried, it says service unavailable.