Fixes modified: octoprint_tplinksmartplug/__init__.py #352
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The following pull-request addresses and fixes several bugs/feature enhancements.
Specifically,
timestamp
column fixed to be of typeDATETIME
rather thanTXT
[BUG]: sqlite3 schema type for 'timestamp' is 'TEXT' but should be 'DATETIME' #346grandtotal
added to calculate corrected total net of restarts inttotal
column [Feature Request]: Add additional field to database representing "corrected" total energy usage #344energy_data.db
are only added if:total
changed, currentpower
> 0 or has changed (this captures return to zero) [Feature Request]: Only add entries to db if current or power non-zero or if total changes #345The code covers the following 3 situations:
energy_data.db
creation (one-time)energy_data.db
(one-time to be consistent with above)Note that I was maximally "liberal" in retaining rows that have information - the only rows discarded are rows with zero
power
and no changes intotal
or that are not the first return to zeropower
(the final element is included so that you know when power shuts off)The GUI now reflects 'grandtotal' by passing that value to the javascript routines.
Let me know if you have any questions or concerns with any of the individual code changes.