Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Daily gas usage date one day off. #299

Open
nachtbraker opened this issue Dec 16, 2022 · 10 comments
Open

Daily gas usage date one day off. #299

nachtbraker opened this issue Dec 16, 2022 · 10 comments

Comments

@nachtbraker
Copy link

nachtbraker commented Dec 16, 2022

The daily gas usage data seems to be one day off. E.g. when I use the cmd line utility from https://github.com/robertklep/nefit-easy-client I get:

/usr/local/bin/easy --serial=### --access-key=### --password=### gas-usage
[{"date":"Mon Nov 28 2022","hot water":6.2,"central heating":65.6,"average outdoor temperature":9.5},
[snip]
{"date":"Thu Dec 15 2022","hot water":5.7,"central heating":123.1,"average outdoor temperature":2.6}]

Which is what I expect (today being Dec 16.)

However, using the example nefit-easy-dailygasusage-to-influx.json flow, the days seem to be one day off. The output of this flow is:

nefit-easy : msg.payload : array[18]
array[18]
[0 … 9]
0: object
date: "2022-11-27T23:00:00.000Z"
hot water: 6.2
central heating: 65.6
average outdoor temperature: 9.5
[snip]
17: object
date: "2022-12-14T23:00:00.000Z"
hot water: 5.7
central heating: 123.1
average outdoor temperature: 2.6

Perhaps a timezone thing? (I'm in NL.)

To Reproduce

See above.

Expected behavior

object.date above should be dated one day later.

Desktop (please complete the following information):

  • OS: FreeBSD 12.3
  • Version: 2.2.7
@nachtbraker
Copy link
Author

Bump?

@RaimondB
Copy link
Owner

Sorry for the late response. Actually, I think it is correct. T23:00Z means 11:00PM in UTC time, which differs (depending on daylight savings time) 1 hour from the GMT. So converted to local time in NL, this results in 00:00 of the next day.

Check it out at https://savvytime.com/converter/utc-to-netherlands-amsterdam

@nachtbraker
Copy link
Author

Thanks. Ok, I suspected as much. Problem is, this gets dumped into influxdb, then viewed by grafana, and it's a day off. I'll try to find a way around it.

@RaimondB
Copy link
Owner

I am also using influx & grafana and it seems to be correct. It is important to have timezones setup correctly. In grafana there are some settings for that.

image

@nachtbraker
Copy link
Author

Here it's set to Browser time, and also in the grafana.conf file it is set to browser. Which is UTC+0100, same as in your screenshot. I changed it, but it made no difference.

If you look back at my initial message, it's a difference between the cmdline tool and the output in node-red. So that's before it goes into influxdb. But both that cmdline tool and nodered are running on the same server, same timezone, etc. And I don't have timezone problems with any other data, e.g. realtime temperature sensors, p1-energy data, etc.

@RaimondB
Copy link
Owner

Did you also correctly set the location of the Nefit Easy thermostat? (under the account settings)

@RaimondB
Copy link
Owner

I checked the code, but there is no calculation on the timezone. This is the mapping from my sync operation:

var result = msg.payload.map(v => {
    return { 
        timestamp : v.date,
        measurement : "nefit_easy",
        fields: {
            hot_water : v["hot water"],
            central_heating : v["central heating"],
            average_outdoor_temperature : v["average outdoor temperature"]
        }
    };
});

msg.payload = result;

return msg;

Basically the nefit module calls the neift-easy-commands library:
https://github.com/robertklep/nefit-easy-commands/blob/master/lib/commands/gasUsage.js

@RaimondB
Copy link
Owner

Is the timezone for Node-Red also correct?

@nachtbraker
Copy link
Author

Did you also correctly set the location of the Nefit Easy thermostat? (under the account settings)

Yes, set to my home location. (In NL.)

Is the timezone for Node-Red also correct?

Not sure where to change it. Looks OK if I make a small test flow like this:

var d = new Date();
msg.payload = d.toLocaleString();
return msg;

A shell in the FreeBSD jail running node-red is also displaying correct time (CET)

@RaimondB
Copy link
Owner

Hi @nachtbraker did you manage to find/resolve the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants