From 3ff0fc72dedc48818d38229691f0f1600807ca72 Mon Sep 17 00:00:00 2001 From: Friedrich Fell Date: Mon, 6 Jul 2026 10:20:54 +0200 Subject: [PATCH] removed aiways SOC module --- packages/modules/vehicles/aiways/__init__.py | 0 packages/modules/vehicles/aiways/config.py | 30 ------------- packages/modules/vehicles/aiways/soc.py | 47 -------------------- 3 files changed, 77 deletions(-) delete mode 100644 packages/modules/vehicles/aiways/__init__.py delete mode 100644 packages/modules/vehicles/aiways/config.py delete mode 100644 packages/modules/vehicles/aiways/soc.py diff --git a/packages/modules/vehicles/aiways/__init__.py b/packages/modules/vehicles/aiways/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/modules/vehicles/aiways/config.py b/packages/modules/vehicles/aiways/config.py deleted file mode 100644 index b7539d6965..0000000000 --- a/packages/modules/vehicles/aiways/config.py +++ /dev/null @@ -1,30 +0,0 @@ -from typing import Optional - -""" -The attributes for configuration can be retrieved with this guide: -https://community.home-assistant.io/t/read-aiways-u5-state-of-charge/466441/5 -""" - - -class AiwaysVehicleSocConfiguration: - def __init__(self, user_id: Optional[str] = None, vin: Optional[str] = None, device_id: Optional[str] = None, - register_id: Optional[str] = None, token: Optional[str] = None, - condition_url: Optional[str] = "https://coiapp-api-eu.ai-ways.com:10443/app/vc/getCondition") -> None: - self.user_id = user_id - self.vin = vin - self.device_id = device_id - self.register_id = register_id - self.token = token - self.condition_url = condition_url - - -class AiwaysVehicleSoc: - def __init__(self, - name: str = "Aiways", - type: str = "aiways", - official: bool = False, - configuration: AiwaysVehicleSocConfiguration = None) -> None: - self.name = name - self.type = type - self.official = official - self.configuration = configuration or AiwaysVehicleSocConfiguration() diff --git a/packages/modules/vehicles/aiways/soc.py b/packages/modules/vehicles/aiways/soc.py deleted file mode 100644 index d554f4cbb8..0000000000 --- a/packages/modules/vehicles/aiways/soc.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python3 -import logging - -from modules.common import req -from modules.common.abstract_device import DeviceDescriptor -from modules.common.abstract_vehicle import VehicleUpdateData -from modules.common.component_state import CarState -from modules.common.configurable_vehicle import ConfigurableVehicle -from modules.vehicles.aiways.config import AiwaysVehicleSoc - -log = logging.getLogger(__name__) - - -def fetch(vehicle_config: AiwaysVehicleSoc, vehicle_update_data: VehicleUpdateData) -> CarState: - response = req.get_http_session().post(vehicle_config.configuration.condition_url, timeout=10, - headers={"language": "de", - "registerid": vehicle_config.configuration.register_id, - "deviceid": vehicle_config.configuration.device_id, - "version": "1.3.0", - "platform": "iOS", - "token": vehicle_config.configuration.token, - "apptimezone": "MEZ", - "apptimezoneid": "Europe/Berlin", - "content-type": "application/json; charset=utf-8", - "accept-encoding": "gzip", - "user-agent": "okhttp/4.3.1"}, - json={"userId": vehicle_config.configuration.user_id, - "vin": vehicle_config.configuration.vin}, verify=False) - response.raise_for_status() - json = response.json() - soc = float(json['data']['vc']['soc']) - range = float(json['data']['vc']['drivingRange']) - soc_timestamp = float(json['data']['vc']['dataTimeTS']) - return CarState(soc, range, soc_timestamp) - - -def create_vehicle(vehicle_config: AiwaysVehicleSoc, vehicle: int): - def updater(vehicle_update_data: VehicleUpdateData) -> CarState: - return fetch(vehicle_config, vehicle_update_data) - - return ConfigurableVehicle(vehicle_config=vehicle_config, - component_updater=updater, - vehicle=vehicle, - calc_while_charging=False) - - -device_descriptor = DeviceDescriptor(configuration_factory=AiwaysVehicleSoc)