Tobias Lindberg
ef40a91e8d
adding sql when end_date is not null to charges
2021-05-19 19:10:05 +02:00
Tobias Lindberg
695dc389ad
Merge pull request #51 from alecdoconnor/patch-3
...
Prevent fatal error when detailed charge malformed
2021-05-19 18:51:21 +02:00
Alec O'Connor
27646b2058
Prevent fatal error when detailed charge malformed
...
Following up on https://github.com/tobiasehlert/teslamateapi/issues/43
*Reason*
A detailed charge is malformed if the end_date is missing in SQL. It's also possible a charge that is in progress will be missing this value as well, in which case this detailed charge isn't populated with data.
*Better Solutions* (long term)
Adjust error handling across the API:
- *Opt 1:* Instead of `ValidResponse` being a boolean, replace with `ResponseError`. Change the if statement at the bottom of each file to check for the `ResponseError`'s existence instead of `if ValidResponse {...} else {...}`. Remove all log.Fatal(err) so that the API can still return responses gracefully, and set status to 200 OK since the response will still technically be HTTP valid. Break execution of further steps and return the meaningful ResponseError in the API
- *Opt 2:* For simplicity, create a functions like this and call it (along with an early `return`) wherever a fatal error is currently used (or `ValidResponse` never set to true). Then remove `ValidResponse` entirely and adjust the `if` statement at the bottom of every API file to only run the first condition.
```
func TeslaMateAPIHandleErrorResponse(c *gin.Context, s string) {
log.Println("[error] TeslaMateAPICarsChargesDetailsV1 " + c.Request.RequestURI + " error in execution! " + s)
c.JSON(http.StatusOK, gin.H{"error": s})
}
func TeslaMateAPIHandleSuccessResponse(c *gin.Context, j JSONData) {
log.Println("[info] TeslaMateAPICarsChargesDetailsV1 " + c.Request.RequestURI + " executed successful.")
c.JSON(http.StatusOK, j)
}
```
If you're interested, I'd be happy to put together a sample PR
2021-05-10 09:54:30 -04:00
Tobias Lindberg
6e56848eaf
Merge pull request #47 from alecdoconnor/patch-3
...
Skip Malformed Rows (those missing an end_date)
2021-05-10 09:31:15 +02:00
Tobias Lindberg
616864d75a
Merge pull request #49 from tobiasehlert/dependabot/docker/golang-1.16.4
...
Bump golang from 1.16.3 to 1.16.4
2021-05-10 09:22:47 +02:00
Tobias Lindberg
07fa314001
Merge pull request #46 from tobiasehlert/dependabot/go_modules/github.com/eclipse/paho.mqtt.golang-1.3.4
...
Bump github.com/eclipse/paho.mqtt.golang from 1.3.3 to 1.3.4
2021-05-10 09:22:37 +02:00
dependabot[bot]
d307eb863b
Bump golang from 1.16.3 to 1.16.4
...
Bumps golang from 1.16.3 to 1.16.4.
Signed-off-by: dependabot[bot] <support@github.com >
2021-05-10 07:16:46 +00:00
Alec O'Connor
36cb82db87
Skip Malformed Rows (those missing an end_date)
...
*Expected*
The Charges endpoint should still return data, even if a portion of charges have corrupted data.
*How it happens*
Charges can become corrupted if Teslamate does not detect that a charge ever ended, such as if the car or Teslamate goes offline when the charging ends.
*Note*
The charging_processes table's most recent row may be missing an end_date if the charge is in progress. These charges were already being skipped in the chargingDetails endpoint. I am assuming it is safe to skip them here, since they essentially have no data until the charge finishes.
*Please Test*
- Please test that this still builds as I am not entirely familiar with Go and am unsure how to test this on my docker container.
2021-05-04 09:39:07 -04:00
Tobias Lindberg
6633a2c60a
Update build.yml
...
removing trigger for pull_request for a while..
2021-05-04 09:19:19 +02:00
dependabot[bot]
d1a6ce45bc
Bump github.com/eclipse/paho.mqtt.golang from 1.3.3 to 1.3.4
...
Bumps [github.com/eclipse/paho.mqtt.golang](https://github.com/eclipse/paho.mqtt.golang ) from 1.3.3 to 1.3.4.
- [Release notes](https://github.com/eclipse/paho.mqtt.golang/releases )
- [Commits](https://github.com/eclipse/paho.mqtt.golang/compare/v1.3.3...v1.3.4 )
Signed-off-by: dependabot[bot] <support@github.com >
2021-05-04 07:16:34 +00:00
Tobias Lindberg
68a437f724
bumping new version v1.6.0
...
updating CHANGELOG
v1.6.0
2021-05-03 22:33:54 +02:00
Tobias Lindberg
df5ec40b05
Merge pull request #44 from tobiasehlert/revert-40-patch-3
...
Revert "Update v1_TeslaMateAPICarsCharges.go"
2021-05-03 22:23:20 +02:00
Tobias Lindberg
6022c8ef77
Revert "Update v1_TeslaMateAPICarsCharges.go"
2021-05-03 22:21:58 +02:00
Tobias Lindberg
ae348eaf8e
Merge pull request #39 from alecdoconnor/patch-2
...
Patch 2
2021-05-03 22:19:26 +02:00
Tobias Lindberg
2ff591e1fa
Merge pull request #40 from alecdoconnor/patch-3
...
Update v1_TeslaMateAPICarsCharges.go
2021-05-03 22:16:25 +02:00
Tobias Lindberg
8f97ff281c
Update v1_TeslaMateAPICarsChargesDetails.go
...
using NullString instead of coalesce function
2021-05-03 22:13:23 +02:00
Tobias Lindberg
8b59c2a9c3
Update CHANGELOG.md
2021-05-03 22:06:35 +02:00
Tobias Lindberg
3266975721
Merge pull request #42 from tobiasehlert/bug-8
...
Adding persistant MQTT connection for status endpoint
2021-05-03 21:49:50 +02:00
Tobias Lindberg
6ee81c6716
adding github.com/thanhpk/randstr v1.0.4
...
removed by mistake in b3b731b
2021-05-03 21:44:20 +02:00
Tobias Lindberg
b3b731b0eb
Merge branch 'main' into bug-8
2021-05-03 21:40:39 +02:00
Alec O'Connor
bdbe229a5b
Update v1_TeslaMateAPICarsCharges.go
...
It's possible to have incomplete charges with missing EndDate. These aren't always valid objects either, but they shouldn't prevent the Charges endpoint from providing data.
I believe this can happen when TeslaMate is offline when the charging cycle ends. I am not sure if it's also possible if the vehicle is actively charging.
Feel free to edit this PR, not sure that an empty string is the best option.
2021-05-03 13:34:11 -04:00
Tobias Lindberg
b82067f425
Delete no-response.yml
2021-05-03 19:31:38 +02:00
Tobias Lindberg
f6330924c1
Update stale.yml
2021-05-03 19:29:13 +02:00
Alec O'Connor
08840506c9
Update v1_TeslaMateAPICarsChargesDetails.go
...
Missing comma. Please build and test the SQL, I'm unsure how.
2021-05-03 13:27:56 -04:00
Alec O'Connor
ef67d068cc
fast_charger_brand can be NULL, causes fatal error
...
Fatal error detected:
`sql: Scan error on column index 18, name "fast_charger_brand": converting NULL to string is unsupported`
Causes ChargeDetail API endpoint to fail. Solution was to add default string value for `fast_charger_brand`
2021-05-03 13:15:51 -04:00
Tobias Lindberg
381bcb9164
bumping new version v1.5.0
...
updating CHANGELOG
v1.5.0
2021-05-03 19:08:41 +02:00
Tobias Lindberg
e78304cf26
Merge pull request #37 from alecdoconnor/patch-1
...
Convert SpeedMax and SpeedAvg in Drive (km->mi)
2021-05-03 19:03:08 +02:00
Alec O'Connor
7693581864
Convert SpeedMax and SpeedAvg in Drive (km->mi)
...
Already implemented in DriveDetails, logic was duplicated exactly in this pull request
2021-05-03 11:43:20 -04:00
Tobias Lindberg
38c0eb74da
bumping new version v1.4.9
...
updating CHANGELOG
v1.4.9
2021-05-03 13:49:04 +02:00
Tobias Lindberg
74d360f1b4
Merge pull request #35 from tobiasehlert/dependabot/github_actions/crazy-max/ghaction-docker-meta-v2.4.0
...
Bump crazy-max/ghaction-docker-meta from v2.3.0 to v2.4.0
2021-05-03 13:13:51 +02:00
Tobias Lindberg
cc015ba3db
Update build.yml
...
removing github.event_name if statement
2021-05-03 12:38:05 +02:00
dependabot[bot]
84cc4c887f
Bump crazy-max/ghaction-docker-meta from v2.3.0 to v2.4.0
...
Bumps [crazy-max/ghaction-docker-meta](https://github.com/crazy-max/ghaction-docker-meta ) from v2.3.0 to v2.4.0.
- [Release notes](https://github.com/crazy-max/ghaction-docker-meta/releases )
- [Changelog](https://github.com/crazy-max/ghaction-docker-meta/blob/master/CHANGELOG.md )
- [Commits](https://github.com/crazy-max/ghaction-docker-meta/compare/v2.3.0...e09df4df3ce0f1198fcfa91b72743b2cb7969430 )
Signed-off-by: dependabot[bot] <support@github.com >
2021-04-30 07:03:34 +00:00
Tobias Lindberg
04f617c6ed
bumping new version v1.4.8
...
updating CHANGELOG
v1.4.8
2021-04-22 14:57:45 +02:00
Tobias Lindberg
35061682d6
Merge pull request #33 from tobiasehlert/dependabot/go_modules/github.com/lib/pq-1.10.1
...
Bump github.com/lib/pq from 1.10.0 to 1.10.1
2021-04-22 14:45:24 +02:00
dependabot[bot]
0d96d5d228
Bump github.com/lib/pq from 1.10.0 to 1.10.1
...
Bumps [github.com/lib/pq](https://github.com/lib/pq ) from 1.10.0 to 1.10.1.
- [Release notes](https://github.com/lib/pq/releases )
- [Commits](https://github.com/lib/pq/compare/v1.10.0...v1.10.1 )
Signed-off-by: dependabot[bot] <support@github.com >
2021-04-22 07:05:12 +00:00
Tobias Lindberg
6f60bdc132
bumping new version v1.4.7
...
updating CHANGELOG
v1.4.7
2021-04-13 12:53:14 +02:00
Tobias Lindberg
7e4b75ed21
Merge pull request #32 from tobiasehlert/dependabot/github_actions/actions/cache-v2.1.5
...
Bump actions/cache from v2.1.4 to v2.1.5
2021-04-13 12:49:41 +02:00
dependabot[bot]
063f005c6a
Bump actions/cache from v2.1.4 to v2.1.5
...
Bumps [actions/cache](https://github.com/actions/cache ) from v2.1.4 to v2.1.5.
- [Release notes](https://github.com/actions/cache/releases )
- [Commits](https://github.com/actions/cache/compare/v2.1.4...1a9e2138d905efd099035b49d8b7a3888c653ca8 )
Signed-off-by: dependabot[bot] <support@github.com >
2021-04-13 07:16:01 +00:00
Tobias Lindberg
daff4f80ba
Rename V1_TeslaMateAPICarsChargesDetails.go to v1_TeslaMateAPICarsChargesDetails.go
2021-04-12 14:32:28 +02:00
Tobias Lindberg
bfa7b97e5b
bumping new version v1.4.6
...
updating CHANGELOG
v1.4.6
2021-04-09 15:03:14 +02:00
Tobias Lindberg
569e3a120c
Merge pull request #31 from tobiasehlert/dependabot/go_modules/github.com/gin-gonic/gin-1.7.1
...
Bump github.com/gin-gonic/gin from 1.6.3 to 1.7.1
2021-04-09 13:56:20 +02:00
dependabot[bot]
61d8e4e6e8
Bump github.com/gin-gonic/gin from 1.6.3 to 1.7.1
...
Bumps [github.com/gin-gonic/gin](https://github.com/gin-gonic/gin ) from 1.6.3 to 1.7.1.
- [Release notes](https://github.com/gin-gonic/gin/releases )
- [Changelog](https://github.com/gin-gonic/gin/blob/master/CHANGELOG.md )
- [Commits](https://github.com/gin-gonic/gin/compare/v1.6.3...v1.7.1 )
Signed-off-by: dependabot[bot] <support@github.com >
2021-04-09 07:18:10 +00:00
Tobias Lindberg
6f95c904fd
Merge pull request #30 from tobiasehlert/dependabot/github_actions/crazy-max/ghaction-docker-meta-v2.3.0
...
Bump crazy-max/ghaction-docker-meta from v2.2.1 to v2.3.0
2021-04-09 07:53:09 +02:00
dependabot[bot]
2170e90657
Bump crazy-max/ghaction-docker-meta from v2.2.1 to v2.3.0
...
Bumps [crazy-max/ghaction-docker-meta](https://github.com/crazy-max/ghaction-docker-meta ) from v2.2.1 to v2.3.0.
- [Release notes](https://github.com/crazy-max/ghaction-docker-meta/releases )
- [Changelog](https://github.com/crazy-max/ghaction-docker-meta/blob/master/CHANGELOG.md )
- [Commits](https://github.com/crazy-max/ghaction-docker-meta/compare/v2.2.1...2e1a5c7fa42123697f82d479b551a1bbdb1bef88 )
Signed-off-by: dependabot[bot] <support@github.com >
2021-04-08 07:11:11 +00:00
Tobias Lindberg
27d09fdd7a
bumping new version v1.4.5
...
updating CHANGELOG
v1.4.5
2021-04-06 10:31:05 +02:00
Tobias Lindberg
c36017e7eb
Merge pull request #29 from tobiasehlert/dependabot/github_actions/crazy-max/ghaction-docker-meta-v2.2.1
...
Bump crazy-max/ghaction-docker-meta from v2.2.0 to v2.2.1
2021-04-06 10:29:19 +02:00
dependabot[bot]
f106bde15f
Bump crazy-max/ghaction-docker-meta from v2.2.0 to v2.2.1
...
Bumps [crazy-max/ghaction-docker-meta](https://github.com/crazy-max/ghaction-docker-meta ) from v2.2.0 to v2.2.1.
- [Release notes](https://github.com/crazy-max/ghaction-docker-meta/releases )
- [Changelog](https://github.com/crazy-max/ghaction-docker-meta/blob/master/CHANGELOG.md )
- [Commits](https://github.com/crazy-max/ghaction-docker-meta/compare/v2.2.0...f39f06a624f9ca2c5d27758aa88932d443e9eda2 )
Signed-off-by: dependabot[bot] <support@github.com >
2021-04-06 07:12:16 +00:00
Tobias Lindberg
b700288f85
bumping new version v1.4.4
...
updating CHANGELOG
v1.4.4
2021-04-05 19:45:26 +02:00
Tobias Lindberg
fee87903cd
Merge pull request #27 from tobiasehlert/dependabot/docker/golang-1.16.3
...
Bump golang from 1.16.2 to 1.16.3
2021-04-05 19:43:12 +02:00
Tobias Lindberg
49f7ff6150
Merge pull request #28 from tobiasehlert/dependabot/github_actions/crazy-max/ghaction-docker-meta-v2.2.0
...
Bump crazy-max/ghaction-docker-meta from v2.1.1 to v2.2.0
2021-04-05 19:41:32 +02:00