qHistoricData issue and whod does the line chart work

QIoT technology to allow you to explore potential IoT business opportunities.
Smart home/Smart building/Smart City/
Post Reply
K0ertis
New here
Posts: 5
Joined: Sat May 06, 2017 10:39 pm

qHistoricData issue and whod does the line chart work

Post by K0ertis »

Hi,

I have running a ESP8266 on my QNAP and it is sending via MQTT temperature and humidity from DTH11 and its working great so far. I can also view the results in a line chart:
Screenshot from 2019-02-06 18-11-23.png
But I have no idea how to get the data from QHistoricData to feed the chart, I tried so many tutorials and forums but no luck so far.

I got the data with the example code and feed that into the QHistoric Data and then I want to draw that data in the line chart.

Code: Select all

var start_date = new Date();
start_date.setHours(start_date.getHours() - 2);

var msg = {
    payload: {
    start_date: start_date,
    end_date: new Date()
    }
};
return msg; // I added this line to return msg
after starting and looking at the output from debugger:

Code: Select all

{
    "payload": {
        "start_date": "2019-02-06T15:13:30.648Z",
        "end_date": "2019-02-06T17:13:30.654Z"
    },
    "_msgid": "fd9459b4.026ba8"
}
alright I expect now data in between this time but I get all the data the QHistorcData block has to offer from the first day it started storing data.

I show here only the first and last line:

Code: Select all

{
    "payload": {
        "result": [
            {
                "totalCount": 282,
                "data": [
                    {
                        "count": 48,
                        "vmin": 19,
                        "sum": 957,
                        "vmax": 21,
                        "_id": "2019-02-05T17:13:30",
                        "vavg": 19.9375
                    }, ... and so on 
                     {
                        "count": 48,
                        "vmin": 18,
                        "sum": 958,
                        "vmax": 21,
                        "_id": "2019-02-06T16:58:30",
                        "vavg": 19.958333333333332
                    }
                ]
            }
        ]
    },
    "_msgid": "8ba78cc0.74587"
}
so obviously something is not working right because the start date end end date do not match...


2 Question: This data i want to put into the line chart of node-red but there is no way I get it to work I don't know how I need to prepare the data in order to succeed:

I added x an y on the payload but no success
I tried feeding it this way as it comes out from QHistoryBlock
I tried to transform it to an array and feed it but no success,


Can someone please help me with those issues?
I should I rather send this date to home assistant?
You do not have the required permissions to view the files attached to this post.
Post Reply

Return to “QIoT”