Skip to content

Commit

Permalink
Added separate updated by vehicle entities for each sensor (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasLaross authored Apr 12, 2024
1 parent 4b00bd3 commit 376c595
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
git tag "v$VERSION"
git push origin "v$VERSION"
- name: Read changelog notes
id: changelog-notes
- name: Read release notes
id: release-notes
run: |
BODY=$(tail -n +2 CHANGELOG)
BODY=$(tail -n +2 release-notes)
echo "::set-output name=body::$BODY"
- name: Create GitHub Release
Expand All @@ -50,6 +50,6 @@ jobs:
with:
tag_name: v${{ env.VERSION }}
release_name: v${{ env.VERSION }}
body: ${{ steps.changelog-notes.outputs.body }}
body: ${{ steps.release-notes.outputs.body }}
draft: false
prerelease: false
10 changes: 5 additions & 5 deletions .github/workflows/verify-release-notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
VERSION=$(jq -r '.version' custom_components/lynkco/manifest.json)
echo "::set-output name=version::$VERSION"
- name: Extract first line from changelog
id: changelog-version
- name: Extract first line from release notes
id: release-version
run: |
FIRST_LINE=$(head -n 1 CHANGELOG)
FIRST_LINE=$(head -n 1 release-notes)
echo "::set-output name=first_line::$FIRST_LINE"
- name: Compare versions
run: |
if [ "${{ steps.manifest-version.outputs.version }}" != "${{ steps.changelog-version.outputs.first_line }}" ]; then
echo "Error: Version mismatch detected. manifest.json version: ${{ steps.manifest-version.outputs.version }}, CHANGELOG version: ${{ steps.changelog-version.outputs.first_line }}"
if [ "${{ steps.manifest-version.outputs.version }}" != "${{ steps.release-version.outputs.first_line }}" ]; then
echo "Error: Version mismatch detected. manifest.json version: ${{ steps.manifest-version.outputs.version }}, release version: ${{ steps.release-version.outputs.first_line }}"
exit 1
fi
2 changes: 0 additions & 2 deletions CHANGELOG

This file was deleted.

2 changes: 1 addition & 1 deletion custom_components/lynkco/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Lynk & Co",
"documentation": "https://www.github.com/tobiaslaross/Hass-Lynk-Co",
"config_flow": true,
"version": "0.1.6",
"version": "0.2.0",
"requirements": [
"requests>=2.31.0",
"pkce>=1.0.3"
Expand Down
61 changes: 60 additions & 1 deletion custom_components/lynkco/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ async def async_setup_entry(hass, entry, async_add_entities):
"vehicle_record.odometer.vehicleUpdatedAt",
"km",
),
LynkCoSensor(
coordinator,
vin,
"Lynk & Co Odometer Updated",
"vehicle_record.odometer.vehicleUpdatedAt",
),
LynkCoSensor(
coordinator,
vin,
Expand All @@ -27,6 +33,12 @@ async def async_setup_entry(hass, entry, async_add_entities):
"vehicle_record.electricStatus.vehicleUpdatedAt",
"%",
),
LynkCoSensor(
coordinator,
vin,
"Lynk & Co Battery Updated",
"vehicle_record.electricStatus.vehicleUpdatedAt",
),
LynkCoSensor(
coordinator,
vin,
Expand All @@ -35,6 +47,12 @@ async def async_setup_entry(hass, entry, async_add_entities):
"vehicle_record.fuel.vehicleUpdatedAt",
"liters",
),
LynkCoSensor(
coordinator,
vin,
"Lynk & Co Fuel Updated",
"vehicle_record.fuel.vehicleUpdatedAt",
),
LynkCoSensor(
coordinator,
vin,
Expand All @@ -51,6 +69,12 @@ async def async_setup_entry(hass, entry, async_add_entities):
"vehicle_record.fuel.vehicleUpdatedAt",
"km",
),
LynkCoSensor(
coordinator,
vin,
"Lynk & Co Time until charged updated",
"vehicle_record.electricStatus.vehicleUpdatedAt",
),
LynkCoSensor(
coordinator,
vin,
Expand All @@ -75,6 +99,12 @@ async def async_setup_entry(hass, entry, async_add_entities):
"vehicle_record.climate.vehicleUpdatedAt",
"°C",
),
LynkCoSensor(
coordinator,
vin,
"Lynk & Co Climate Updated",
"vehicle_record.climate.vehicleUpdatedAt",
),
LynkCoSensor(
coordinator,
vin,
Expand All @@ -89,7 +119,12 @@ async def async_setup_entry(hass, entry, async_add_entities):
"Lynk & Co Charger connection status",
"vehicle_shadow.evs.chargerStatusData.chargerConnectionStatus",
"vehicle_shadow.evs.chargerStatusData.updatedAt",
"",
),
LynkCoSensor(
coordinator,
vin,
"Lynk & Co Charger Updated",
"vehicle_shadow.evs.chargerStatusData.updatedAt",
),
LynkCoSensor(
coordinator,
Expand All @@ -107,6 +142,12 @@ async def async_setup_entry(hass, entry, async_add_entities):
"vehicle_record.position.vehicleUpdatedAt",
"",
),
LynkCoSensor(
coordinator,
vin,
"Lynk & Co Address Updated",
"vehicle_record.position.vehicleUpdatedAt",
),
LynkCoSensor(
coordinator,
vin,
Expand All @@ -123,13 +164,31 @@ async def async_setup_entry(hass, entry, async_add_entities):
"vehicle_shadow.vls.doorLocksUpdatedAt",
"",
),
LynkCoSensor(
coordinator,
vin,
"Lynk & Co Door lock Updated",
"vehicle_shadow.vls.doorLocksUpdatedAt",
),
LynkCoSensor(
coordinator,
vin,
"Lynk & Co Last updated by car",
"vehicle_record.updatedAt",
"",
),
LynkCoSensor(
coordinator,
vin,
"Vehicle is running updated",
"vehicle_shadow.bvs.engineStatusUpdatedAt",
),
LynkCoSensor(
coordinator,
vin,
"Lynk & Co Locks Updated",
"vehicle_shadow.vls.doorLocksUpdatedAt",
),
]
)

Expand Down
2 changes: 2 additions & 0 deletions release-notes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0.2.0
Added separate updated entities for each sensor

0 comments on commit 376c595

Please sign in to comment.