From c8d64ddeebf68f9cdd372200b46163b81c9d8584 Mon Sep 17 00:00:00 2001 From: Bernd Weymann Date: Mon, 25 Apr 2022 08:12:55 +0200 Subject: [PATCH] [mybmw] new binding contribution (#12006) * solve pom.xml conflict Signed-off-by: Bernd Weymann * authorization working Signed-off-by: Bernd Weymann * Fully Authorization integration & cleanup Signed-off-by: Bernd Weymann * make project compilable Signed-off-by: Bernd Weymann * make code compilable & buildable Signed-off-by: Bernd Weymann * fix discovery test Signed-off-by: Bernd Weymann * fix property test Signed-off-by: Bernd Weymann * fix unit tests Signed-off-by: Bernd Weymann * unit tests fixed Signed-off-by: Bernd Weymann * solve checkstyle high & medium Signed-off-by: Bernd Weymann * include all status update channel calls Signed-off-by: Bernd Weymann * correct Closed/Connected/Locked states Signed-off-by: Bernd Weymann * add charge statistics Signed-off-by: Bernd Weymann * add ChargingProfile channels Signed-off-by: Bernd Weymann * add charging sessions Signed-off-by: Bernd Weymann * add discovery properties Signed-off-by: Bernd Weymann * provide general check-control info Signed-off-by: Bernd Weymann * add test data for different vehicles Signed-off-by: Bernd Weymann * fix some checkstyle Signed-off-by: Bernd Weymann * add more vehicles to unit test Signed-off-by: Bernd Weymann * add F11 test Signed-off-by: Bernd Weymann * add service mileage Signed-off-by: Bernd Weymann * add check controls Signed-off-by: Bernd Weymann * add fingerprint mechanism Signed-off-by: Bernd Weymann * cleanup channels after rework Signed-off-by: Bernd Weymann * bugfixe requesting vehicles Signed-off-by: Bernd Weymann * fix brand handling Signed-off-by: Bernd Weymann * anonymous fingerprint Signed-off-by: Bernd Weymann * add charge statistics channels Signed-off-by: Bernd Weymann * add tire channels Signed-off-by: Bernd Weymann * remove range max channels Signed-off-by: Bernd Weymann * resolve last checkstyle issues Signed-off-by: Bernd Weymann * fix chrge profile updates Signed-off-by: Bernd Weymann * fix remote service execution Signed-off-by: Bernd Weymann * fix image handling Signed-off-by: Bernd Weymann * adapt service & checkcontrol handling Signed-off-by: Bernd Weymann * bugfix session selection Signed-off-by: Bernd Weymann * rework km / mi handling Signed-off-by: Bernd Weymann * introduce fallbacks for range calculations Signed-off-by: Bernd Weymann * unit tests for all available vehicle fingerprints Signed-off-by: Bernd Weymann * bugfixes during creation of HMI and translations Signed-off-by: Bernd Weymann * bugfix translation and language selection Signed-off-by: Bernd Weymann * introduce climate-now start / stop Signed-off-by: Bernd Weymann * bugfixes translation Signed-off-by: Bernd Weymann * add all fuelindicator fields Signed-off-by: Bernd Weymann * correct remote service ids, commands and translations Signed-off-by: Bernd Weymann * cleanup remote requsts and responses Signed-off-by: Bernd Weymann * add remote response examples Signed-off-by: Bernd Weymann * rework command options Signed-off-by: Bernd Weymann * remove unused timezoneprovider Signed-off-by: Bernd Weymann * locale language debugging Signed-off-by: Bernd Weymann * fix range value calculation Signed-off-by: Bernd Weymann * introduce charge-info channel Signed-off-by: Bernd Weymann * localize charge info string Signed-off-by: Bernd Weymann * smaller charge status fixes Signed-off-by: Bernd Weymann * 1st readme adaptions plus corresponding bugfixes Signed-off-by: Bernd Weymann * bugfix date time conversion Signed-off-by: Bernd Weymann * readme channel group update Signed-off-by: Bernd Weymann * add motion status Signed-off-by: Bernd Weymann * raw test anonymous fingerprint Signed-off-by: Bernd Weymann * revert motion status Signed-off-by: Bernd Weymann * bugfixes todo sections Signed-off-by: Bernd Weymann * china login Signed-off-by: Bernd Weymann * remove unnecessary info logging Signed-off-by: Bernd Weymann * spell check and example update Signed-off-by: Bernd Weymann * resolve codeowner conflicts Signed-off-by: Bernd Weymann * delete rex responses Signed-off-by: Bernd Weymann * bugfix linux characters Signed-off-by: Bernd Weymann * bugfix unit test with static time comparison Signed-off-by: Bernd Weymann * Copyright header adaption Signed-off-by: Bernd Weymann * add raw data channel Signed-off-by: Bernd Weymann * add address channel Signed-off-by: Bernd Weymann * add motion channel Signed-off-by: Bernd Weymann * add mild hybrid vehicle support Signed-off-by: Bernd Weymann * review comment corrections Signed-off-by: Bernd Weymann * correct review comments Signed-off-by: Bernd Weymann * resolve bom conflict Signed-off-by: Bernd Weymann --- CODEOWNERS | 1 + bom/openhab-addons/pom.xml | 5 + bundles/org.openhab.binding.mybmw/NOTICE | 13 + bundles/org.openhab.binding.mybmw/README.md | 846 ++++++++++++++++++ .../doc/AwayImage.png | Bin 0 -> 215730 bytes .../doc/CarStatusImages.png | Bin 0 -> 471157 bytes .../doc/ChargingImage.png | Bin 0 -> 192764 bytes .../doc/CheckControlImage.png | Bin 0 -> 345125 bytes .../doc/DiscoveryScan.png | Bin 0 -> 48202 bytes .../org.openhab.binding.mybmw/doc/RawData.png | Bin 0 -> 43952 bytes .../doc/RawDataItems.png | Bin 0 -> 31458 bytes .../doc/SessionOptions.png | Bin 0 -> 243953 bytes .../doc/UnlockedImage.png | Bin 0 -> 353189 bytes .../org.openhab.binding.mybmw/doc/panel.png | Bin 0 -> 1317196 bytes .../doc/properties.png | Bin 0 -> 55473 bytes .../doc/range-radius.png | Bin 0 -> 758058 bytes .../doc/vehicle-properties.png | Bin 0 -> 99010 bytes bundles/org.openhab.binding.mybmw/pom.xml | 17 + .../src/main/feature/feature.xml | 9 + .../mybmw/internal/MyBMWConfiguration.java | 45 + .../mybmw/internal/MyBMWConstants.java | 204 +++++ .../mybmw/internal/MyBMWHandlerFactory.java | 71 ++ .../mybmw/internal/VehicleConfiguration.java | 41 + .../internal/discovery/VehicleDiscovery.java | 223 +++++ .../internal/dto/auth/AuthQueryResponse.java | 50 ++ .../mybmw/internal/dto/auth/AuthResponse.java | 36 + .../internal/dto/auth/ChinaAccessToken.java | 29 + .../internal/dto/auth/ChinaPublicKey.java | 25 + .../dto/auth/ChinaPublicKeyResponse.java | 25 + .../dto/auth/ChinaTokenExpiration.java | 25 + .../internal/dto/auth/ChinaTokenResponse.java | 25 + .../internal/dto/charge/ChargeProfile.java | 44 + .../internal/dto/charge/ChargeSession.java | 28 + .../internal/dto/charge/ChargeSessions.java | 27 + .../dto/charge/ChargeSessionsContainer.java | 23 + .../internal/dto/charge/ChargeStatistics.java | 26 + .../dto/charge/ChargeStatisticsContainer.java | 24 + .../internal/dto/charge/ChargingSettings.java | 25 + .../internal/dto/charge/ChargingWindow.java | 23 + .../mybmw/internal/dto/charge/Time.java | 31 + .../mybmw/internal/dto/charge/Timer.java | 35 + .../internal/dto/network/NetworkError.java | 38 + .../internal/dto/properties/Address.java | 22 + .../mybmw/internal/dto/properties/CBS.java | 27 + .../mybmw/internal/dto/properties/CCM.java | 22 + .../dto/properties/ChargingState.java | 25 + .../internal/dto/properties/Coordinates.java | 23 + .../internal/dto/properties/Distance.java | 23 + .../mybmw/internal/dto/properties/Doors.java | 25 + .../internal/dto/properties/DoorsWindows.java | 26 + .../internal/dto/properties/FuelLevel.java | 23 + .../internal/dto/properties/Location.java | 24 + .../internal/dto/properties/Properties.java | 43 + .../mybmw/internal/dto/properties/Range.java | 23 + .../mybmw/internal/dto/properties/Tire.java | 22 + .../internal/dto/properties/TireStatus.java | 25 + .../mybmw/internal/dto/properties/Tires.java | 25 + .../internal/dto/properties/Windows.java | 25 + .../internal/dto/remote/ExecutionError.java | 31 + .../dto/remote/ExecutionStatusContainer.java | 25 + .../mybmw/internal/dto/status/CBSMessage.java | 27 + .../mybmw/internal/dto/status/CCMMessage.java | 30 + .../mybmw/internal/dto/status/DoorWindow.java | 25 + .../internal/dto/status/FuelIndicator.java | 41 + .../mybmw/internal/dto/status/Issues.java | 22 + .../mybmw/internal/dto/status/Mileage.java | 24 + .../mybmw/internal/dto/status/Status.java | 38 + .../internal/dto/vehicle/Capabilities.java | 52 ++ .../internal/dto/vehicle/RemoteService.java | 24 + .../mybmw/internal/dto/vehicle/Vehicle.java | 46 + .../handler/ByteResponseCallback.java | 26 + .../internal/handler/MyBMWBridgeHandler.java | 141 +++ .../handler/MyBMWCommandOptionProvider.java | 41 + .../mybmw/internal/handler/MyBMWProxy.java | 510 +++++++++++ .../handler/RemoteServiceHandler.java | 227 +++++ .../internal/handler/ResponseCallback.java | 26 + .../handler/StringResponseCallback.java | 27 + .../binding/mybmw/internal/handler/Token.java | 58 ++ .../handler/VehicleChannelHandler.java | 456 ++++++++++ .../internal/handler/VehicleHandler.java | 351 ++++++++ .../internal/handler/simulation/Injector.java | 43 + .../mybmw/internal/utils/BimmerConstants.java | 75 ++ .../internal/utils/ChargeProfileUtils.java | 137 +++ .../internal/utils/ChargeProfileWrapper.java | 303 +++++++ .../mybmw/internal/utils/Constants.java | 106 +++ .../mybmw/internal/utils/Converter.java | 371 ++++++++ .../mybmw/internal/utils/HTTPConstants.java | 53 ++ .../mybmw/internal/utils/ImageProperties.java | 47 + .../internal/utils/RemoteServiceUtils.java | 44 + .../internal/utils/VehicleStatusUtils.java | 241 +++++ .../main/resources/OH-INF/binding/binding.xml | 9 + .../resources/OH-INF/config/bridge-config.xml | 34 + .../resources/OH-INF/config/thing-config.xml | 23 + .../resources/OH-INF/i18n/mybmw_de.properties | 225 +++++ .../OH-INF/thing/bridge-connected-drive.xml | 12 + .../charge-statistics-channel-groups.xml | 15 + .../thing/charge-statistics-channel-types.xml | 21 + .../thing/check-control-channel-types.xml | 18 + .../OH-INF/thing/check-control-group.xml | 15 + .../OH-INF/thing/conv-range-channel-group.xml | 16 + .../thing/door-status-channel-types.xml | 61 ++ .../OH-INF/thing/doors-status-group.xml | 23 + .../OH-INF/thing/ev-range-channel-group.xml | 16 + .../OH-INF/thing/ev-vehicle-status-group.xml | 24 + .../thing/hybrid-range-channel-group.xml | 21 + .../OH-INF/thing/image-channel-group.xml | 14 + .../OH-INF/thing/image-channel-types.xml | 23 + .../OH-INF/thing/location-channel-group.xml | 15 + .../OH-INF/thing/location-channel-types.xml | 19 + .../OH-INF/thing/profile-channel-groups.xml | 56 ++ .../OH-INF/thing/profile-channel-types.xml | 248 +++++ .../OH-INF/thing/range-channel-types.xml | 51 ++ .../thing/remote-services-channel-group.xml | 14 + .../thing/remote-services-channel-types.xml | 15 + .../OH-INF/thing/service-channel-types.xml | 24 + .../resources/OH-INF/thing/service-group.xml | 16 + .../OH-INF/thing/session-channel-groups.xml | 17 + .../OH-INF/thing/session-channel-types.xml | 26 + .../main/resources/OH-INF/thing/thing-bev.xml | 34 + .../resources/OH-INF/thing/thing-bev_rex.xml | 34 + .../resources/OH-INF/thing/thing-conv.xml | 31 + .../resources/OH-INF/thing/thing-phev.xml | 34 + .../OH-INF/thing/tires-channel-groups.xml | 20 + .../OH-INF/thing/tires-channel-types.xml | 46 + .../thing/vehicle-status-channel-types.xml | 64 ++ .../OH-INF/thing/vehicle-status-group.xml | 21 + .../internal/discovery/DiscoveryTest.java | 116 +++ .../mybmw/internal/dto/ChargeProfileTest.java | 54 ++ .../internal/dto/ChargeStatisticWrapper.java | 107 +++ .../mybmw/internal/dto/StatusWrapper.java | 587 ++++++++++++ .../internal/dto/VehiclePropertiesTest.java | 63 ++ .../mybmw/internal/dto/VehicleStatusTest.java | 115 +++ .../mybmw/internal/handler/AuthTest.java | 423 +++++++++ .../handler/ChargeStatisticsTest.java | 139 +++ .../internal/handler/ConfigurationTest.java | 47 + .../internal/handler/ErrorResponseTest.java | 76 ++ .../internal/handler/SimulationTest.java | 33 + .../mybmw/internal/handler/VehicleTests.java | 340 +++++++ .../mybmw/internal/util/FileReader.java | 48 + .../mybmw/internal/util/LocaleTest.java | 38 + .../resources/responses/530e/vehicles.json | 379 ++++++++ .../responses/F11/vehicles_v2_bmw_0.json | 279 ++++++ .../responses/F31/vehicles_v2_bmw_0.json | 281 ++++++ .../responses/F44/vehicles_v2_bmw_0.json | 251 ++++++ .../responses/F45/vehicles_v2_bmw_0.json | 301 +++++++ .../responses/F48/vehicles_v2_bmw_0.json | 278 ++++++ .../responses/G01/vehicles_v2_bmw_0.json | 429 +++++++++ .../responses/G05/vehicles_v2_bmw_0.json | 401 +++++++++ .../responses/G08/vehicles_v2_bmw_0.json | 401 +++++++++ .../test/resources/responses/G21/340i.json | 401 +++++++++ .../responses/G21/charging-sessions_0.json | 103 +++ .../responses/G21/charging-statistics_0.json | 11 + .../resources/responses/G21/json_export.json | 831 +++++++++++++++++ .../responses/G21/vehicles_v2_bmw_0.json | 542 +++++++++++ .../responses/G30/charging-sessions_0.json | 63 ++ .../responses/G30/charging-statistics_0.json | 11 + .../responses/G30/vehicles_v2_bmw_0.json | 384 ++++++++ .../I01_NOREX/charging-sessions_0.json | 23 + .../I01_NOREX/charging-statistics_0.json | 11 + .../I01_NOREX/vehicles_v2_bmw_0.json | 316 +++++++ .../responses/I01_REX/charge-sessions.json | 156 ++++ .../I01_REX/charge-statistics-de.json | 11 + .../I01_REX/charge-statistics-en.json | 11 + .../I01_REX/charging-statistics_1.json | 11 + .../responses/I01_REX/vehicle-charging.json | 427 +++++++++ .../I01_REX/vehicle-fully-charged.json | 423 +++++++++ .../responses/I01_REX/vehicles-de.json | 427 +++++++++ .../resources/responses/I01_REX/vehicles.json | 427 +++++++++ .../responses/I01_REX/vehicles_v2_bmw_0.json | 387 ++++++++ .../responses/TwoVehicles/anonymous-raw.json | 386 ++++++++ .../responses/TwoVehicles/f11-raw.json | 283 ++++++ .../responses/TwoVehicles/two-vehicles.json | 665 ++++++++++++++ .../auth/OAuthConfig_ROW_response.json | 31 + .../responses/auth/OAuth_Login_Response.json | 3 + .../responses/auth/auth_cn_login_error.json | 7 + .../responses/auth/auth_cn_login_pwd.json | 12 + .../responses/auth/auth_cn_publickey.json | 9 + .../auth/auth_error_internal_error.txt | 1 + .../auth/auth_error_wrong_password.json | 4 + .../resources/responses/auth/auth_token.json | 7 + .../auth/authorization_response.json | 3 + .../resources/responses/auth/china-key.json | 9 + .../responses/auth/oauth_config.json | 31 + .../chargingprofile/two-weeks-timer.json | 301 +++++++ .../weekly-planner-t2-active.json | 427 +++++++++ .../resources/responses/fingerprint-raw.json | 423 +++++++++ .../test/resources/responses/fingerprint.json | 387 ++++++++ .../eadrax_service_delivered.json | 3 + .../eadrax_service_eventposition.json | 12 + .../eadrax_service_executed.json | 3 + .../eadrax_service_initiated.json | 4 + .../eadrax_service_pending.json | 3 + .../remote_services/service-error.json | 11 + bundles/pom.xml | 1 + 194 files changed, 20628 insertions(+) create mode 100644 bundles/org.openhab.binding.mybmw/NOTICE create mode 100644 bundles/org.openhab.binding.mybmw/README.md create mode 100644 bundles/org.openhab.binding.mybmw/doc/AwayImage.png create mode 100644 bundles/org.openhab.binding.mybmw/doc/CarStatusImages.png create mode 100644 bundles/org.openhab.binding.mybmw/doc/ChargingImage.png create mode 100644 bundles/org.openhab.binding.mybmw/doc/CheckControlImage.png create mode 100644 bundles/org.openhab.binding.mybmw/doc/DiscoveryScan.png create mode 100644 bundles/org.openhab.binding.mybmw/doc/RawData.png create mode 100644 bundles/org.openhab.binding.mybmw/doc/RawDataItems.png create mode 100644 bundles/org.openhab.binding.mybmw/doc/SessionOptions.png create mode 100644 bundles/org.openhab.binding.mybmw/doc/UnlockedImage.png create mode 100644 bundles/org.openhab.binding.mybmw/doc/panel.png create mode 100644 bundles/org.openhab.binding.mybmw/doc/properties.png create mode 100644 bundles/org.openhab.binding.mybmw/doc/range-radius.png create mode 100644 bundles/org.openhab.binding.mybmw/doc/vehicle-properties.png create mode 100644 bundles/org.openhab.binding.mybmw/pom.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/feature/feature.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/MyBMWConfiguration.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/MyBMWConstants.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/MyBMWHandlerFactory.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/VehicleConfiguration.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/discovery/VehicleDiscovery.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/auth/AuthQueryResponse.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/auth/AuthResponse.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/auth/ChinaAccessToken.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/auth/ChinaPublicKey.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/auth/ChinaPublicKeyResponse.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/auth/ChinaTokenExpiration.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/auth/ChinaTokenResponse.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/charge/ChargeProfile.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/charge/ChargeSession.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/charge/ChargeSessions.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/charge/ChargeSessionsContainer.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/charge/ChargeStatistics.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/charge/ChargeStatisticsContainer.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/charge/ChargingSettings.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/charge/ChargingWindow.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/charge/Time.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/charge/Timer.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/network/NetworkError.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/Address.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/CBS.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/CCM.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/ChargingState.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/Coordinates.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/Distance.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/Doors.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/DoorsWindows.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/FuelLevel.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/Location.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/Properties.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/Range.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/Tire.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/TireStatus.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/Tires.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/properties/Windows.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/remote/ExecutionError.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/remote/ExecutionStatusContainer.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/status/CBSMessage.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/status/CCMMessage.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/status/DoorWindow.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/status/FuelIndicator.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/status/Issues.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/status/Mileage.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/status/Status.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/vehicle/Capabilities.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/vehicle/RemoteService.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/dto/vehicle/Vehicle.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/handler/ByteResponseCallback.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/handler/MyBMWBridgeHandler.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/handler/MyBMWCommandOptionProvider.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/handler/MyBMWProxy.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/handler/RemoteServiceHandler.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/handler/ResponseCallback.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/handler/StringResponseCallback.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/handler/Token.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/handler/VehicleChannelHandler.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/handler/VehicleHandler.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/handler/simulation/Injector.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/utils/BimmerConstants.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/utils/ChargeProfileUtils.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/utils/ChargeProfileWrapper.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/utils/Constants.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/utils/Converter.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/utils/HTTPConstants.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/utils/ImageProperties.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/utils/RemoteServiceUtils.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/java/org/openhab/binding/mybmw/internal/utils/VehicleStatusUtils.java create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/binding/binding.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/config/bridge-config.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/config/thing-config.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/i18n/mybmw_de.properties create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/bridge-connected-drive.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/charge-statistics-channel-groups.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/charge-statistics-channel-types.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/check-control-channel-types.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/check-control-group.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/conv-range-channel-group.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/door-status-channel-types.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/doors-status-group.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/ev-range-channel-group.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/ev-vehicle-status-group.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/hybrid-range-channel-group.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/image-channel-group.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/image-channel-types.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/location-channel-group.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/location-channel-types.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/profile-channel-groups.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/profile-channel-types.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/range-channel-types.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/remote-services-channel-group.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/remote-services-channel-types.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/service-channel-types.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/service-group.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/session-channel-groups.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/session-channel-types.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/thing-bev.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/thing-bev_rex.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/thing-conv.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/thing-phev.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/tires-channel-groups.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/tires-channel-types.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/vehicle-status-channel-types.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/main/resources/OH-INF/thing/vehicle-status-group.xml create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/discovery/DiscoveryTest.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/dto/ChargeProfileTest.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/dto/ChargeStatisticWrapper.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/dto/StatusWrapper.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/dto/VehiclePropertiesTest.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/dto/VehicleStatusTest.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/handler/AuthTest.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/handler/ChargeStatisticsTest.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/handler/ConfigurationTest.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/handler/ErrorResponseTest.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/handler/SimulationTest.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/handler/VehicleTests.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/util/FileReader.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/java/org/openhab/binding/mybmw/internal/util/LocaleTest.java create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/530e/vehicles.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/F11/vehicles_v2_bmw_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/F31/vehicles_v2_bmw_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/F44/vehicles_v2_bmw_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/F45/vehicles_v2_bmw_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/F48/vehicles_v2_bmw_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/G01/vehicles_v2_bmw_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/G05/vehicles_v2_bmw_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/G08/vehicles_v2_bmw_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/G21/340i.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/G21/charging-sessions_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/G21/charging-statistics_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/G21/json_export.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/G21/vehicles_v2_bmw_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/G30/charging-sessions_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/G30/charging-statistics_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/G30/vehicles_v2_bmw_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/I01_NOREX/charging-sessions_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/I01_NOREX/charging-statistics_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/I01_NOREX/vehicles_v2_bmw_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/I01_REX/charge-sessions.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/I01_REX/charge-statistics-de.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/I01_REX/charge-statistics-en.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/I01_REX/charging-statistics_1.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/I01_REX/vehicle-charging.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/I01_REX/vehicle-fully-charged.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/I01_REX/vehicles-de.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/I01_REX/vehicles.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/I01_REX/vehicles_v2_bmw_0.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/TwoVehicles/anonymous-raw.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/TwoVehicles/f11-raw.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/TwoVehicles/two-vehicles.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/auth/OAuthConfig_ROW_response.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/auth/OAuth_Login_Response.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/auth/auth_cn_login_error.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/auth/auth_cn_login_pwd.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/auth/auth_cn_publickey.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/auth/auth_error_internal_error.txt create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/auth/auth_error_wrong_password.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/auth/auth_token.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/auth/authorization_response.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/auth/china-key.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/auth/oauth_config.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/chargingprofile/two-weeks-timer.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/chargingprofile/weekly-planner-t2-active.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/fingerprint-raw.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/fingerprint.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/remote_services/eadrax_service_delivered.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/remote_services/eadrax_service_eventposition.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/remote_services/eadrax_service_executed.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/remote_services/eadrax_service_initiated.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/remote_services/eadrax_service_pending.json create mode 100644 bundles/org.openhab.binding.mybmw/src/test/resources/responses/remote_services/service-error.json diff --git a/CODEOWNERS b/CODEOWNERS index ee0088abd..2250a960f 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -202,6 +202,7 @@ /bundles/org.openhab.binding.mqtt.homeassistant/ @davidgraeff @antroids /bundles/org.openhab.binding.mqtt.homie/ @davidgraeff /bundles/org.openhab.binding.mycroft/ @dalgwen +/bundles/org.openhab.binding.mybmw/ @weymann @ntruchsess /bundles/org.openhab.binding.myq/ @digitaldan /bundles/org.openhab.binding.mystrom/ @pail23 /bundles/org.openhab.binding.nanoleaf/ @raepple @stefan-hoehn diff --git a/bom/openhab-addons/pom.xml b/bom/openhab-addons/pom.xml index 87c62166d..7176056bb 100644 --- a/bom/openhab-addons/pom.xml +++ b/bom/openhab-addons/pom.xml @@ -1001,6 +1001,11 @@ org.openhab.binding.mycroft ${project.version} + + org.openhab.addons.bundles + org.openhab.binding.mybmw + ${project.version} + org.openhab.addons.bundles org.openhab.binding.myq diff --git a/bundles/org.openhab.binding.mybmw/NOTICE b/bundles/org.openhab.binding.mybmw/NOTICE new file mode 100644 index 000000000..38d625e34 --- /dev/null +++ b/bundles/org.openhab.binding.mybmw/NOTICE @@ -0,0 +1,13 @@ +This content is produced and maintained by the openHAB project. + +* Project home: https://www.openhab.org + +== Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License 2.0 which is available at +https://www.eclipse.org/legal/epl-2.0/. + +== Source Code + +https://github.com/openhab/openhab-addons diff --git a/bundles/org.openhab.binding.mybmw/README.md b/bundles/org.openhab.binding.mybmw/README.md new file mode 100644 index 000000000..9ee702052 --- /dev/null +++ b/bundles/org.openhab.binding.mybmw/README.md @@ -0,0 +1,846 @@ +# MyBMW Binding + +The binding provides access like [MyBMW App](https://www.bmw.com/en/footer/mybmw-app.html) to openHAB. +All vehicles connected to an account will be detected by the discovery with the correct type: + +* Conventional Fuel Vehicle +* Plugin-Hybrid Electrical Vehicle +* Battery Electric Vehicle with Range Extender +* Battery Electric Vehicle + +In addition properties are attached with information and services provided by this vehicle. +The provided data depends on + +1. the [Thing Type](#things) and +2. the [Properties](#properties) mentioned in Services + +Different channel groups are clustering all information. +Check for each group if it's supported by your vehicle. + +Please note **this isn't a real-time binding**. +If a door is opened the state isn't transmitted and changed immediately. +It's not a flaw in the binding itself because the state in BMW's own MyBMW App is also updated with some delay. + +## Supported Things + +### Bridge + +The bridge establishes the connection between BMW API and openHAB. + +| Name | Bridge Type ID | Description | +|----------------------------|----------------|------------------------------------------| +| MyBMW Account | `account` | Access to BMW API for a specific user | + + +### Things + +Four different vehicle types are provided. +They differ in the supported channel groups & channels. +Conventional Fuel Vehicles don't provide e.g. _Charging Profile_, Electric Vehicles don't provide a _Fuel Range_. +For hybrid vehicles in addition to _Fuel and Electric Range_ the _Hybrid Range_ is shown. + +| Name | Thing Type ID | Supported Channel Groups | +|-------------------------------------|---------------|---------------------------------------------------------------------| +| BMW Electric Vehicle | `bev` | Vehicle with electric drive train | +| BMW Electric Vehicle with REX | `bev_rex` | Vehicle with electric drive train plus fuel powered range extender | +| BMW Plug-In-Hybrid Electric Vehicle | `phev` | Vehicle with combustion and electric drive train | +| BMW Conventional Vehicle | `conv` | Vehicle with combustion drive train | + + +#### Properties + + + +For each vehicle properties are available. +Basic information is given regarding + +* Vehicle properties like model type, drive train and construction year +* Which services are available / not available + +In the right picture can see in *remoteServicesEnabled* e.g. the *Door Lock* and *Door Unlock* services are mentioned. +This ensures channel group [Remote Services](#remote-services) is supporting door lock and unlock remote control. + +In *Services Supported* the entry *ChargingHistory* is mentioned. +So it's valid to connect channel group [Charge Sessions](#charge-sessions) in order to display your last charging sessions. + +| Property Key | Property Value | Supported Channel Groups | +|------------------------|---------------------|------------------------------| +| servicesSupported | ChargingHistory | session | +| remoteServicesEnabled | _list of services_ | remote | + + +## Discovery + +Auto discovery is starting after the bridge is created. +A list of your registered vehicles is queried and all found things are added in the inbox. +Unique identifier is the *Vehicle Identification Number* (VIN). +If a thing is already declared in a _.things_ configuration, discovery won't highlight it again. +Properties will be attached to predefined vehicles if the VIN is matching. + +## Configuration + +### Bridge Configuration + +| Parameter | Type | Description | +|-----------------|---------|--------------------------------------------------------------------| +| userName | text | MyBMW Username | +| password | text | MyBMW Password | +| region | text | Select region in order to connect to the appropriate BMW server. | + +The region Configuration has 3 different options + +* _NORTH_AMERICA_ +* _CHINA_ +* _ROW_ (Rest of World) + + +#### Advanced Configuration + +| Parameter | Type | Description | +|-----------------|---------|---------------------------------------------------------| +| language | text | Channel data can be returned in the desired language | + +Language is predefined as *AUTODETECT*. +Some textual descriptions, date and times are delivered based on your local language. +You can overwrite this setting with lowercase 2-letter [language code reagrding ISO 639](https://www.oracle.com/java/technologies/javase/jdk8-jre8-suported-locales.html) +So if want your UI in english language place *en* as desired language. + +### Thing Configuration + +Same configuration is needed for all things + +| Parameter | Type | Description | +|-----------------|---------|---------------------------------------| +| vin | text | Vehicle Identification Number (VIN) | +| refreshInterval | integer | Refresh Interval in Minutes | + + +#### Advanced Configuration + +| Parameter | Type | Description | +|-----------------|---------|-----------------------------------| +| vehicleBrand | text | Vehicle Brand like BMW or Mini | + +The _vehicleBrand_ is automatically obtained by the discovery service and shall not be changed. +If thing is defined manually via *.things file following brands are supported + +* BMW +* MINI + + +## Channels + +There are many channels available for each vehicle. +For better overview they are clustered in different channel groups. +They differ for each vehicle type, build-in sensors and activated services. + + +### Thing Channel Groups + +| Channel Group ID | Description | conv | phev | bev_rex | bev | +|----------------------------------|---------------------------------------------------|------|------|---------|-----| +| [status](#vehicle-status) | Overall vehicle status | X | X | X | X | +| [range](#range-data) | Provides mileage, range and charge / fuel levels | X | X | X | X | +| [doors](#doors-details) | Detials of all doors and windows | X | X | X | X | +| [check](#check-control) | Shows current active CheckControl messages | X | X | X | X | +| [service](#services) | Future vehicle service schedules | X | X | X | X | +| [location](#location) | Coordinates and heading of the vehicle | X | X | X | X | +| [remote](#remote-services) | Remote control of the vehicle | X | X | X | X | +| [profile](#charge-profile) | Scheduled charging profiles of vehicle | | X | X | X | +| [statistic](#charge-statistics) | Charging statistics of current month | | X | X | X | +| [session](#charge-sessions) | Past charging sessions | | X | X | X | +| [tires](#tire-pressure) | Current and wanted pressure for all tires | X | X | X | X | +| [image](#image) | Provides an image of your vehicle | X | X | X | X | + + +#### Vehicle Status + +Reflects overall status of the vehicle. + +* Channel Group ID is **status** +* Available for all vehicles +* Read-only values + +| Channel Label | Channel ID | Type | Description | conv | phev | bev_rex | bev | +|---------------------------|---------------------|---------------|------------------------------------------------|------|------|---------|-----| +| Overall Door Status | doors | String | Combined status for all doors | X | X | X | X | +| Overall Window Status | windows | String | Combined status for all windows | X | X | X | X | +| Doors Locked | lock | String | Status if vehicle is secured | X | X | X | X | +| Next Service Date | service-date | DateTime | Date of next upcoming service | X | X | X | X | +| Mileage till Next Service | service-mileage | Number:Length | Mileage till upcoming service | X | X | X | X | +| Check Control | check-control | String | Presence of active warning messages | X | X | X | X | +| Plug Connection Status | plug-connection | String | Plug is _Connected_ or _Not connected_ | | X | X | X | +| Charging Status | charge | String | Current charging status | | X | X | X | +| Charging Information | charge-info | String | Information regarding current charging session | | X | X | X | +| Motion Status | motion | Switch | Driving state - depends on vehicle hardware | X | X | X | X | +| Last Status Timestamp | last-update | DateTime | Date and time of last status update | X | X | X | X | + +Overall Door Status values + +* _Closed_ - all doors closed +* _Open_ - at least one door is open +* _Undef_ - no door data delivered at all + +Overall Windows Status values + +* _Closed_ - all windows closed +* _Open_ - at least one window is completely open +* _Intermediate_ - at least one window is partially open +* _Undef_ - no window data delivered at all + +Check Control values + +Localized String of current active warnings. +Examples: + +* No Issues +* Multiple Issues + +Charging Status values + +* _Not Charging_ +* _Charging_ +* _Plugged In_ +* _Fully Charged_ + +Charging Information values +Localized String of current active charging session +Examples + +* 100% at ~00:43 +* Starts at ~09:00 + +##### Vehicle Status Raw Data + +The _raw data channel_ is marked as _advanced_ and isn't shown by default. +Target are advanced users to derive even more data out of BMW API replies. +As the replies are formatted as JSON use the [JsonPath Transformation Service](https://www.openhab.org/addons/transformations/jsonpath/) to extract data for an item, + +| Channel Label | Channel ID | Type | Description | +|---------------------------|---------------------|---------------|------------------------------------------------| +| Raw Data | raw | String | Unfiltered JSON String of vehicle data | + + + +Examples: + +_Country ISO Code_ + +``` +$.properties.originCountryISO +``` + +_Drivers Guide URL_ + +``` +$.driverGuideInfo.androidStoreUrl +``` + +#### Range Data + +Based on vehicle type some channels are present or not. +Conventional fuel vehicles don't provide *Electric Range* and battery electric vehicles don't show *Fuel Range*. +Hybrid vehicles have both and in addition *Hybrid Range*. +See description [Range vs Range Radius](#range-vs-range-radius) to get more information. + +* Channel Group ID is **range** +* Availability according to table +* Read-only values + +| Channel Label | Channel ID | Type | conv | phev | bev_rex | bev | +|---------------------------|-------------------------|----------------------|------|------|---------|-----| +| Mileage | mileage | Number:Length | X | X | X | X | +| Fuel Range | range-fuel | Number:Length | X | X | X | | +| Electric Range | range-electric | Number:Length | | X | X | X | +| Hybrid Range | range-hybrid | Number:Length | | X | X | | +| Battery Charge Level | soc | Number:Dimensionless | | X | X | X | +| Remaining Fuel | remaining-fuel | Number:Volume | X | X | X | | +| Fuel Range Radius | range-radius-fuel | Number:Length | X | X | X | | +| Electric Range Radius | range-radius-electric | Number:Length | | X | X | X | +| Hybrid Range Radius | range-radius-hybrid | Number:Length | | X | X | | + + +#### Doors Details + +Detailed status of all doors and windows. + +* Channel Group ID is **doors** +* Available for all vehicles if corresponding sensors are built-in +* Read-only values + +| Channel Label | Channel ID | Type | +|----------------------------|-------------------------|---------------| +| Driver Door | driver-front | String | +| Driver Door Rear | driver-rear | String | +| Passenger Door | passenger-front | String | +| Passenger Door Rear | passenger-rear | String | +| Trunk | trunk | String | +| Hood | hood | String | +| Driver Window | win-driver-front | String | +| Driver Rear Window | win-driver-rear | String | +| Passenger Window | win-passenger-front | String | +| Passenger Rear Window | win-passenger-rear | String | +| Rear Window | win-rear | String | +| Sunroof | sunroof | String | + +Possible states + +* _Undef_ - no status data available +* _Invalid_ - this door / window isn't applicable for this vehicle +* _Closed_ - the door / window is closed +* _Open_ - the door / window is open +* _Intermediate_ - window in intermediate position, not applicable for doors + + +#### Check Control + +Group for all current active Check Control messages. +If more than one message is active the channel _name_ contains all active messages as options. + +* Channel Group ID is **check** +* Available for all vehicles +* Read/Write access + +| Channel Label | Channel ID | Type | Access | +|---------------------------------|---------------------|----------------|------------| +| Check Control Description | name | String | Read/Write | +| Check Control Details | details | String | Read | +| Severity Level | severity | String | Read | + +Severity Levels + +* Ok +* Low +* Medium + + +#### Services + +Group for all upcoming services with description, service date and/or service mileage. +If more than one service is scheduled in the future the channel _name_ contains all future services as options. + +* Channel Group ID is **service** +* Available for all vehicles +* Read/Write access + +| Channel Label | Channel ID | Type | Access | +|--------------------------------|---------------------|----------------|------------| +| Service Name | name | String | Read/Write | +| Service Details | details | String | Read | +| Service Date | date | DateTime | Read | +| Mileage till Service | mileage | Number:Length | Read | + + +#### Location + +GPS location and heading of the vehicle. + +* Channel Group ID is **location** +* Available for all vehicles with built-in GPS sensor. Function can be enabled/disabled in the head unit +* Read-only values + +| Channel Label | Channel ID | Type | +|-----------------|---------------------|--------------| +| GPS Coordinates | gps | Location | +| Heading | heading | Number:Angle | +| Address | address | String | + + +#### Remote Services + +Remote control of the vehicle. +Send a *command* to the vehicle and the *state* is reporting the execution progress. +Only one command can be executed each time. +Parallel execution isn't supported. + +* Channel Group ID is **remote** +* Available for all commands mentioned in *Services Activated*. See [Vehicle Properties](#properties) for further details +* Read/Write access + + +| Channel Label | Channel ID | Type | Access | +|-------------------------|---------------------|---------|--------| +| Remote Service Command | command | String | Write | +| Service Execution State | state | String | Read | + +The channel _command_ provides options + +* _flash-lights_ +* _vehicle-finder_ +* _door-lock_ +* _door-unlock_ +* _horn-low_ +* _climate-now-start_ +* _climate-now-stop_ + +The channel _state_ shows the progress of the command execution in the following order + +1) _initiated_ +2) _pending_ +3) _delivered_ +4) _executed_ + + +#### Charge Profile + +Charging options with date and time for preferred time windows and charging modes. + +* Channel Group ID is **profile** +* Available for electric and hybrid vehicles +* Read access for UI. +* There are 4 timers *T1, T2, T3 and T4* available. Replace *X* with number 1,2 or 3 to target the correct timer + +| Channel Label | Channel ID | Type | +|----------------------------|---------------------------|----------| +| Charge Mode | mode | String | +| Charge Preferences | prefs | String | +| Charging Plan | control | String | +| SoC Target | target | String | +| Charging Energy Limited | limit | Switch | +| Window Start Time | window-start | DateTime | +| Window End Time | window-end | DateTime | +| A/C at Departure | climate | Switch | +| T*X* Enabled | timer*X*-enabled | Switch | +| T*X* Departure Time | timer*X*-departure | DateTime | +| T*X* Monday | timer*X*-day-mon | Switch | +| T*X* Tuesday | timer*X*-day-tue | Switch | +| T*X* Wednesday | timer*X*-day-wed | Switch | +| T*X* Thursday | timer*X*-day-thu | Switch | +| T*X* Friday | timer*X*-day-fri | Switch | +| T*X* Saturday | timer*X*-day-sat | Switch | +| T*X* Sunday | timer*X*-day-sun | Switch | + +The channel _profile-mode_ supports + +* *immediateCharging* +* *delayedCharging* + +The channel _profile-prefs_ supports + +* *noPreSelection* +* *chargingWindow* + + +#### Charge Statistics + +Shows charge statistics of the current month + +* Channel Group ID is **statistic** +* Available for electric and hybrid vehicles +* Read-only values + +| Channel Label | Channel ID | Type | +|----------------------------|-------------------------|----------------| +| Charge Statistic Month | title | String | +| Energy Charged | energy | Number:Energy | +| Charge Sessions | sessions | Number | + + +#### Charge Sessions + +Group for past charging sessions. +If more than one message is active the channel _name_ contains all active messages as options. + +* Channel Group ID is **session** +* Available for electric and hybrid vehicles +* Read-only values + +| Channel Label | Channel ID | Type | +|---------------------------------|--------------|----------| +| Session Title | title | String | +| Session Details | subtitle | String | +| Charged Energy in Session | energy | String | +| Issues during Session | issue | String | +| Session Status | status | String | + + +#### Tire Pressure + +Current and target tire pressure values + +* Channel Group ID is **tires** +* Available for all vehicles if corresponding sensors are built-in +* Read-only values + +| Channel Label | Channel ID | Type | +|----------------------------|-------------------------|------------------| +| Front Left | fl-current | Number:Pressure | +| Front Left Target | fl-target | Number:Pressure | +| Front Right | fr-current | Number:Pressure | +| Front Right Target | fr-target | Number:Pressure | +| Rear Left | rl-current | Number:Pressure | +| Rear Left Target | rl-target | Number:Pressure | +| Rear Right | rr-current | Number:Pressure | +| Rear Right Target | rr-target | Number:Pressure | + + +#### Image + +Image representation of the vehicle. + +* Channel Group ID is **image** +* Available for all vehicles +* Read/Write access + +| Channel Label | Channel ID | Type | Access | +|----------------------------|---------------------|--------|----------| +| Rendered Vehicle Image | png | Image | Read | +| Image Viewport | view | String | Write | + +Possible view ports: + +* _VehicleStatus_ Front Side View +* _VehicleInfo_ Front View +* _ChargingHistory_ Side View +* _Default_ Front Side View + + +## Further Descriptions + +### Dynamic Data + + + +There are 3 occurrences of dynamic data delivered + +* Upcoming Services delivered in group [Services](#services) +* Check Control Messages delivered in group [Check Control](#check-control) +* Charging Session data delivered in group [Charge Sessions](#charge-sessions) + +The channel id _name_ shows the first element as default. +All other possibilities are attached as options. +The picture on the right shows the _Session Title_ item and 3 possible options. +Select the desired service and the corresponding Charge Session with _Energy Charged_, _Session Status_ and _Session Issues_ will be shown. + +### TroubleShooting + +BMW has a high range of vehicles supported by their API. +In case of any issues with this binding help to resolve it! +Please perform the following steps: + +* Can you log into MyBMW App with your credentials? +* Is the vehicle listed in your account? +* Is the [MyBMW Brige](#bridge) status _Online_? + +If these preconditions are fulfilled proceed with the fingerprint generation. + +#### Generate Debug Fingerprint + + + + +First [enable debug logging](https://www.openhab.org/docs/administration/logging.html#defining-what-to-log) for the binding. + +``` +log:set DEBUG org.openhab.binding.mybmw +``` + +The debug fingerprint is generated every time the discovery is executed. +To force a new fingerprint perform a _Scan_ for MyBMW things. +Personal data is eliminated from the log entries so it should be possible to share them in public. +Data like + +* Vehicle Identification Number (VIN) +* Location data + +are anonymized. +You'll find the fingerprint in the logs with the command + +``` +grep "Discovery Fingerprint Data" openhab.log +``` + +After the corresponding fingerprint is generated please [follow the instructions to raise an issue](https://community.openhab.org/t/how-to-file-an-issue/68464) and attach the fingerprint data! +Your feedback is highly appreciated! + + +### Range vs Range Radius + + + +You will observe differences in the vehicle range and range radius values. +While range is indicating the possible distance to be driven on roads the range radius indicates the reachable range on the map. + +The right picture shows the distance between Kassel and Frankfurt in Germany. +While the air-line distance is 145 kilometers the route distance is 192 kilometers. +So range value is the normal remaining range while the range radius values can be used e.g. on [Mapview](https://www.openhab.org/docs/ui/sitemaps.html#element-type-mapview) to indicate the reachable range on map. +Please note this is just an indicator of the effective range. +Especially for electric vehicles it depends on many factors like driving style and usage of electric consumers. + +## Full Example + +The example is based on a BMW i3 with range extender (REX). +Exchange configuration parameters in the Things section + +* 4711 - any id you want +* YOUR_USERNAME - with your MyBMW login username +* YOUR_PASSWORD - with your MyBMW password credentials +* VEHICLE_VIN - the vehicle identification number + +In addition search for all occurrences of *i3* and replace it with your Vehicle Identification like *x3* or *535d* and you're ready to go! + +### Things File + +``` +Bridge mybmw:account:4711 "MyBMW Account" [userName="YOUR_USERNAME",password="YOUR_PASSWORD",region="ROW"] { + Thing bev_rex i3 "BMW i3 94h REX" [ vin="VEHICLE_VIN",refreshInterval=5,vehicleBrand="BMW"] +} +``` + +### Items File + +``` +Number:Length i3Mileage "Odometer [%d %unit%]" (i3) {channel="mybmw:bev_rex:4711:i3:range#mileage" } +Number:Length i3Range "Range [%d %unit%]" (i3) {channel="mybmw:bev_rex:4711:i3:range#hybrid"} +Number:Length i3RangeElectric "Electric Range [%d %unit%]" (i3,long) {channel="mybmw:bev_rex:4711:i3:range#electric"} +Number:Length i3RangeFuel "Fuel Range [%d %unit%]" (i3) {channel="mybmw:bev_rex:4711:i3:range#fuel"} +Number:Dimensionless i3BatterySoc "Battery Charge [%.1f %%]" (i3,long) {channel="mybmw:bev_rex:4711:i3:range#soc"} +Number:Volume i3Fuel "Fuel [%.1f %unit%]" (i3) {channel="mybmw:bev_rex:4711:i3:range#remaining-fuel"} +Number:Length i3RadiusElectric "Electric Radius [%d %unit%]" (i3) {channel="mybmw:bev_rex:4711:i3:range#radius-electric" } +Number:Length i3RadiusFuel "Fuel Radius [%d %unit%]" (i3) {channel="mybmw:bev_rex:4711:i3:range#radius-fuel" } +Number:Length i3RadiusHybrid "Hybrid Radius [%d %unit%]" (i3) {channel="mybmw:bev_rex:4711:i3:range#radius-hybrid" } + +String i3DoorStatus "Door Status [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:status#doors" } +String i3WindowStatus "Window Status [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:status#windows" } +String i3LockStatus "Lock Status [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:status#lock" } +DateTime i3NextServiceDate "Next Service Date [%1$tb %1$tY]" (i3) {channel="mybmw:bev_rex:4711:i3:status#service-date" } +String i3NextServiceMileage "Next Service Mileage [%d %unit%]" (i3) {channel="mybmw:bev_rex:4711:i3:status#service-mileage" } +String i3CheckControl "Check Control [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:status#check-control" } +String i3PlugConnection "Plug [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:status#plug-connection" } +String i3ChargingStatus "[%s]" (i3) {channel="mybmw:bev_rex:4711:i3:status#charge" } +String i3ChargingInfo "[%s]" (i3) {channel="mybmw:bev_rex:4711:i3:status#charge-info" } +DateTime i3LastUpdate "Update [%1$tA, %1$td.%1$tm. %1$tH:%1$tM]" (i3) {channel="mybmw:bev_rex:4711:i3:status#last-update"} + +Location i3Location "Location [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:location#gps" } +Number:Angle i3Heading "Heading [%.1f %unit%]" (i3) {channel="mybmw:bev_rex:4711:i3:location#heading" } + +String i3RemoteCommand "Command [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:remote#command" } +String i3RemoteState "Remote Execution State [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:remote#state" } + +String i3DriverDoor "Driver Door [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:doors#driver-front" } +String i3DriverDoorRear "Driver Door Rear [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:doors#driver-rear" } +String i3PassengerDoor "Passenger Door [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:doors#passenger-front" } +String i3PassengerDoorRear "Passenger Door Rear [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:doors#passenger-rear" } +String i3Hood "Hood [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:doors#hood" } +String i3Trunk "Trunk [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:doors#trunk" } +String i3DriverWindow "Driver Window [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:doors#win-driver-front" } +String i3DriverWindowRear "Driver Window Rear [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:doors#win-driver-rear" } +String i3PassengerWindow "Passenger Window [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:doors#win-passenger-front" } +String i3PassengerWindowRear "Passenger Window Rear [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:doors#win-passenger-rear" } +String i3RearWindow "Rear Window [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:doors#win-rear" } +String i3Sunroof "Sunroof [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:doors#sunroof" } + +String i3ServiceName "Service Name [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:service#name" } +String i3ServiceDetails "Service Details [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:service#details" } +Number:Length i3ServiceMileage "Service Mileage [%d %unit%]" (i3) {channel="mybmw:bev_rex:4711:i3:service#mileage" } +DateTime i3ServiceDate "Service Date [%1$tb %1$tY]" (i3) {channel="mybmw:bev_rex:4711:i3:service#date" } + +String i3CCName "CheckControl Name [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:check#name" } +String i3CCDetails "CheckControl Details [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:check#details" } +String i3CCSeverity "CheckControl Severity [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:check#severity" } + +Switch i3ChargeProfileClimate "Charge Profile Climatization" (i3) {channel="mybmw:bev_rex:4711:i3:profile#climate" } +String i3ChargeProfileMode "Charge Profile Mode [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:profile#mode" } +String i3ChargeProfilePrefs "Charge Profile Preference [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:profile#prefs" } +String i3ChargeProfileCtrl "Charge Profile Control [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:profile#control" } +Number i3ChargeProfileTarget "Charge Profile SoC Target [%s]" (i3) {channel="mybmw:bev_rex:4711:i3:profile#target" } +Switch i3ChargeProfileLimit "Charge Profile limited" (i3) {channel="mybmw:bev_rex:4711:i3:profile#limit" } +DateTime i3ChargeWindowStart "Charge Window Start [%1$tH:%1$tM]"