OpenEnergyDashboard / OED

Open Energy Dashboard (OED)
Mozilla Public License 2.0
75 stars 263 forks source link

imported data honoring daylight savings but without zone in readings #1219

Closed huss closed 2 months ago

huss commented 5 months ago

Description

OED wanted to import data exported from another readings collection tool. This data reflected local time including shifts for daylight savings (DST) but does not have time zone information, e.g., 2024-01-01 00:00:00 instead of 2024-01-01 00:00:00-05:00. OED expects time zone information when honoring DST to determine when a pair of readings cross DST. This PR adds a switch named useMeterZone where the zone associated with the meter (or site then server if no meter info in standard OED fashion) is added to each reading. This allows OED to detect DST crossing into DST but there are issues leaving DST (see below). This PR allows the data to be imported but isn't perfect. It appears to work fine as long as the readings align with the DST zone. For example, 15 minute data starting on the hour is fine. However, readings off the hour, e.g., at 5, 20, 35 & 50 min of each hour, would overlap the DST zone and probably cause issues. This PR only enables this ability with curl commands (see below).

In addition, the following changes were made:

Type of change

Checklist

Limitations

Even though the code has the limitations stated above, it is still useful in some cases. Thus, it is proposed to add to OED. The PR contains all the code for allowing the useMeterZone on the CSV reading import page but the actual checkbox is commented out so it is not available. This was done due to limitations at this time so it cannot easily be used but is available for scripts and manual uploads. This could easily be undone in the future by uncommenting the checkbox and this code was tested during development.

There are no automated test included. They should be added if this becomes a used feature.