From 61147374345216ce27c2bc828fc2afb98f4afc08 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sat, 19 Aug 2023 19:37:44 +0200 Subject: [PATCH 01/53] Added aarch64 architecture --- .github/workflows/leaf2mqtt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 9acd6c3..0475443 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -45,7 +45,7 @@ jobs: with: context: . push: true - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/arm/v8 tags: ${{ steps.meta.outputs.tags }} update_addon: From 15db23c7064d4606eaf8e312071a720fd988002c Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 3 Sep 2023 21:20:41 +0200 Subject: [PATCH 02/53] Added requestBatteryStatusRefresh() to fetchBatteryStatus() This change forces refresh of battery status when requesting battery statys --- src/leaf/nissan_connect_wrapper.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/leaf/nissan_connect_wrapper.dart b/src/leaf/nissan_connect_wrapper.dart index b5da97f..5d93457 100644 --- a/src/leaf/nissan_connect_wrapper.dart +++ b/src/leaf/nissan_connect_wrapper.dart @@ -66,6 +66,8 @@ class NissanConnectVehicleWrapper extends VehicleInternal { @override Future> fetchBatteryStatus() async { + await _getVehicle().requestBatteryStatusRefresh(); + final NissanConnectBattery battery = await _getVehicle().requestBatteryStatus(); final int percentage = From e93bca5a79c46ce677fe3ff596a793ab17d09fd6 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 3 Sep 2023 21:35:19 +0200 Subject: [PATCH 03/53] use DOCKERHUBUSERNAME as part of repository name --- .github/workflows/leaf2mqtt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 0475443..67ced0c 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -35,7 +35,7 @@ jobs: id: meta uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: - images: yp87/leaf2mqtt + images: ${{ secrets.DOCKERHUBUSERNAME }}/leaf2mqtt tags: | type=raw,value=${{ github.run_number }} type=raw,value=latest From 8be70f59579b831c20b608195d41ef823d6b1507 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 3 Sep 2023 19:41:01 +0000 Subject: [PATCH 04/53] Update add-on version --- addon/config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addon/config.json b/addon/config.json index 12a6fa5..bedd250 100644 --- a/addon/config.json +++ b/addon/config.json @@ -1,6 +1,6 @@ { "name": "Leaf2MQTT", - "version": "46", + "version": "4", "slug": "leaf2mqtt", "description": "Interact with your Nissan Leaf using MQTT", "startup": "application", @@ -38,4 +38,4 @@ "COMMAND_ATTEMPTS": "int(1,)?", "LOG_LEVEL": "list(All|Info|Warning|Severe)" } -} +} \ No newline at end of file From 304f496c771c41ace07b86b940860250f9716b95 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 9 Oct 2023 21:01:24 +0000 Subject: [PATCH 05/53] Update add-on version --- addon/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/config.json b/addon/config.json index bedd250..e04dea2 100644 --- a/addon/config.json +++ b/addon/config.json @@ -1,6 +1,6 @@ { "name": "Leaf2MQTT", - "version": "4", + "version": "5", "slug": "leaf2mqtt", "description": "Interact with your Nissan Leaf using MQTT", "startup": "application", From 51d888ef6793a4824e12dc54bd33ee67ddd0a550 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Thu, 12 Oct 2023 14:58:23 +0200 Subject: [PATCH 06/53] switch to own repo for dartnissanconnect --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index ab78908..7ba7dbb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ dependencies: dartnissanconnectna: git: https://gitlab.com/tobiaswkjeldsen/dartnissanconnectna dartnissanconnect: - git: https://gitlab.com/sensor-freak/dartnissanconnect + git: https://github.com/kamiKAC/dartnissanconnect dartcarwings: git: https://github.com/Tobiaswk/dartcarwings mqtt_client: ^9.6.1 From c412d434db737039edfa14a675f488731a521e29 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Thu, 12 Oct 2023 13:04:46 +0000 Subject: [PATCH 07/53] Update add-on version --- addon/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/config.json b/addon/config.json index e04dea2..66c28d1 100644 --- a/addon/config.json +++ b/addon/config.json @@ -1,6 +1,6 @@ { "name": "Leaf2MQTT", - "version": "5", + "version": "6", "slug": "leaf2mqtt", "description": "Interact with your Nissan Leaf using MQTT", "startup": "application", From 21d447fea5e7585dc2e37116d3e0f361f97dbd25 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 30 Oct 2023 20:36:04 +0100 Subject: [PATCH 08/53] use prebuilt docker image --- docker-compose.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6d7e53d..4132897 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,7 @@ version: "3" services: leaf2mqtt: container_name: leaf2mqtt - build: . - image: leaf2mqtt + image: kamikac/leaf2mqtt logging: options: max-size: "1M" From 167d192244ed05dc87493405bcdbaa91ef6cdef9 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 20 May 2024 22:50:16 +0200 Subject: [PATCH 09/53] ci: add release-please --- .github/workflows/leaf2mqtt.yml | 37 ++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 67ced0c..8b6f319 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -12,8 +12,37 @@ on: - main jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@v4 + id: release + with: + release-type: dart + token: ${{ secrets.GH_TOKEN }} + - uses: actions/checkout@v4 + - name: tag major and minor versions + if: ${{ steps.release.outputs.release_created }} + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + git config --global url."https://${{ secrets.GH_TOKEN }}@github.com/".insteadOf "https://github.com/" + git tag -d v${{ steps.release.outputs.major }} || true + git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true + git push origin :v${{ steps.release.outputs.major }} || true + git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true + git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}" + git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}" + git push origin v${{ steps.release.outputs.major }} + git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} + outputs: + release_created: ${{ steps.release.outputs.release_created }} + tag_name: ${{ steps.release.outputs.tag_name }} push_to_registry: name: Push Docker image to Docker Hub + needs: + - release-please + if: needs.release-please.outputs.release_created runs-on: ubuntu-latest steps: - name: Check out the repo @@ -37,7 +66,7 @@ jobs: with: images: ${{ secrets.DOCKERHUBUSERNAME }}/leaf2mqtt tags: | - type=raw,value=${{ github.run_number }} + type=raw,value=${{ needs.release-please.outputs.tag_name }} type=raw,value=latest - name: Build and push Docker image @@ -50,7 +79,9 @@ jobs: update_addon: name: Update Home Assistant add-on - needs: push_to_registry + needs: + - release-please + - push_to_registry runs-on: ubuntu-latest permissions: contents: write @@ -63,7 +94,7 @@ jobs: with: file: addon/config.json field: version - value: ${{ github.run_number }} + value: ${{ needs.release-please.outputs.tag_name }} - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v4 From 782e8b9f32deb8463e1463570dea91bd21d1f9e8 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 20 May 2024 23:17:04 +0200 Subject: [PATCH 10/53] ci: change docker image tagging --- .github/workflows/leaf2mqtt.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 8b6f319..41babb7 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -13,6 +13,7 @@ on: jobs: release-please: + if: github.event_name != 'workflow_dispatch' runs-on: ubuntu-latest steps: - uses: googleapis/release-please-action@v4 @@ -42,7 +43,7 @@ jobs: name: Push Docker image to Docker Hub needs: - release-please - if: needs.release-please.outputs.release_created + if: needs.release-please.outputs.release_created || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest steps: - name: Check out the repo @@ -66,8 +67,9 @@ jobs: with: images: ${{ secrets.DOCKERHUBUSERNAME }}/leaf2mqtt tags: | - type=raw,value=${{ needs.release-please.outputs.tag_name }} - type=raw,value=latest + type=raw,value=${{ needs.release-please.outputs.tag_name }},enable={{is_default_branch}} + type=raw,value=latest,enable={{is_default_branch}} + type=raw,value=edge,enable={{is_default_branch == 'false'}} - name: Build and push Docker image uses: docker/build-push-action@v2 @@ -82,6 +84,7 @@ jobs: needs: - release-please - push_to_registry + if: github.event_name != 'workflow_dispatch' runs-on: ubuntu-latest permissions: contents: write From 6002cf4c529b257fd5ab46e17f0cd7ee291b332b Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 20 May 2024 23:18:24 +0200 Subject: [PATCH 11/53] chore: release 0.0.2 Release-As: 0.0.2 From 34310cebe86e40d2fa7da143cdfad4e8e3a4bae1 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 20 May 2024 23:22:19 +0200 Subject: [PATCH 12/53] ci: remove paths from push event --- .github/workflows/leaf2mqtt.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 41babb7..ce9444f 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -3,11 +3,6 @@ name: Publish Docker image on: workflow_dispatch: push: - paths: - - 'pubspec.*' - - 'src/**' - - 'Dockerfile' - - '.github/workflows/**' branches: - main From 8a0afd56cb28406bdd00d6461cbbaf2318a9cee8 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 20 May 2024 23:23:32 +0200 Subject: [PATCH 13/53] chore(main): release 0.0.2 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8d59183 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog + +## 0.0.2 (2024-05-20) + + +### Miscellaneous Chores + +* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) From fe2b3b8bdb9d5c9fd524b402e04071b33377a32d Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 20 May 2024 23:32:25 +0200 Subject: [PATCH 14/53] ci: change docker/metedata-action to v5 --- .github/workflows/leaf2mqtt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index ce9444f..b415241 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -58,7 +58,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v5 with: images: ${{ secrets.DOCKERHUBUSERNAME }}/leaf2mqtt tags: | From 1509dc4ccc73ed50f11cf1727ef6821b58972251 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 20 May 2024 23:34:32 +0200 Subject: [PATCH 15/53] chore: release 0.0.2 Release-As: 0.0.2 From 4eb0f239042c6c19df471c0a62333e55d72ca814 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 20 May 2024 23:36:05 +0200 Subject: [PATCH 16/53] chore(main): release 0.0.2 (#4) --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d59183..c83a196 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) + + +### Miscellaneous Chores + +* release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) +* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) + ## 0.0.2 (2024-05-20) From 926e12918c90fe9a02248d91d4983ba132511d8d Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 20 May 2024 23:43:54 +0200 Subject: [PATCH 17/53] ci: move token to checkout action --- .github/workflows/leaf2mqtt.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index b415241..9cab6bd 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -17,12 +17,13 @@ jobs: release-type: dart token: ${{ secrets.GH_TOKEN }} - uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} - name: tag major and minor versions if: ${{ steps.release.outputs.release_created }} run: | git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com - git config --global url."https://${{ secrets.GH_TOKEN }}@github.com/".insteadOf "https://github.com/" git tag -d v${{ steps.release.outputs.major }} || true git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true git push origin :v${{ steps.release.outputs.major }} || true From a4e0a2d7553089b29a8db0b5f9059dea0225e281 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 20 May 2024 23:52:07 +0200 Subject: [PATCH 18/53] chore(main): release 0.0.2 (#6) --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c83a196..09d104a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ ## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) +### Miscellaneous Chores + +* release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) +* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) + +## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) + + ### Miscellaneous Chores * release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) From 3e32707376ebcf02d46a99c339eca3c45ae924d5 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Tue, 21 May 2024 00:07:23 +0200 Subject: [PATCH 19/53] chore(main): release 0.0.2 (#7) --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09d104a..b4aced7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,14 @@ ## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) +### Miscellaneous Chores + +* release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) +* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) + +## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) + + ### Miscellaneous Chores * release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) From e0c70fe26c47fba9b25ccf1e22ae722e652cad20 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Tue, 21 May 2024 00:18:32 +0200 Subject: [PATCH 20/53] ci: Introduce release-please (#9) * ci: add branch 'test' for testing purposes * chore(main): release 0.0.2 (#5) * ci: change tags metadata * chore: release 0.0.2 Release-As: 0.0.2 * ci: remove branch 'test' --- .github/workflows/leaf2mqtt.yml | 6 +++--- CHANGELOG.md | 32 -------------------------------- 2 files changed, 3 insertions(+), 35 deletions(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 9cab6bd..58651af 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -63,9 +63,9 @@ jobs: with: images: ${{ secrets.DOCKERHUBUSERNAME }}/leaf2mqtt tags: | - type=raw,value=${{ needs.release-please.outputs.tag_name }},enable={{is_default_branch}} - type=raw,value=latest,enable={{is_default_branch}} - type=raw,value=edge,enable={{is_default_branch == 'false'}} + type=raw,value=${{ needs.release-please.outputs.tag_name }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} + type=raw,value=edge,enable${{ github.ref != format('refs/heads/{0}', 'main') }} - name: Build and push Docker image uses: docker/build-push-action@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index b4aced7..e69de29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,32 +0,0 @@ -# Changelog - -## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) - - -### Miscellaneous Chores - -* release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) -* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) - -## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) - - -### Miscellaneous Chores - -* release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) -* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) - -## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) - - -### Miscellaneous Chores - -* release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) -* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) - -## 0.0.2 (2024-05-20) - - -### Miscellaneous Chores - -* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) From c9c96ab2387bc7698b6e1ad0e92c5a08e5e32a06 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Tue, 21 May 2024 00:24:09 +0200 Subject: [PATCH 21/53] chore(main): release 0.0.2 (#8) --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29..bacb893 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Changelog + +## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) + + +### Miscellaneous Chores + +* release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) +* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) From f9b7205c744e4c7d5650387816eec11014ea22f8 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 20 May 2024 22:28:12 +0000 Subject: [PATCH 22/53] Update add-on version --- addon/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/config.json b/addon/config.json index 66c28d1..8924de2 100644 --- a/addon/config.json +++ b/addon/config.json @@ -1,6 +1,6 @@ { "name": "Leaf2MQTT", - "version": "6", + "version": "v0.0.2", "slug": "leaf2mqtt", "description": "Interact with your Nissan Leaf using MQTT", "startup": "application", From f0757cbc9af3d963abb0b9ac009f059dff6d8dc6 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Tue, 21 May 2024 00:44:29 +0200 Subject: [PATCH 23/53] ci: Re-release v0.0.2 with dartnissanconnect v1.0.4 (#10) * build: specify dartnissanconnect ref * ci: fix typo * chore: release 0.0.2 Release-As: 0.0.2 --- .github/workflows/leaf2mqtt.yml | 2 +- pubspec.yaml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 58651af..6b922b1 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -65,7 +65,7 @@ jobs: tags: | type=raw,value=${{ needs.release-please.outputs.tag_name }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} - type=raw,value=edge,enable${{ github.ref != format('refs/heads/{0}', 'main') }} + type=raw,value=edge,enable=${{ github.ref != format('refs/heads/{0}', 'main') }} - name: Build and push Docker image uses: docker/build-push-action@v2 diff --git a/pubspec.yaml b/pubspec.yaml index 7ba7dbb..7906c3a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,9 @@ dependencies: dartnissanconnectna: git: https://gitlab.com/tobiaswkjeldsen/dartnissanconnectna dartnissanconnect: - git: https://github.com/kamiKAC/dartnissanconnect + git: + url: git@github.com:kamiKAC/dartnissanconnect + ref: v1.0.4 dartcarwings: git: https://github.com/Tobiaswk/dartcarwings mqtt_client: ^9.6.1 From b13df4676dee065fbdbffb0358512943d55de638 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Tue, 21 May 2024 00:47:12 +0200 Subject: [PATCH 24/53] chore(main): release 0.0.2 (#11) --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bacb893..ee93fee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,19 @@ ## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) +### Miscellaneous Chores + +* release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) +* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) + + +### Continuous Integration + +* Re-release v0.0.2 with dartnissanconnect v1.0.4 ([#10](https://github.com/kamiKAC/leaf2mqtt/issues/10)) ([f0757cb](https://github.com/kamiKAC/leaf2mqtt/commit/f0757cbc9af3d963abb0b9ac009f059dff6d8dc6)) + +## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) + + ### Miscellaneous Chores * release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) From 551446c5872921d36a6f662b55df5bce04ebb566 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Tue, 21 May 2024 01:10:11 +0200 Subject: [PATCH 25/53] ci: Re-release v0.0.2 with dartnissanconnect v1.0.4 (#12) * fix wrong repo name * ci: change publish condition * ci change url for dartnissanconnect * chore: release 0.0.2 Release-As: 0.0.2 --- .github/workflows/leaf2mqtt.yml | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 6b922b1..0abaaa2 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -39,7 +39,7 @@ jobs: name: Push Docker image to Docker Hub needs: - release-please - if: needs.release-please.outputs.release_created || github.event_name == 'workflow_dispatch' + if: ${{ ! cancelled() && needs.release-please.outputs.release_created || github.event_name == 'workflow_dispatch' }} runs-on: ubuntu-latest steps: - name: Check out the repo diff --git a/pubspec.yaml b/pubspec.yaml index 7906c3a..5f47e70 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ dependencies: git: https://gitlab.com/tobiaswkjeldsen/dartnissanconnectna dartnissanconnect: git: - url: git@github.com:kamiKAC/dartnissanconnect + url: https://github.com/kamiKAC/dartnissanconnect ref: v1.0.4 dartcarwings: git: https://github.com/Tobiaswk/dartcarwings From 7ed658b7ed300fdb3ec724d7d9a59ab8ad9fb597 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Tue, 21 May 2024 01:16:13 +0200 Subject: [PATCH 26/53] chore(main): release 0.0.2 (#13) --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee93fee..1af280b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,20 @@ * release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) +### Continuous Integration + +* Re-release v0.0.2 with dartnissanconnect v1.0.4 ([#10](https://github.com/kamiKAC/leaf2mqtt/issues/10)) ([f0757cb](https://github.com/kamiKAC/leaf2mqtt/commit/f0757cbc9af3d963abb0b9ac009f059dff6d8dc6)) +* Re-release v0.0.2 with dartnissanconnect v1.0.4 ([#12](https://github.com/kamiKAC/leaf2mqtt/issues/12)) ([551446c](https://github.com/kamiKAC/leaf2mqtt/commit/551446c5872921d36a6f662b55df5bce04ebb566)) + +## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) + + +### Miscellaneous Chores + +* release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) +* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) + + ### Continuous Integration * Re-release v0.0.2 with dartnissanconnect v1.0.4 ([#10](https://github.com/kamiKAC/leaf2mqtt/issues/10)) ([f0757cb](https://github.com/kamiKAC/leaf2mqtt/commit/f0757cbc9af3d963abb0b9ac009f059dff6d8dc6)) From 1d2315ee762b6a764c6c203553e7fd40806b34c3 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Tue, 21 May 2024 01:23:05 +0200 Subject: [PATCH 27/53] fix: update to dartnissanconnect v1.0.5 (#14) * fix: bump dartnissnconnect to v1.0.5 * ci: enable 'Update Home Assistant add-on' job --- .github/workflows/leaf2mqtt.yml | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 0abaaa2..a79db41 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -80,7 +80,7 @@ jobs: needs: - release-please - push_to_registry - if: github.event_name != 'workflow_dispatch' + if: ${{ ! cancelled() && github.event_name != 'workflow_dispatch' }} runs-on: ubuntu-latest permissions: contents: write diff --git a/pubspec.yaml b/pubspec.yaml index 5f47e70..e8eb6d1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,7 @@ dependencies: dartnissanconnect: git: url: https://github.com/kamiKAC/dartnissanconnect - ref: v1.0.4 + ref: v1.0.5 dartcarwings: git: https://github.com/Tobiaswk/dartcarwings mqtt_client: ^9.6.1 From 6ae5ae466e32f6160c75039d79c60c5936c3f988 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Tue, 21 May 2024 01:32:39 +0200 Subject: [PATCH 28/53] ci: fix if workflow condition (#16) * fix: bump dartnissnconnect to v1.0.5 * ci: enable 'Update Home Assistant add-on' job * ci: fix wrong if condition * ci: fix wrong if condition --- .github/workflows/leaf2mqtt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index a79db41..8d4a9cb 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -80,7 +80,7 @@ jobs: needs: - release-please - push_to_registry - if: ${{ ! cancelled() && github.event_name != 'workflow_dispatch' }} + if: ${{ ! cancelled() && needs.release-please.outputs.release_created || github.event_name != 'workflow_dispatch' }} runs-on: ubuntu-latest permissions: contents: write From b9dd7062ed9623bf945e4bccaf725b80da2e2e31 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Tue, 21 May 2024 08:21:29 +0100 Subject: [PATCH 29/53] build: Update repo name in various places (#2) --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- README.md | 8 ++++---- addon/Dockerfile | 2 +- addon/config.json | 4 ++-- repository.json | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7a6984a..90618f5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -3,7 +3,7 @@ name: Bug report about: Create a report to help us improve title: '' labels: '' -assignees: yp87 +assignees: kamiKAC --- diff --git a/README.md b/README.md index c2e761a..0938641 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Docker Pulls](https://img.shields.io/docker/pulls/yp87/leaf2mqtt) ![Docker Image Version (latest by date)](https://img.shields.io/docker/v/yp87/leaf2mqtt) +![Docker Pulls](https://img.shields.io/docker/pulls/kamikac/leaf2mqtt) ![Docker Image Version (latest by date)](https://img.shields.io/docker/v/kamikac/leaf2mqtt) # leaf2mqtt > :warning: olderCanada and olderUSA support may break at anytime because Nissan keep changing the API key. Thank you Nissan for working against your customers. @@ -42,12 +42,12 @@ Should work with multiple Leafs, but it is untested. Please open an issue with f ### Home Assistant add-on Click the icon below to add this repository to your Home Assistant instance or follow the procedure highlighted on the [Home Assistant website](https://home-assistant.io/hassio/installing_third_party_addons). -[![Install leaf2mqtt add-on repo.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fyp87%2Fleaf2mqtt) +[![Install leaf2mqtt add-on repo.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2FkamiKAC%2Fleaf2mqtt) ### Pre-built images -You can use pre-built images from here: https://hub.docker.com/r/yp87/leaf2mqtt +You can use pre-built images from here: https://hub.docker.com/r/kamikac/leaf2mqtt -tag example: `yp87/leaf2mqtt:latest` +tag example: `kamikac/leaf2mqtt:latest` ### Building the image diff --git a/addon/Dockerfile b/addon/Dockerfile index 1e19396..acd0e61 100644 --- a/addon/Dockerfile +++ b/addon/Dockerfile @@ -1,7 +1,7 @@ ARG BUILD_VERSION ARG BUILD_ARCH -FROM yp87/leaf2mqtt:${BUILD_VERSION} AS build +FROM kamikac/leaf2mqtt:${BUILD_VERSION} AS build FROM ghcr.io/hassio-addons/base/${BUILD_ARCH}:stable COPY --from=build / / diff --git a/addon/config.json b/addon/config.json index 8924de2..632cf83 100644 --- a/addon/config.json +++ b/addon/config.json @@ -4,7 +4,7 @@ "slug": "leaf2mqtt", "description": "Interact with your Nissan Leaf using MQTT", "startup": "application", - "url": "https://github.com/yp87/leaf2mqtt", + "url": "https://github.com/kamiKAC/leaf2mqtt", "init": false, "arch": [ "aarch64", @@ -38,4 +38,4 @@ "COMMAND_ATTEMPTS": "int(1,)?", "LOG_LEVEL": "list(All|Info|Warning|Severe)" } -} \ No newline at end of file +} diff --git a/repository.json b/repository.json index a65a896..7632666 100644 --- a/repository.json +++ b/repository.json @@ -1,5 +1,5 @@ { "name": "LEAF2MQTT Home Assistant add-on repository", - "url": "https://github.com/yp87/leaf2mqtt", - "maintainer": "YP87 " + "url": "https://github.com/kamiKAC/leaf2mqtt", + "maintainer": "kamiKAC " } From 924ff111529bdfad65d0857c02392b039d127436 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Tue, 21 May 2024 09:47:34 +0200 Subject: [PATCH 30/53] ci: fix workflow condition (#17) --- .github/workflows/leaf2mqtt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 8d4a9cb..ba45800 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -80,7 +80,7 @@ jobs: needs: - release-please - push_to_registry - if: ${{ ! cancelled() && needs.release-please.outputs.release_created || github.event_name != 'workflow_dispatch' }} + if: ${{ ! cancelled() && needs.release-please.outputs.release_created && github.event_name != 'workflow_dispatch' }} runs-on: ubuntu-latest permissions: contents: write From e0e09ba8509b04af8b945618fc65df829552d3ef Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Tue, 21 May 2024 11:36:48 +0200 Subject: [PATCH 31/53] chore(main): release 0.0.3 (#15) --- CHANGELOG.md | 7 +++++++ pubspec.yaml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1af280b..04df84e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.0.3](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.3) (2024-05-21) + + +### Bug Fixes + +* update to dartnissanconnect v1.0.5 ([#14](https://github.com/kamiKAC/leaf2mqtt/issues/14)) ([1d2315e](https://github.com/kamiKAC/leaf2mqtt/commit/1d2315ee762b6a764c6c203553e7fd40806b34c3)) + ## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) diff --git a/pubspec.yaml b/pubspec.yaml index e8eb6d1..d1c68eb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: leaf2mqtt -version: 0.0.2 +version: 0.0.3 publish_to: 'none' dependencies: dartnissanconnectna: From fc84aa2fbd662dd8af443ff5b1d61774b9d5ad86 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Tue, 21 May 2024 09:40:54 +0000 Subject: [PATCH 32/53] Update add-on version --- addon/config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addon/config.json b/addon/config.json index 632cf83..91501c1 100644 --- a/addon/config.json +++ b/addon/config.json @@ -1,6 +1,6 @@ { "name": "Leaf2MQTT", - "version": "v0.0.2", + "version": "v0.0.3", "slug": "leaf2mqtt", "description": "Interact with your Nissan Leaf using MQTT", "startup": "application", @@ -38,4 +38,4 @@ "COMMAND_ATTEMPTS": "int(1,)?", "LOG_LEVEL": "list(All|Info|Warning|Severe)" } -} +} \ No newline at end of file From 1c15deedb63ee09656992f8301052041da2ffd92 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Wed, 22 May 2024 00:26:19 +0200 Subject: [PATCH 33/53] ci: move addon/config.json update to release-please (#18) --- .github/workflows/leaf2mqtt.yml | 27 +-------------------------- .release-please-manifest.json | 10 ++++++++++ 2 files changed, 11 insertions(+), 26 deletions(-) create mode 100644 .release-please-manifest.json diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index ba45800..4b2c3e1 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -73,29 +73,4 @@ jobs: context: . push: true platforms: linux/amd64,linux/arm64,linux/arm/v8 - tags: ${{ steps.meta.outputs.tags }} - - update_addon: - name: Update Home Assistant add-on - needs: - - release-please - - push_to_registry - if: ${{ ! cancelled() && needs.release-please.outputs.release_created && github.event_name != 'workflow_dispatch' }} - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Change image version number - uses: jossef/action-set-json-field@v1 - with: - file: addon/config.json - field: version - value: ${{ needs.release-please.outputs.tag_name }} - - - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Update add-on version + tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..5c6bb50 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,10 @@ +{ + ".": "0.0.3", + "extra-files": [ + { + "type": "json", + "path": "addon/config.json", + "jsonpath": "$.version" + } + ] +} \ No newline at end of file From d19c52ce5766015c1568115a930b3eb44d88d073 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Fri, 14 Jun 2024 22:26:30 +0200 Subject: [PATCH 34/53] fix: reorder of status fetch (#21) * fix: change fetchAndPublish order * feat: add updateall to command/status * move targetDate outside return * add missing break * remove unnecessary argument * build: add package_info_plus to display package version in logs * build: correct wrong package_info_plus ver * Revert "build: correct wrong package_info_plus ver" This reverts commit 270aab413da8862ca36376915329e9588bad6b83. * Revert "build: add package_info_plus to display package version in logs" This reverts commit 1a4f352156f134aea81b73a45cba28553ebf6c8a. * build: add pubspec_parse pacge to read app name and version * build: downgrade pubspec_parse to ver compatible with SDK v2 * build: add space * build: refactor log.info * Revert "build: refactor log.info" This reverts commit 4a0e2bcd27d8dfca450604d1baad068cf246e0fa. * Revert "build: add space" This reverts commit 5a343aab8ae11d0d6fcb1a6487a36082bb952a35. * Revert "build: downgrade pubspec_parse to ver compatible with SDK v2" This reverts commit 8875864e289aa236137f93f49ad40417a149ef1c. * Revert "build: add pubspec_parse pacge to read app name and version" This reverts commit 865c4b65c539af689a768a3844c371c8f5ee138d. * ci: change versioning in dart file to release-please * Revert "ci: change versioning in dart file to release-please" This reverts commit 3059cc8670918176bc316fe57ae74867f39648ad. * build: use build argument as version source * build: add latest tag to edge build * ci: add fetch-tags to checkout * ci: add fetch-depth * ci: add missing fi * ci: add debug * ci: remove debug output * reverrt: "feat: add updateall to command/status" * build: switch to selfhosted dartcarwings * build: delete pubspec.lock * fix: corrected typo build: switch to dartcarwings v1.0.1 * ci: update build-push-action to v5 ci: update several actions --- .github/workflows/leaf2mqtt.yml | 36 +++++-- Dockerfile | 3 +- pubspec.lock | 168 -------------------------------- pubspec.yaml | 4 +- src/leaf_2_mqtt.dart | 15 +-- 5 files changed, 42 insertions(+), 184 deletions(-) delete mode 100644 pubspec.lock diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 4b2c3e1..fc0c49c 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -43,20 +43,39 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + fetch-tags: true + fetch-depth: 200 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Log in to Docker Hub - uses: docker/login-action@v1.10.0 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUBUSERNAME }} password: ${{ secrets.DOCKERHUBACCESSTOKEN }} - + + - name: Get nearest tag + id: get-nearest-tag + if: ${{ github.ref != format('refs/heads/{0}', 'main') }} + shell: bash + run: |- + TAGS=$(git tag --list) + NEAREST_TAG=$(git describe --tags --abbrev=0) + SPECIFIC_TAG=$(git tag --points-at $(git rev-list -n 1 $NEAREST_TAG) | grep -E 'v[0-9]+\.[0-9]+\.[0-9]+') + if [[ ! -z "$SPECIFIC_TAG" ]]; then + echo "Nearest tag is: $SPECIFIC_TAG" + echo "Using tag ${SPECIFIC_TAG}-edge" + echo "nearest_tag=${SPECIFIC_TAG}-edge" >> $GITHUB_OUTPUT + else + echo "Nearest tag not found, using 'edge' tag" + echo "nearest_tag=edge" >> $GITHUB_OUTPUT + fi - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 @@ -65,12 +84,13 @@ jobs: tags: | type=raw,value=${{ needs.release-please.outputs.tag_name }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} - type=raw,value=edge,enable=${{ github.ref != format('refs/heads/{0}', 'main') }} - + type=raw,value=${{ steps.get-nearest-tag.outputs.nearest_tag }},enable=${{ github.ref != format('refs/heads/{0}', 'main') }} - name: Build and push Docker image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: . + build-args: | + APP_VERSION=${{ steps.meta.outputs.version }} push: true platforms: linux/amd64,linux/arm64,linux/arm/v8 tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 14bcc1a..c4b716f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM dart:2.19.6-sdk AS build +ARG APP_VERSION=unknown RUN apt-get update && \ apt-get install -y git @@ -10,7 +11,7 @@ RUN dart pub get COPY . . RUN dart pub get --offline -RUN dart compile exe src/leaf_2_mqtt.dart -o src/leaf_2_mqtt +RUN dart compile exe -DAPP_VERSION=${APP_VERSION} src/leaf_2_mqtt.dart -o src/leaf_2_mqtt FROM scratch COPY --from=build /runtime/ / diff --git a/pubspec.lock b/pubspec.lock deleted file mode 100644 index 703a42b..0000000 --- a/pubspec.lock +++ /dev/null @@ -1,168 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - blowfish_ecb: - dependency: transitive - description: - name: blowfish_ecb - sha256: ed01f5fcec0bd5ba04242263abd61ae0a01f4211f0aa79dd96367254a5cc5f59 - url: "https://pub.dev" - source: hosted - version: "0.1.0" - clock: - dependency: transitive - description: - name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.dev" - source: hosted - version: "1.1.1" - collection: - dependency: transitive - description: - name: collection - sha256: ef7e3a5529178ce8f37a9d0b11cbbc8b1e025940f9cf9f76c42da6796301219d - url: "https://pub.dev" - source: hosted - version: "1.16.0" - crypto: - dependency: transitive - description: - name: crypto - sha256: cf75650c66c0316274e21d7c43d3dea246273af5955bd94e8184837cd577575c - url: "https://pub.dev" - source: hosted - version: "3.0.1" - dartcarwings: - dependency: "direct main" - description: - path: "." - ref: HEAD - resolved-ref: f54dc13e1910d4e87db6555aef0398cc5e41903c - url: "https://github.com/Tobiaswk/dartcarwings" - source: git - version: "1.0.0" - dartnissanconnect: - dependency: "direct main" - description: - path: "." - ref: HEAD - resolved-ref: ed31b5a3ee6d472aea2a1fb97dbbcf8e90ef04c7 - url: "https://gitlab.com/sensor-freak/dartnissanconnect" - source: git - version: "1.0.4" - dartnissanconnectna: - dependency: "direct main" - description: - path: "." - ref: HEAD - resolved-ref: f2a4335c1fdd605ac0d5444539496eedf85c807f - url: "https://gitlab.com/tobiaswkjeldsen/dartnissanconnectna" - source: git - version: "1.0.0" - event_bus: - dependency: transitive - description: - name: event_bus - sha256: "44baa799834f4c803921873e7446a2add0f3efa45e101a054b1f0ab9b95f8edc" - url: "https://pub.dev" - source: hosted - version: "2.0.0" - http: - dependency: transitive - description: - name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" - url: "https://pub.dev" - source: hosted - version: "0.13.6" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - intl: - dependency: transitive - description: - name: intl - sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91" - url: "https://pub.dev" - source: hosted - version: "0.17.0" - logging: - dependency: "direct main" - description: - name: logging - sha256: "293ae2d49fd79d4c04944c3a26dfd313382d5f52e821ec57119230ae16031ad4" - url: "https://pub.dev" - source: hosted - version: "1.0.2" - meta: - dependency: transitive - description: - name: meta - sha256: "5202fdd37b4da5fd14a237ed0a01cad6c1efd4c99b5b5a0d3c9237f3728c9485" - url: "https://pub.dev" - source: hosted - version: "1.7.0" - mqtt_client: - dependency: "direct main" - description: - name: mqtt_client - sha256: e3fab601bafebeb2cb10d1bc68ddc0b8de987aa5298515d518329c9d8a034257 - url: "https://pub.dev" - source: hosted - version: "9.6.6" - path: - dependency: transitive - description: - name: path - sha256: "240ed0e9bd73daa2182e33c4efc68c7dd53c7c656f3da73515a2d163e151412d" - url: "https://pub.dev" - source: hosted - version: "1.8.1" - source_span: - dependency: transitive - description: - name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.dev" - source: hosted - version: "1.10.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" - url: "https://pub.dev" - source: hosted - version: "1.3.0" -sdks: - dart: ">=2.19.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index d1c68eb..8b3a4c7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,7 +9,9 @@ dependencies: url: https://github.com/kamiKAC/dartnissanconnect ref: v1.0.5 dartcarwings: - git: https://github.com/Tobiaswk/dartcarwings + git: + url: https://github.com/kamiKAC/dartcarwings + ref: v1.0.1 mqtt_client: ^9.6.1 logging: ^1.0.1 environment: diff --git a/src/leaf_2_mqtt.dart b/src/leaf_2_mqtt.dart index 5620685..0dbbf0f 100644 --- a/src/leaf_2_mqtt.dart +++ b/src/leaf_2_mqtt.dart @@ -9,20 +9,22 @@ import 'mqtt_client_wrapper.dart'; LeafSession _session; int _commandAttempts = 2; +const appVersion = String.fromEnvironment('APP_VERSION', defaultValue: 'unknown'); + final Logger _log = Logger('main'); Future main() async { final Map envVars = Platform.environment; - final String logLevelStr = envVars['LOG_LEVEL'] ?? '${Level.WARNING}'; + final String logLevelStr = envVars['LOG_LEVEL'] ?? '${Level.INFO}'; Level logLevel = Level.LEVELS.firstWhere( (Level level) => level.name.toLowerCase() == logLevelStr.toLowerCase(), orElse: () => null); if (logLevel == null) { - print('LOG_LEVEL environment variable should be set to a valid value from: ${Level.LEVELS}. Defaulting to Warning.'); - logLevel = Level.WARNING; + print('LOG_LEVEL environment variable should be set to a valid value from: ${Level.LEVELS}. Defaulting to Info.'); + logLevel = Level.INFO; } Logger.root.level = logLevel; @@ -30,7 +32,7 @@ Future main() async { print('${record.level.name}: ${record.time}: ${record.loggerName}: ${record.message}'); }); - _log.info('V0.11'); + _log.info('Version: ${appVersion}'); final String leafUser = envVars['LEAF_USERNAME']; final String leafPassword = envVars['LEAF_PASSWORD']; @@ -273,9 +275,10 @@ Future fetchAndPublishAllStatus(MqttClientWrapper mqttClient, String vin) Future(() => mqttClient.publishStates( _session.executeSync((Vehicle vehicle) => vehicle.getVehicleStatus(), vin))), fetchAndPublishBatteryStatus(mqttClient, vin), + fetchAndPublishCockpitStatus(mqttClient, vin), fetchAndPublishClimateStatus(mqttClient, vin), - fetchAndPublishLocation(mqttClient, vin), - fetchAndPublishCockpitStatus(mqttClient, vin) + fetchAndPublishLocation(mqttClient, vin) + ]); } From 84295081df13ad9047d6332b537b4d229bc528a1 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Fri, 14 Jun 2024 22:53:43 +0200 Subject: [PATCH 35/53] trigger relase-please From cc7bd4d3cd6397587122e39e2f9df091dff15833 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Fri, 14 Jun 2024 22:55:00 +0200 Subject: [PATCH 36/53] chore(main): release 0.0.4 (#23) --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pubspec.yaml | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 5c6bb50..aa63028 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,5 +1,5 @@ { - ".": "0.0.3", + ".": "0.0.4", "extra-files": [ { "type": "json", diff --git a/CHANGELOG.md b/CHANGELOG.md index 04df84e..f1ce9e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [0.0.4](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.3...v0.0.4) (2024-06-14) + + +### Bug Fixes + +* reorder of status fetch ([#21](https://github.com/kamiKAC/leaf2mqtt/issues/21)) ([d19c52c](https://github.com/kamiKAC/leaf2mqtt/commit/d19c52ce5766015c1568115a930b3eb44d88d073)) +* switch to dartcarwings v1.0.1 (solves [#19](https://github.com/kamiKAC/leaf2mqtt/issues/19)) ([d19c52c](https://github.com/kamiKAC/leaf2mqtt/commit/d19c52ce5766015c1568115a930b3eb44d88d073)) +* use build argument as version source - this enables displaying version of app in logs ([d19c52c](https://github.com/kamiKAC/leaf2mqtt/commit/d19c52ce5766015c1568115a930b3eb44d88d073)) + ## [0.0.3](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.3) (2024-05-21) diff --git a/pubspec.yaml b/pubspec.yaml index 8b3a4c7..0904e96 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: leaf2mqtt -version: 0.0.3 +version: 0.0.4 publish_to: 'none' dependencies: dartnissanconnectna: From d20da53dd81df90a53b87100fee82a745b0902ba Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Fri, 14 Jun 2024 23:23:08 +0200 Subject: [PATCH 37/53] docs: add badge --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0938641..36766df 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -![Docker Pulls](https://img.shields.io/docker/pulls/kamikac/leaf2mqtt) ![Docker Image Version (latest by date)](https://img.shields.io/docker/v/kamikac/leaf2mqtt) +![Docker Pulls](https://img.shields.io/docker/pulls/kamikac/leaf2mqtt) ![Docker Image Version (latest by date)](https://img.shields.io/docker/v/kamikac/leaf2mqtt) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/kamiKAC/leaf2mqtt/leaf2mqtt.yml) + # leaf2mqtt > :warning: olderCanada and olderUSA support may break at anytime because Nissan keep changing the API key. Thank you Nissan for working against your customers. From cf6b71be7af19af79f46833dc94e1b96ab1ae165 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 16 Jun 2024 15:04:37 +0200 Subject: [PATCH 38/53] Revert "chore(main): release 0.0.4 (#23)" (#24) This reverts commit cc7bd4d3cd6397587122e39e2f9df091dff15833. --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 --------- pubspec.yaml | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index aa63028..5c6bb50 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,5 +1,5 @@ { - ".": "0.0.4", + ".": "0.0.3", "extra-files": [ { "type": "json", diff --git a/CHANGELOG.md b/CHANGELOG.md index f1ce9e4..04df84e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,5 @@ # Changelog -## [0.0.4](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.3...v0.0.4) (2024-06-14) - - -### Bug Fixes - -* reorder of status fetch ([#21](https://github.com/kamiKAC/leaf2mqtt/issues/21)) ([d19c52c](https://github.com/kamiKAC/leaf2mqtt/commit/d19c52ce5766015c1568115a930b3eb44d88d073)) -* switch to dartcarwings v1.0.1 (solves [#19](https://github.com/kamiKAC/leaf2mqtt/issues/19)) ([d19c52c](https://github.com/kamiKAC/leaf2mqtt/commit/d19c52ce5766015c1568115a930b3eb44d88d073)) -* use build argument as version source - this enables displaying version of app in logs ([d19c52c](https://github.com/kamiKAC/leaf2mqtt/commit/d19c52ce5766015c1568115a930b3eb44d88d073)) - ## [0.0.3](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.3) (2024-05-21) diff --git a/pubspec.yaml b/pubspec.yaml index 0904e96..8b3a4c7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: leaf2mqtt -version: 0.0.4 +version: 0.0.3 publish_to: 'none' dependencies: dartnissanconnectna: From b6d1b1d1647b3319b350e15592d10827260be0fa Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 16 Jun 2024 15:05:47 +0200 Subject: [PATCH 39/53] Revert "fix: reorder of status fetch (#21)" (#25) This reverts commit d19c52ce5766015c1568115a930b3eb44d88d073. --- .github/workflows/leaf2mqtt.yml | 36 ++----- Dockerfile | 3 +- pubspec.lock | 168 ++++++++++++++++++++++++++++++++ pubspec.yaml | 4 +- src/leaf_2_mqtt.dart | 15 ++- 5 files changed, 184 insertions(+), 42 deletions(-) create mode 100644 pubspec.lock diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index fc0c49c..4b2c3e1 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -43,39 +43,20 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v4 - with: - fetch-tags: true - fetch-depth: 200 + uses: actions/checkout@v2 - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@v1 - name: Log in to Docker Hub - uses: docker/login-action@v3 + uses: docker/login-action@v1.10.0 with: username: ${{ secrets.DOCKERHUBUSERNAME }} password: ${{ secrets.DOCKERHUBACCESSTOKEN }} - - - name: Get nearest tag - id: get-nearest-tag - if: ${{ github.ref != format('refs/heads/{0}', 'main') }} - shell: bash - run: |- - TAGS=$(git tag --list) - NEAREST_TAG=$(git describe --tags --abbrev=0) - SPECIFIC_TAG=$(git tag --points-at $(git rev-list -n 1 $NEAREST_TAG) | grep -E 'v[0-9]+\.[0-9]+\.[0-9]+') - if [[ ! -z "$SPECIFIC_TAG" ]]; then - echo "Nearest tag is: $SPECIFIC_TAG" - echo "Using tag ${SPECIFIC_TAG}-edge" - echo "nearest_tag=${SPECIFIC_TAG}-edge" >> $GITHUB_OUTPUT - else - echo "Nearest tag not found, using 'edge' tag" - echo "nearest_tag=edge" >> $GITHUB_OUTPUT - fi + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 @@ -84,13 +65,12 @@ jobs: tags: | type=raw,value=${{ needs.release-please.outputs.tag_name }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} - type=raw,value=${{ steps.get-nearest-tag.outputs.nearest_tag }},enable=${{ github.ref != format('refs/heads/{0}', 'main') }} + type=raw,value=edge,enable=${{ github.ref != format('refs/heads/{0}', 'main') }} + - name: Build and push Docker image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v2 with: context: . - build-args: | - APP_VERSION=${{ steps.meta.outputs.version }} push: true platforms: linux/amd64,linux/arm64,linux/arm/v8 tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c4b716f..14bcc1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ FROM dart:2.19.6-sdk AS build -ARG APP_VERSION=unknown RUN apt-get update && \ apt-get install -y git @@ -11,7 +10,7 @@ RUN dart pub get COPY . . RUN dart pub get --offline -RUN dart compile exe -DAPP_VERSION=${APP_VERSION} src/leaf_2_mqtt.dart -o src/leaf_2_mqtt +RUN dart compile exe src/leaf_2_mqtt.dart -o src/leaf_2_mqtt FROM scratch COPY --from=build /runtime/ / diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..703a42b --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,168 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + blowfish_ecb: + dependency: transitive + description: + name: blowfish_ecb + sha256: ed01f5fcec0bd5ba04242263abd61ae0a01f4211f0aa79dd96367254a5cc5f59 + url: "https://pub.dev" + source: hosted + version: "0.1.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + collection: + dependency: transitive + description: + name: collection + sha256: ef7e3a5529178ce8f37a9d0b11cbbc8b1e025940f9cf9f76c42da6796301219d + url: "https://pub.dev" + source: hosted + version: "1.16.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: cf75650c66c0316274e21d7c43d3dea246273af5955bd94e8184837cd577575c + url: "https://pub.dev" + source: hosted + version: "3.0.1" + dartcarwings: + dependency: "direct main" + description: + path: "." + ref: HEAD + resolved-ref: f54dc13e1910d4e87db6555aef0398cc5e41903c + url: "https://github.com/Tobiaswk/dartcarwings" + source: git + version: "1.0.0" + dartnissanconnect: + dependency: "direct main" + description: + path: "." + ref: HEAD + resolved-ref: ed31b5a3ee6d472aea2a1fb97dbbcf8e90ef04c7 + url: "https://gitlab.com/sensor-freak/dartnissanconnect" + source: git + version: "1.0.4" + dartnissanconnectna: + dependency: "direct main" + description: + path: "." + ref: HEAD + resolved-ref: f2a4335c1fdd605ac0d5444539496eedf85c807f + url: "https://gitlab.com/tobiaswkjeldsen/dartnissanconnectna" + source: git + version: "1.0.0" + event_bus: + dependency: transitive + description: + name: event_bus + sha256: "44baa799834f4c803921873e7446a2add0f3efa45e101a054b1f0ab9b95f8edc" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + http: + dependency: transitive + description: + name: http + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + url: "https://pub.dev" + source: hosted + version: "0.13.6" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + intl: + dependency: transitive + description: + name: intl + sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91" + url: "https://pub.dev" + source: hosted + version: "0.17.0" + logging: + dependency: "direct main" + description: + name: logging + sha256: "293ae2d49fd79d4c04944c3a26dfd313382d5f52e821ec57119230ae16031ad4" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + meta: + dependency: transitive + description: + name: meta + sha256: "5202fdd37b4da5fd14a237ed0a01cad6c1efd4c99b5b5a0d3c9237f3728c9485" + url: "https://pub.dev" + source: hosted + version: "1.7.0" + mqtt_client: + dependency: "direct main" + description: + name: mqtt_client + sha256: e3fab601bafebeb2cb10d1bc68ddc0b8de987aa5298515d518329c9d8a034257 + url: "https://pub.dev" + source: hosted + version: "9.6.6" + path: + dependency: transitive + description: + name: path + sha256: "240ed0e9bd73daa2182e33c4efc68c7dd53c7c656f3da73515a2d163e151412d" + url: "https://pub.dev" + source: hosted + version: "1.8.1" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" + url: "https://pub.dev" + source: hosted + version: "1.3.0" +sdks: + dart: ">=2.19.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 8b3a4c7..d1c68eb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,9 +9,7 @@ dependencies: url: https://github.com/kamiKAC/dartnissanconnect ref: v1.0.5 dartcarwings: - git: - url: https://github.com/kamiKAC/dartcarwings - ref: v1.0.1 + git: https://github.com/Tobiaswk/dartcarwings mqtt_client: ^9.6.1 logging: ^1.0.1 environment: diff --git a/src/leaf_2_mqtt.dart b/src/leaf_2_mqtt.dart index 0dbbf0f..5620685 100644 --- a/src/leaf_2_mqtt.dart +++ b/src/leaf_2_mqtt.dart @@ -9,22 +9,20 @@ import 'mqtt_client_wrapper.dart'; LeafSession _session; int _commandAttempts = 2; -const appVersion = String.fromEnvironment('APP_VERSION', defaultValue: 'unknown'); - final Logger _log = Logger('main'); Future main() async { final Map envVars = Platform.environment; - final String logLevelStr = envVars['LOG_LEVEL'] ?? '${Level.INFO}'; + final String logLevelStr = envVars['LOG_LEVEL'] ?? '${Level.WARNING}'; Level logLevel = Level.LEVELS.firstWhere( (Level level) => level.name.toLowerCase() == logLevelStr.toLowerCase(), orElse: () => null); if (logLevel == null) { - print('LOG_LEVEL environment variable should be set to a valid value from: ${Level.LEVELS}. Defaulting to Info.'); - logLevel = Level.INFO; + print('LOG_LEVEL environment variable should be set to a valid value from: ${Level.LEVELS}. Defaulting to Warning.'); + logLevel = Level.WARNING; } Logger.root.level = logLevel; @@ -32,7 +30,7 @@ Future main() async { print('${record.level.name}: ${record.time}: ${record.loggerName}: ${record.message}'); }); - _log.info('Version: ${appVersion}'); + _log.info('V0.11'); final String leafUser = envVars['LEAF_USERNAME']; final String leafPassword = envVars['LEAF_PASSWORD']; @@ -275,10 +273,9 @@ Future fetchAndPublishAllStatus(MqttClientWrapper mqttClient, String vin) Future(() => mqttClient.publishStates( _session.executeSync((Vehicle vehicle) => vehicle.getVehicleStatus(), vin))), fetchAndPublishBatteryStatus(mqttClient, vin), - fetchAndPublishCockpitStatus(mqttClient, vin), fetchAndPublishClimateStatus(mqttClient, vin), - fetchAndPublishLocation(mqttClient, vin) - + fetchAndPublishLocation(mqttClient, vin), + fetchAndPublishCockpitStatus(mqttClient, vin) ]); } From 9307c0d69bb69914670d6c857ec8760285a3e79f Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 16 Jun 2024 15:14:48 +0200 Subject: [PATCH 40/53] fix: reorder of status fetch (#26) * fix: change fetchAndPublish order * feat: add updateall to command/status * move targetDate outside return * add missing break * remove unnecessary argument * build: add package_info_plus to display package version in logs * build: correct wrong package_info_plus ver * Revert "build: correct wrong package_info_plus ver" This reverts commit 270aab413da8862ca36376915329e9588bad6b83. * Revert "build: add package_info_plus to display package version in logs" This reverts commit 1a4f352156f134aea81b73a45cba28553ebf6c8a. * build: add pubspec_parse pacge to read app name and version * build: downgrade pubspec_parse to ver compatible with SDK v2 * build: add space * build: refactor log.info * Revert "build: refactor log.info" This reverts commit 4a0e2bcd27d8dfca450604d1baad068cf246e0fa. * Revert "build: add space" This reverts commit 5a343aab8ae11d0d6fcb1a6487a36082bb952a35. * Revert "build: downgrade pubspec_parse to ver compatible with SDK v2" This reverts commit 8875864e289aa236137f93f49ad40417a149ef1c. * Revert "build: add pubspec_parse pacge to read app name and version" This reverts commit 865c4b65c539af689a768a3844c371c8f5ee138d. * ci: change versioning in dart file to release-please * Revert "ci: change versioning in dart file to release-please" This reverts commit 3059cc8670918176bc316fe57ae74867f39648ad. * build: use build argument as version source * build: add latest tag to edge build * ci: add fetch-tags to checkout * ci: add fetch-depth * ci: add missing fi * ci: add debug * ci: remove debug output * reverrt: "feat: add updateall to command/status" * build: switch to selfhosted dartcarwings * build: delete pubspec.lock * fix: corrected typo * build: switch to dartcarwings v1.0.1 * ci: update build-push-action to v5 * ci: update several actions * ci: fix wrong placement of extra-files section of config --- .github/workflows/leaf2mqtt.yml | 36 +++++-- .release-please-manifest.json | 9 +- Dockerfile | 3 +- pubspec.lock | 168 -------------------------------- pubspec.yaml | 4 +- release-please-config.json | 9 ++ src/leaf_2_mqtt.dart | 15 +-- 7 files changed, 52 insertions(+), 192 deletions(-) delete mode 100644 pubspec.lock create mode 100644 release-please-config.json diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 4b2c3e1..fc0c49c 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -43,20 +43,39 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + fetch-tags: true + fetch-depth: 200 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Log in to Docker Hub - uses: docker/login-action@v1.10.0 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUBUSERNAME }} password: ${{ secrets.DOCKERHUBACCESSTOKEN }} - + + - name: Get nearest tag + id: get-nearest-tag + if: ${{ github.ref != format('refs/heads/{0}', 'main') }} + shell: bash + run: |- + TAGS=$(git tag --list) + NEAREST_TAG=$(git describe --tags --abbrev=0) + SPECIFIC_TAG=$(git tag --points-at $(git rev-list -n 1 $NEAREST_TAG) | grep -E 'v[0-9]+\.[0-9]+\.[0-9]+') + if [[ ! -z "$SPECIFIC_TAG" ]]; then + echo "Nearest tag is: $SPECIFIC_TAG" + echo "Using tag ${SPECIFIC_TAG}-edge" + echo "nearest_tag=${SPECIFIC_TAG}-edge" >> $GITHUB_OUTPUT + else + echo "Nearest tag not found, using 'edge' tag" + echo "nearest_tag=edge" >> $GITHUB_OUTPUT + fi - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 @@ -65,12 +84,13 @@ jobs: tags: | type=raw,value=${{ needs.release-please.outputs.tag_name }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} - type=raw,value=edge,enable=${{ github.ref != format('refs/heads/{0}', 'main') }} - + type=raw,value=${{ steps.get-nearest-tag.outputs.nearest_tag }},enable=${{ github.ref != format('refs/heads/{0}', 'main') }} - name: Build and push Docker image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: . + build-args: | + APP_VERSION=${{ steps.meta.outputs.version }} push: true platforms: linux/amd64,linux/arm64,linux/arm/v8 tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 5c6bb50..28e831b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,10 +1,3 @@ { - ".": "0.0.3", - "extra-files": [ - { - "type": "json", - "path": "addon/config.json", - "jsonpath": "$.version" - } - ] + ".": "0.0.3" } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 14bcc1a..c4b716f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM dart:2.19.6-sdk AS build +ARG APP_VERSION=unknown RUN apt-get update && \ apt-get install -y git @@ -10,7 +11,7 @@ RUN dart pub get COPY . . RUN dart pub get --offline -RUN dart compile exe src/leaf_2_mqtt.dart -o src/leaf_2_mqtt +RUN dart compile exe -DAPP_VERSION=${APP_VERSION} src/leaf_2_mqtt.dart -o src/leaf_2_mqtt FROM scratch COPY --from=build /runtime/ / diff --git a/pubspec.lock b/pubspec.lock deleted file mode 100644 index 703a42b..0000000 --- a/pubspec.lock +++ /dev/null @@ -1,168 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - blowfish_ecb: - dependency: transitive - description: - name: blowfish_ecb - sha256: ed01f5fcec0bd5ba04242263abd61ae0a01f4211f0aa79dd96367254a5cc5f59 - url: "https://pub.dev" - source: hosted - version: "0.1.0" - clock: - dependency: transitive - description: - name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.dev" - source: hosted - version: "1.1.1" - collection: - dependency: transitive - description: - name: collection - sha256: ef7e3a5529178ce8f37a9d0b11cbbc8b1e025940f9cf9f76c42da6796301219d - url: "https://pub.dev" - source: hosted - version: "1.16.0" - crypto: - dependency: transitive - description: - name: crypto - sha256: cf75650c66c0316274e21d7c43d3dea246273af5955bd94e8184837cd577575c - url: "https://pub.dev" - source: hosted - version: "3.0.1" - dartcarwings: - dependency: "direct main" - description: - path: "." - ref: HEAD - resolved-ref: f54dc13e1910d4e87db6555aef0398cc5e41903c - url: "https://github.com/Tobiaswk/dartcarwings" - source: git - version: "1.0.0" - dartnissanconnect: - dependency: "direct main" - description: - path: "." - ref: HEAD - resolved-ref: ed31b5a3ee6d472aea2a1fb97dbbcf8e90ef04c7 - url: "https://gitlab.com/sensor-freak/dartnissanconnect" - source: git - version: "1.0.4" - dartnissanconnectna: - dependency: "direct main" - description: - path: "." - ref: HEAD - resolved-ref: f2a4335c1fdd605ac0d5444539496eedf85c807f - url: "https://gitlab.com/tobiaswkjeldsen/dartnissanconnectna" - source: git - version: "1.0.0" - event_bus: - dependency: transitive - description: - name: event_bus - sha256: "44baa799834f4c803921873e7446a2add0f3efa45e101a054b1f0ab9b95f8edc" - url: "https://pub.dev" - source: hosted - version: "2.0.0" - http: - dependency: transitive - description: - name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" - url: "https://pub.dev" - source: hosted - version: "0.13.6" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - intl: - dependency: transitive - description: - name: intl - sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91" - url: "https://pub.dev" - source: hosted - version: "0.17.0" - logging: - dependency: "direct main" - description: - name: logging - sha256: "293ae2d49fd79d4c04944c3a26dfd313382d5f52e821ec57119230ae16031ad4" - url: "https://pub.dev" - source: hosted - version: "1.0.2" - meta: - dependency: transitive - description: - name: meta - sha256: "5202fdd37b4da5fd14a237ed0a01cad6c1efd4c99b5b5a0d3c9237f3728c9485" - url: "https://pub.dev" - source: hosted - version: "1.7.0" - mqtt_client: - dependency: "direct main" - description: - name: mqtt_client - sha256: e3fab601bafebeb2cb10d1bc68ddc0b8de987aa5298515d518329c9d8a034257 - url: "https://pub.dev" - source: hosted - version: "9.6.6" - path: - dependency: transitive - description: - name: path - sha256: "240ed0e9bd73daa2182e33c4efc68c7dd53c7c656f3da73515a2d163e151412d" - url: "https://pub.dev" - source: hosted - version: "1.8.1" - source_span: - dependency: transitive - description: - name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.dev" - source: hosted - version: "1.10.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" - url: "https://pub.dev" - source: hosted - version: "1.3.0" -sdks: - dart: ">=2.19.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index d1c68eb..8b3a4c7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,7 +9,9 @@ dependencies: url: https://github.com/kamiKAC/dartnissanconnect ref: v1.0.5 dartcarwings: - git: https://github.com/Tobiaswk/dartcarwings + git: + url: https://github.com/kamiKAC/dartcarwings + ref: v1.0.1 mqtt_client: ^9.6.1 logging: ^1.0.1 environment: diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..95ac6a3 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,9 @@ +{ + "extra-files": [ + { + "type": "json", + "path": "addon/config.json", + "jsonpath": "$.version" + } + ] +} \ No newline at end of file diff --git a/src/leaf_2_mqtt.dart b/src/leaf_2_mqtt.dart index 5620685..0dbbf0f 100644 --- a/src/leaf_2_mqtt.dart +++ b/src/leaf_2_mqtt.dart @@ -9,20 +9,22 @@ import 'mqtt_client_wrapper.dart'; LeafSession _session; int _commandAttempts = 2; +const appVersion = String.fromEnvironment('APP_VERSION', defaultValue: 'unknown'); + final Logger _log = Logger('main'); Future main() async { final Map envVars = Platform.environment; - final String logLevelStr = envVars['LOG_LEVEL'] ?? '${Level.WARNING}'; + final String logLevelStr = envVars['LOG_LEVEL'] ?? '${Level.INFO}'; Level logLevel = Level.LEVELS.firstWhere( (Level level) => level.name.toLowerCase() == logLevelStr.toLowerCase(), orElse: () => null); if (logLevel == null) { - print('LOG_LEVEL environment variable should be set to a valid value from: ${Level.LEVELS}. Defaulting to Warning.'); - logLevel = Level.WARNING; + print('LOG_LEVEL environment variable should be set to a valid value from: ${Level.LEVELS}. Defaulting to Info.'); + logLevel = Level.INFO; } Logger.root.level = logLevel; @@ -30,7 +32,7 @@ Future main() async { print('${record.level.name}: ${record.time}: ${record.loggerName}: ${record.message}'); }); - _log.info('V0.11'); + _log.info('Version: ${appVersion}'); final String leafUser = envVars['LEAF_USERNAME']; final String leafPassword = envVars['LEAF_PASSWORD']; @@ -273,9 +275,10 @@ Future fetchAndPublishAllStatus(MqttClientWrapper mqttClient, String vin) Future(() => mqttClient.publishStates( _session.executeSync((Vehicle vehicle) => vehicle.getVehicleStatus(), vin))), fetchAndPublishBatteryStatus(mqttClient, vin), + fetchAndPublishCockpitStatus(mqttClient, vin), fetchAndPublishClimateStatus(mqttClient, vin), - fetchAndPublishLocation(mqttClient, vin), - fetchAndPublishCockpitStatus(mqttClient, vin) + fetchAndPublishLocation(mqttClient, vin) + ]); } From 719c8eac3e9eb45d8452239c83076dd078b5cd54 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 16 Jun 2024 15:28:19 +0200 Subject: [PATCH 41/53] chore: release 0.0.4 Release-As: 0.0.4 From 3597bcd4dc62b89397c29cdc6abb891df4834edb Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 16 Jun 2024 15:36:33 +0200 Subject: [PATCH 42/53] fix: correction of release-please-config --- release-please-config.json | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/release-please-config.json b/release-please-config.json index 95ac6a3..4a19366 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1,9 +1,13 @@ { - "extra-files": [ - { - "type": "json", - "path": "addon/config.json", - "jsonpath": "$.version" + "packages": { + ".": { + "extra-files": [ + { + "type": "json", + "path": "addon/config.json", + "jsonpath": "$.version" + } + ] } - ] -} \ No newline at end of file + } +} From ca2d0565f6e786c542f88b5f62decaec2a3d60e5 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 16 Jun 2024 15:44:27 +0200 Subject: [PATCH 43/53] ci: move release-type from workflow parameters to config --- .github/workflows/leaf2mqtt.yml | 1 - release-please-config.json | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index fc0c49c..a912428 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -14,7 +14,6 @@ jobs: - uses: googleapis/release-please-action@v4 id: release with: - release-type: dart token: ${{ secrets.GH_TOKEN }} - uses: actions/checkout@v4 with: diff --git a/release-please-config.json b/release-please-config.json index 4a19366..8e4348f 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1,4 +1,5 @@ { + "release-type": "node", "packages": { ".": { "extra-files": [ From d0c15f4b021ad87e3b0ab505f4b8edee457afd55 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 16 Jun 2024 15:45:41 +0200 Subject: [PATCH 44/53] ci: wrong release-type --- release-please-config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-please-config.json b/release-please-config.json index 8e4348f..2f682d3 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1,5 +1,5 @@ { - "release-type": "node", + "release-type": "dart", "packages": { ".": { "extra-files": [ From 2ec1543d0e8c4d0ceb2fc558c95bab8fc4c48787 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 16 Jun 2024 15:57:34 +0200 Subject: [PATCH 45/53] chore(main): release leaf2mqtt 0.0.4 (#27) * chore(main): release leaf2mqtt 0.0.4 * docs: changelog cleanup --- .release-please-manifest.json | 2 +- CHANGELOG.md | 31 +++++++++---------------------- addon/config.json | 2 +- pubspec.yaml | 2 +- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 28e831b..2ed3b71 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.3" + ".": "0.0.4" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 04df84e..b4aa690 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,43 +1,30 @@ # Changelog -## [0.0.3](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.3) (2024-05-21) +## [0.0.4](https://github.com/kamiKAC/leaf2mqtt/compare/leaf2mqtt-v0.0.3...leaf2mqtt-v0.0.4) (2024-06-16) ### Bug Fixes -* update to dartnissanconnect v1.0.5 ([#14](https://github.com/kamiKAC/leaf2mqtt/issues/14)) ([1d2315e](https://github.com/kamiKAC/leaf2mqtt/commit/1d2315ee762b6a764c6c203553e7fd40806b34c3)) - -## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) - +* correction of release-please-config ([3597bcd](https://github.com/kamiKAC/leaf2mqtt/commit/3597bcd4dc62b89397c29cdc6abb891df4834edb)) +* reorder of status fetch ([#21](https://github.com/kamiKAC/leaf2mqtt/issues/21)) ([9307c0d](https://github.com/kamiKAC/leaf2mqtt/commit/d19c52ce5766015c1568115a930b3eb44d88d073)) +* reorder of status fetch (https://github.com/kamiKAC/leaf2mqtt/pull/21) ([9307c0d](https://github.com/kamiKAC/leaf2mqtt/commit/9307c0d69bb69914670d6c857ec8760285a3e79f)) +* switch to dartcarwings v1.0.1 (solves https://github.com/kamiKAC/leaf2mqtt/issues/19) ([9307c0d](https://github.com/kamiKAC/leaf2mqtt/commit/9307c0d69bb69914670d6c857ec8760285a3e79f)) -### Miscellaneous Chores -* release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) -* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) +## [0.0.3](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.3) (2024-05-21) -### Continuous Integration +### Bug Fixes -* Re-release v0.0.2 with dartnissanconnect v1.0.4 ([#10](https://github.com/kamiKAC/leaf2mqtt/issues/10)) ([f0757cb](https://github.com/kamiKAC/leaf2mqtt/commit/f0757cbc9af3d963abb0b9ac009f059dff6d8dc6)) -* Re-release v0.0.2 with dartnissanconnect v1.0.4 ([#12](https://github.com/kamiKAC/leaf2mqtt/issues/12)) ([551446c](https://github.com/kamiKAC/leaf2mqtt/commit/551446c5872921d36a6f662b55df5bce04ebb566)) +* update to dartnissanconnect v1.0.5 ([#14](https://github.com/kamiKAC/leaf2mqtt/issues/14)) ([1d2315e](https://github.com/kamiKAC/leaf2mqtt/commit/1d2315ee762b6a764c6c203553e7fd40806b34c3)) ## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) -### Miscellaneous Chores - -* release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) -* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) - - ### Continuous Integration -* Re-release v0.0.2 with dartnissanconnect v1.0.4 ([#10](https://github.com/kamiKAC/leaf2mqtt/issues/10)) ([f0757cb](https://github.com/kamiKAC/leaf2mqtt/commit/f0757cbc9af3d963abb0b9ac009f059dff6d8dc6)) -## [0.0.2](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.2) (2024-05-20) +* Re-release v0.0.2 with dartnissanconnect v1.0.4 ([#12](https://github.com/kamiKAC/leaf2mqtt/issues/12)) ([551446c](https://github.com/kamiKAC/leaf2mqtt/commit/551446c5872921d36a6f662b55df5bce04ebb566)) -### Miscellaneous Chores -* release 0.0.2 ([1509dc4](https://github.com/kamiKAC/leaf2mqtt/commit/1509dc4ccc73ed50f11cf1727ef6821b58972251)) -* release 0.0.2 ([6002cf4](https://github.com/kamiKAC/leaf2mqtt/commit/6002cf4c529b257fd5ab46e17f0cd7ee291b332b)) diff --git a/addon/config.json b/addon/config.json index 91501c1..caa4610 100644 --- a/addon/config.json +++ b/addon/config.json @@ -1,6 +1,6 @@ { "name": "Leaf2MQTT", - "version": "v0.0.3", + "version": "0.0.4", "slug": "leaf2mqtt", "description": "Interact with your Nissan Leaf using MQTT", "startup": "application", diff --git a/pubspec.yaml b/pubspec.yaml index 8b3a4c7..0904e96 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: leaf2mqtt -version: 0.0.3 +version: 0.0.4 publish_to: 'none' dependencies: dartnissanconnectna: From 87b51b153296821bd8fe78fed48d17b6ee1bf48f Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 16 Jun 2024 22:30:00 +0200 Subject: [PATCH 46/53] ci: remove component name from tag --- release-please-config.json | 1 + 1 file changed, 1 insertion(+) diff --git a/release-please-config.json b/release-please-config.json index 2f682d3..4d06c29 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1,5 +1,6 @@ { "release-type": "dart", + "include-component-in-tag": false, "packages": { ".": { "extra-files": [ From b036511e8de87067fddefba873a4bf1f1c74e585 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 16 Jun 2024 22:41:53 +0200 Subject: [PATCH 47/53] ci: add tag input in workflow --- .github/workflows/leaf2mqtt.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index a912428..3f88eca 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -2,6 +2,13 @@ name: Publish Docker image on: workflow_dispatch: + inputs: + tag: + type: string + description: Set tag for docker image + default: "" + required: false + push: branches: - main @@ -81,7 +88,7 @@ jobs: with: images: ${{ secrets.DOCKERHUBUSERNAME }}/leaf2mqtt tags: | - type=raw,value=${{ needs.release-please.outputs.tag_name }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} + type=raw,value=${{ needs.release-please.outputs.tag_name == '' && inputs.tag || needs.release-please.outputs.tag_name }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=raw,value=${{ steps.get-nearest-tag.outputs.nearest_tag }},enable=${{ github.ref != format('refs/heads/{0}', 'main') }} - name: Build and push Docker image From cd9ac596fbcd506ce39507f77a98e37dadee6629 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 16 Jun 2024 22:50:29 +0200 Subject: [PATCH 48/53] chore(main): release 0.0.4 (#28) * chore(main): release 0.0.4 * docs: changelog cleanup * docs: changelog adjustment --- CHANGELOG.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4aa690..f8638a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,19 @@ # Changelog -## [0.0.4](https://github.com/kamiKAC/leaf2mqtt/compare/leaf2mqtt-v0.0.3...leaf2mqtt-v0.0.4) (2024-06-16) +## [0.0.4](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.3...v0.0.4) (2024-06-16) ### Bug Fixes * correction of release-please-config ([3597bcd](https://github.com/kamiKAC/leaf2mqtt/commit/3597bcd4dc62b89397c29cdc6abb891df4834edb)) -* reorder of status fetch ([#21](https://github.com/kamiKAC/leaf2mqtt/issues/21)) ([9307c0d](https://github.com/kamiKAC/leaf2mqtt/commit/d19c52ce5766015c1568115a930b3eb44d88d073)) * reorder of status fetch (https://github.com/kamiKAC/leaf2mqtt/pull/21) ([9307c0d](https://github.com/kamiKAC/leaf2mqtt/commit/9307c0d69bb69914670d6c857ec8760285a3e79f)) * switch to dartcarwings v1.0.1 (solves https://github.com/kamiKAC/leaf2mqtt/issues/19) ([9307c0d](https://github.com/kamiKAC/leaf2mqtt/commit/9307c0d69bb69914670d6c857ec8760285a3e79f)) +* use build argument as version source - this enables displaying version of app in logs ([9307c0d](https://github.com/kamiKAC/leaf2mqtt/commit/9307c0d69bb69914670d6c857ec8760285a3e79f)) + + +### Miscellaneous Chores + +* release 0.0.4 ([719c8ea](https://github.com/kamiKAC/leaf2mqtt/commit/719c8eac3e9eb45d8452239c83076dd078b5cd54)) ## [0.0.3](https://github.com/kamiKAC/leaf2mqtt/compare/v0.0.2...v0.0.3) (2024-05-21) @@ -25,6 +30,3 @@ * Re-release v0.0.2 with dartnissanconnect v1.0.4 ([#12](https://github.com/kamiKAC/leaf2mqtt/issues/12)) ([551446c](https://github.com/kamiKAC/leaf2mqtt/commit/551446c5872921d36a6f662b55df5bce04ebb566)) - - - From 378d915218520166146b3f1c92ae0a2c94d6cdf4 Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 17 Jun 2024 16:30:26 +0200 Subject: [PATCH 49/53] ci: solved problem with addon version --- .github/workflows/leaf2mqtt.yml | 34 ++++++++++++++++++++++++++++----- addon/config.json | 2 +- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 3f88eca..9911fce 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -20,13 +20,9 @@ jobs: steps: - uses: googleapis/release-please-action@v4 id: release - with: - token: ${{ secrets.GH_TOKEN }} - uses: actions/checkout@v4 - with: - token: ${{ secrets.GH_TOKEN }} - name: tag major and minor versions - if: ${{ steps.release.outputs.release_created }} + if: steps.release.outputs.release_created run: | git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com @@ -38,6 +34,34 @@ jobs: git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}" git push origin v${{ steps.release.outputs.major }} git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} + - name: display pr output + if: steps.release.outputs.prs_created == 'true' + run: |- + echo 'pr output: ${{ steps.release.outputs.pr }}' + echo 'prs output: ${{ steps.release.outputs.prs }}' + - name: install yq + if: steps.release.outputs.prs_created == 'true' + uses: chrisdickinson/setup-yq@v1.0.1 + with: + yq-version: v4.44.2 + - name: checkout release-please branch + if: steps.release.outputs.prs_created == 'true' + uses: actions/checkout@v4 + with: + ref: ${{ fromJson(steps.release.outputs.pr).headBranchName }} + - name: update addon version + if: steps.release.outputs.prs_created == 'true' + run: |- + version=$(yq '.version' ./pubspec.yaml) + yq -i ".version |= \"v${version}\"" addon/config.json + git add . + if [[ ! -z "$(git status --porcelain)" ]]; then + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + git commit -m "Update addon version" + git push + fi + outputs: release_created: ${{ steps.release.outputs.release_created }} tag_name: ${{ steps.release.outputs.tag_name }} diff --git a/addon/config.json b/addon/config.json index caa4610..329afca 100644 --- a/addon/config.json +++ b/addon/config.json @@ -1,6 +1,6 @@ { "name": "Leaf2MQTT", - "version": "0.0.4", + "version": "v0.0.4", "slug": "leaf2mqtt", "description": "Interact with your Nissan Leaf using MQTT", "startup": "application", From da08572300b492fe8782dcf3c06d108495549faf Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 17 Jun 2024 16:41:23 +0200 Subject: [PATCH 50/53] ci: added armhf to architectures --- addon/config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addon/config.json b/addon/config.json index 329afca..d55b316 100644 --- a/addon/config.json +++ b/addon/config.json @@ -8,7 +8,8 @@ "init": false, "arch": [ "aarch64", - "amd64" + "amd64", + "armhf" ], "options": { "LEAF_USERNAME": "", From d1ed8438fd7d76c13026fbe9e4f0bd0efd28a04c Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Mon, 17 Jun 2024 16:42:34 +0200 Subject: [PATCH 51/53] ci: removed extra-files section from release-please-config.json as needed version format is not supported --- release-please-config.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/release-please-config.json b/release-please-config.json index 4d06c29..64a1d68 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -3,13 +3,6 @@ "include-component-in-tag": false, "packages": { ".": { - "extra-files": [ - { - "type": "json", - "path": "addon/config.json", - "jsonpath": "$.version" - } - ] } } } From 8bfd08a3e451ec79bdf5c2f845a6518fef54bb5e Mon Sep 17 00:00:00 2001 From: kamiKAC Date: Sun, 30 Jun 2024 15:15:31 +0200 Subject: [PATCH 52/53] feat: provide combined coordinates which are supported by openHAB (#30) * fix: convert latitude and longitude to string feat: add coordinates as combined latitude and longitude docs: add example config files and documentation for OpenHAB integration ci: allow to change docker tag if workflow not started from main branch --- .github/workflows/leaf2mqtt.yml | 6 ++-- README.md | 4 +++ openhab/README.md | 7 +++++ openhab/items/leaf.items | 28 +++++++++++++++++ openhab/things/leaf_mqtt.things | 34 +++++++++++++++++++++ openhab/transform/FormatDate.js | 3 ++ src/leaf/builder/leaf_location_builder.dart | 6 +++- src/leaf/carwings_wrapper.dart | 1 + src/leaf/nissan_connect_na_wrapper.dart | 1 + src/leaf/nissan_connect_wrapper.dart | 1 + 10 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 openhab/README.md create mode 100644 openhab/items/leaf.items create mode 100644 openhab/things/leaf_mqtt.things create mode 100644 openhab/transform/FormatDate.js diff --git a/.github/workflows/leaf2mqtt.yml b/.github/workflows/leaf2mqtt.yml index 9911fce..9fb7729 100644 --- a/.github/workflows/leaf2mqtt.yml +++ b/.github/workflows/leaf2mqtt.yml @@ -5,7 +5,7 @@ on: inputs: tag: type: string - description: Set tag for docker image + description: Set tag for docker image if workflow not started from main default: "" required: false @@ -112,9 +112,9 @@ jobs: with: images: ${{ secrets.DOCKERHUBUSERNAME }}/leaf2mqtt tags: | - type=raw,value=${{ needs.release-please.outputs.tag_name == '' && inputs.tag || needs.release-please.outputs.tag_name }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} + type=raw,value=${{ needs.release-please.outputs.tag_name }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} - type=raw,value=${{ steps.get-nearest-tag.outputs.nearest_tag }},enable=${{ github.ref != format('refs/heads/{0}', 'main') }} + type=raw,value=${{ inputs.tag != '' && inputs.tag || steps.get-nearest-tag.outputs.nearest_tag }},enable=${{ github.ref != format('refs/heads/{0}', 'main') }} - name: Build and push Docker image uses: docker/build-push-action@v5 with: diff --git a/README.md b/README.md index 36766df..8a5941a 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,7 @@ In these examples, the `MQTT_BASE_TOPIC` is set to the default (`leaf`). | ------ | ---- | ----------- | | leaf/{vin}/location/latitude | String | The reported last known location's latitude in decimal degrees | | leaf/{vin}/location/longitude | String | The reported last known location's longitude in decimal degrees | +| leaf/{vin}/location/coordinates | String | The reported last known location (combined latitude and longitude in decimal degrees) | | leaf/{vin}/location/lastReceivedDateTimeUtc | Iso8601 UTC | The datetime when leaf2mqtt received the last location values | | leaf/{vin}/location/json | String | A json representation of all location status | @@ -268,6 +269,9 @@ In Home Assistant, calling a script like this `- service: script.some_script_nam # Let's have a cool down to give time to Home Assistant to update all the states. - delay: "00:00:10" +## OpenHAB integration +Once you configure and start application you can configure OpenHAB to get data for your Leaf. Example config file is [here](/openhab) and documentation is [here](/openhab/README.md) + ## Credits - Forked from [Troon/leaf2mqtt](https://github.com/Troon/leaf2mqtt). Thank you for the inspiration! - Using libraries from [Tobias Westergaard Kjeldsen](https://gitlab.com/tobiaswkjeldsen) to connect with the nissan leaf's APIs. Those libraries are also used for his [MyLeaf app](https://gitlab.com/tobiaswkjeldsen/carwingsflutter). diff --git a/openhab/README.md b/openhab/README.md new file mode 100644 index 0000000..78a7a9d --- /dev/null +++ b/openhab/README.md @@ -0,0 +1,7 @@ +# OpenHAB example files for Leaf2MQTT + +To use this example config: + - copy `items`, `things` and `transform` directories to `openhab` directory (under Linux it is located under `/etc/) + - edit `.things` file so `mqtt:broker:mosquitto` Bridge points to your MQTT server or change Thing to point to your previously defined MQTT bridge + +Leaf Statistics should appear under `Cars` devices. diff --git a/openhab/items/leaf.items b/openhab/items/leaf.items new file mode 100644 index 0000000..4fef6f6 --- /dev/null +++ b/openhab/items/leaf.items @@ -0,0 +1,28 @@ +Group OF_Car "Nissan Leaf" (OF) ["Car"] + +tring Car_Update "Update" (OF_Car) ["Control"] { listWidget="oh-list-item"[actionItem="Car_Update", action="command" ,actionCommand="update", icon="f7:rectangle_split_3x1_fill"], channel="mqtt:topic:leaf:StatusUpdate" } +String Car_BatteryUpdate "Update battery state" (OF_Car) ["Control"] { listWidget="oh-list-item"[actionItem="Car_BatteryUpdate", action="command", actionCommand="update", icon="f7:rectangle_split_3x1_fill"], channel="mqtt:topic:leaf:StatusBatteryUpdate" } +String Car_LocationUpdate "Update location" (OF_Car) ["Control"] { listWidget="oh-list-item"[actionItem="Car_LocationUpdate", action="command", actionCommand="update", icon="f7:rectangle_split_3x1_fill"], channel="mqtt:topic:leaf:LocationUpdate" } +String Car_StatsUpdate "Update daily statistics" (OF_Car) ["Control"] { listWidget="oh-list-item"[actionItem="Car_StatsUpdate", action="command", actionCommand="='update ' + dayjs().format('YYYY-MM-DD HH:mm:ss')", icon="f7:rectangle_split_3x1_fill"], channel="mqtt:topic:leaf:DailyStatistics" } + +DateTime Car_StatsDate "Trip statistics for [%1$td-%1$tm-%1$ty]"