Compare commits

...
18 Commits
Author SHA1 Message Date
Linus DietzandGitHub 5ef1aa528b Update README.md 2023-06-19 12:41:30 +02:00
Linus Dietz 3440dadeab Move vcc api key to settings 2023-06-19 12:39:20 +02:00
Linus DietzandGitHub 1dc38e6925 change image tagging 2023-06-19 12:33:53 +02:00
Linus DietzandGitHub 81b0bb9b85 remove unused step 2023-06-19 12:25:06 +02:00
Linus DietzandGitHub 97fb95799a add armv6 and v8 2023-06-19 12:21:51 +02:00
Linus DietzandGitHub ab73f9afb2 Update build_image.yml 2023-06-19 12:17:48 +02:00
Linus DietzandGitHub 285f9dc79b Update build_image.yml 2023-06-19 12:00:00 +02:00
Linus DietzandGitHub 6dad197ed6 Update build_image.yml 2023-06-19 11:53:53 +02:00
Linus DietzandGitHub 1ed6035a54 Update build_image.yml 2023-06-19 11:52:25 +02:00
Linus DietzandGitHub 666eda99d0 Update build_image.yml 2023-06-19 11:50:01 +02:00
Linus DietzandGitHub 02e64e5555 Add manual action dispatch 2023-06-19 11:48:18 +02:00
Linus DietzandGitHub c298b8972a Change build behaviour 2023-06-19 11:41:46 +02:00
Linus Dietz 2c0169466c Merge branch 'main' of https://github.com/Dielee/volvo2mqtt into main 2023-06-19 10:02:02 +02:00
Linus Dietz 8565742752 Check for recharge keys before returning them 2023-06-19 10:01:54 +02:00
Linus DietzandGitHub e690f60433 Try to add arm and arm64 build support 2023-06-19 09:35:03 +02:00
Linus DietzandGitHub 9eba31804d Add TZ to default sample 2023-06-18 21:34:12 +02:00
Linus DietzandGitHub 5139d84602 Add install instructions 2023-06-18 21:33:23 +02:00
Linus DietzandGitHub 2f3ca63b60 Update build_image.yml 2023-06-18 15:30:45 +02:00
4 changed files with 75 additions and 29 deletions
+20 -9
View File
@@ -12,39 +12,50 @@ name: Create and publish a Docker image
on:
release:
types: [created]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/amd64,linux/arm/v7,linux/arm/v6,linux/arm/v8
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+21 -2
View File
@@ -1,2 +1,21 @@
# volvo2mqtt
Home Assistant addon for connecting AAOS Volvos
# Volvo2Mqtt
This component establishes a connection between the newer AAOS Volvo cars and Home Assistant via MQTT.<br>
Maybe this component works also with other Volvo cars. Please try out the native Volvo [integration](https://www.home-assistant.io/integrations/volvooncall/) before using this component! If the native component doesn't work for your car, try this mqtt bridge.
## Setup
Just install this addon with the following command.
Please note to fill in your settings inside the environment variables.
`docker run -e CONF_updateInterval=300 -e CONF_babelLocale='de' -e CONF_mqtt='@json {"broker": "", "username": "", "password": ""}' -e CONF_volvoData='@json {"username": "", "password": "", "vin": "", "vccapikey": ""}' -e TZ='Europe/Berlin' --name volvo2mqtt ghcr.io/dielee/volvo2mqtt:main`
Here is what every option means:
| Name | Type | Default | Description |
| -------------------- | :-------: | :----------: | --------------------------------------------------------------- |
| `updateInterval` | `int` | **required** | Updateintervall in seconds. |
| `babelLocale` | `string` | **required** | Locale for date Format |
| `mqtt` | `json` | **required** | Broker = Mqtt Broker IP / Username and Passwort are optional! |
| `volvoData` | `json` | **required** | Username and password are required. Car vin is optional. If no vin is provided, the system will always use the first vehicle in API. Vccapi key is your api key from [here](https://developer.volvocars.com/account/). |
| `TZ` | `string` | | Container timezone eg "Europe/Berlin" |
+2 -1
View File
@@ -9,6 +9,7 @@
"volvoData": {
"username": "",
"password": "",
"vin": ""
"vin": "",
"vccapikey": ""
}
}
+32 -17
View File
@@ -8,12 +8,12 @@ from const import charging_system_states, CLIMATE_START_URL, \
session = requests.Session()
session.headers = {
"vcc-api-key": "f0d0419bf51d420c8efb21cf9a127227",
"vcc-api-key": settings["volvoData"]["vccapikey"],
"content-type": "application/json",
"accept": "*/*"
}
token_expires_at = None
token_expires_at: datetime
refresh_token = None
vin = ""
recharge_response = {}
@@ -145,23 +145,38 @@ def api_call(url, method, sensor_id=None):
if url == VEHICLE_DETAILS_URL:
return data["data"]
elif sensor_id == "battery_charge_level":
return data["data"]["batteryChargeLevel"]["value"]
elif sensor_id == "electric_range":
return data["data"]["electricRange"]["value"]
elif sensor_id == "charging_system_status":
return charging_system_states[data["data"]["chargingSystemStatus"]["value"]]
elif sensor_id == "estimated_charging_time":
charging_system_state = charging_system_states[data["data"]["chargingSystemStatus"]["value"]]
if charging_system_state == "Charging":
return data["data"]["estimatedChargingTime"]["value"]
if "batteryChargeLevel" in data["data"]:
return data["data"]["batteryChargeLevel"]["value"]
else:
return 0
return ""
elif sensor_id == "electric_range":
if "electricRange" in data["data"]:
return data["data"]["electricRange"]["value"]
else:
return ""
elif sensor_id == "charging_system_status":
if "charging_system_status" in data["data"]:
return charging_system_states[data["data"]["chargingSystemStatus"]["value"]]
else:
return ""
elif sensor_id == "estimated_charging_time":
if "chargingSystemStatus" in data["data"]:
charging_system_state = charging_system_states[data["data"]["chargingSystemStatus"]["value"]]
if charging_system_state == "Charging":
return data["data"]["estimatedChargingTime"]["value"]
else:
return 0
else:
return ""
elif sensor_id == "estimated_charging_finish_time":
charging_system_state = charging_system_states[data["data"]["chargingSystemStatus"]["value"]]
if charging_system_state == "Charging":
charging_time = int(data["data"]["estimatedChargingTime"]["value"])
charging_finished = datetime.now() + timedelta(minutes=charging_time)
return format_datetime(charging_finished, format="medium", locale=settings["babelLocale"])
if "chargingSystemStatus" in data["data"]:
charging_system_state = charging_system_states[data["data"]["chargingSystemStatus"]["value"]]
if charging_system_state == "Charging":
charging_time = int(data["data"]["estimatedChargingTime"]["value"])
charging_finished = datetime.now() + timedelta(minutes=charging_time)
return format_datetime(charging_finished, format="medium", locale=settings["babelLocale"])
else:
return None
else:
return None
elif sensor_id == "lock_status":