renenulschde / ha-mysmartbike Goto Github PK
View Code? Open in Web Editor NEWCustom Component to integrate MySmartBike (Mahle) data into Home Assistant
License: MIT License
Custom Component to integrate MySmartBike (Mahle) data into Home Assistant
License: MIT License
No sensor entities are created.
Smartphone App is connected with bike.
Bike: ORBEA Gain 170 EU
Home assistant core: 2024.4.4
Debug log:
2024-04-27 19:58:35.903 DEBUG (MainThread) [custom_components.mysmartbike] Start async_unload_entry
2024-04-27 19:58:35.905 DEBUG (MainThread) [custom_components.mysmartbike.webapi] login: Start
2024-04-27 19:58:35.905 DEBUG (MainThread) [custom_components.mysmartbike.webapi] login: Token not expired
2024-04-27 19:58:35.905 DEBUG (MainThread) [custom_components.mysmartbike.coordinator] Start save_token
2024-04-27 19:58:35.906 DEBUG (MainThread) [custom_components.mysmartbike.coordinator] _async_update_data: started
2024-04-27 19:58:36.218 INFO (MainThread) [custom_components.mysmartbike.coordinator] MySmartBike Cloud delivered 0 device(s).
2024-04-27 19:58:36.218 DEBUG (MainThread) [custom_components.mysmartbike.coordinator] {}
2024-04-27 19:58:36.218 DEBUG (MainThread) [custom_components.mysmartbike.coordinator] Finished fetching mysmartbike data in 0.312 seconds (success: True)
2024-04-27 19:58:36.219 DEBUG (MainThread) [custom_components.mysmartbike.sensor] async_setup_entry: Sensor count for creation - 0
2024-04-27 19:58:36.220 DEBUG (MainThread) [custom_components.mysmartbike.device_tracker] async_setup_entry: DeviceTracker count for creation - 0
HA Version: 2024.5.3
I checked the API response. The data does not include location information.
// 20240515153212
// https://my-smartbike.com/api/v1/objects/me?limit=5
{
"status": 200,
"code": "OK",
"success": true,
"data": [
{
"id": 189,
"alias": "ORBEA Gain 170 EU",
"serial": "OB",
"object_status": "SOLD",
"diagnosis_status": "ACTIVE",
"manufacture_date": "2023-07-06 18:41:56",
"activation_date": "2024-04-18 10:19:15",
"mac_address": "D2:4D:C9:46:3B:8E",
"odometry": 400000,
"diagnosed": true,
"diagnosed_at": "2024-05-15 13:16:47",
...
Debug log:
2024-05-15 15:04:58.134 DEBUG (MainThread) [custom_components.mysmartbike.webapi] login: Start
2024-05-15 15:04:58.134 DEBUG (MainThread) [custom_components.mysmartbike.webapi] login: Token not expired
2024-05-15 15:04:58.134 DEBUG (MainThread) [custom_components.mysmartbike.coordinator] Start save_token
2024-05-15 15:04:58.135 DEBUG (MainThread) [custom_components.mysmartbike.coordinator] _async_update_data: started
2024-05-15 15:04:58.422 ERROR (MainThread) [custom_components.mysmartbike.coordinator] Unexpected error fetching mysmartbike data
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/mysmartbike/coordinator.py", line 71, in _async_update_data
devices = await self.webapi.get_device_list()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/mysmartbike/webapi.py", line 95, in get_device_list
return await self._build_device_list(_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/mysmartbike/webapi.py", line 173, in _build_device_list
datetime.strptime(rbike.get("last_position_date"), "%Y-%m-%d %H:%M:%S"),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: strptime() argument 1 must be str, not None
2024-05-15 15:04:58.474 DEBUG (MainThread) [custom_components.mysmartbike.coordinator] Finished fetching mysmartbike data in 0.340 seconds (success: False)
Thanks,
Christof
Hi,
Thanks for this integration.
Installed the mysmartbike app on my android phone and connected my foldable E-bike (Legend Siena)
That's all working fine.
After installation to HA, I only see 2 entities:
The "State of charge (Percent, 0-100)" is not visible as an entity
Is there something I need to change in the app or HA to get this visible?
HA is on the latest May 2024.5 release
"integration_manifest": {
"domain": "mysmartbike",
"name": "MySmartBike",
"codeowners": [
"@ReneNulschDE"
],
"config_flow": true,
"dependencies": [],
"documentation": "https://github.com/ReneNulschDE/ha-mysmartbike",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/ReneNulschDE/ha-mysmartbike/issues",
"requirements": [],
"version": "v0.2.0",
"is_built_in": false
},
"data": {
"config_entry_data": {
"username": "REDACTED",
"password": "REDACTED"
},
"coordinator_data": {
"LE0000XXXXXXXXXX": {
"serial": "LE0000XXXXXXXXXX",
"odometry": 26400,
"manufacturer_name": "Legend",
"model_name": "Siena Trio",
"longitude": -0.000000,
"latitude": 00.00000,
"last_position_date": "2024-05-04T13:20:18",
"state_of_charge": null,
"remaining_capacity": null
note: serial, long & lat have been modified
Thanks for checking.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.