Skip to content

Commit

Permalink
added manufacturer + model to device name
Browse files Browse the repository at this point in the history
  • Loading branch information
dudanov committed Jul 16, 2024
1 parent f336e28 commit 8c814cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions custom_components/ftms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ def _on_disconnect(ftms_: pyftms.FitnessMachine) -> None:
assert ftms.machine_type.name

unique_id = ftms.device_info.get("serial_number", ftms.address).lower()
name = f"{ftms.device_info.get("manufacturer", "FTMS")} {ftms.device_info.get("model", "Generic")}"

device_info = dr.DeviceInfo(
connections={(dr.CONNECTION_BLUETOOTH, ftms.address)},
identifiers={(DOMAIN, unique_id)},
translation_key=ftms.machine_type.name.lower(),
translation_placeholders={"name": name},
**ftms.device_info,
)

Expand Down
8 changes: 4 additions & 4 deletions custom_components/ftms/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,16 @@
},
"device": {
"treadmill": {
"name": "Treadmill"
"name": "Treadmill {name}"
},
"cross_trainer": {
"name": "Cross trainer"
"name": "Cross trainer {name}"
},
"rower": {
"name": "Rower"
"name": "Rower {name}"
},
"indoor_bike": {
"name": "Indoor bike"
"name": "Indoor bike {name}"
}
}
}
8 changes: 4 additions & 4 deletions custom_components/ftms/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,16 @@
},
"device": {
"treadmill": {
"name": "Беговая дорожка"
"name": "Беговая дорожка {name}"
},
"cross_trainer": {
"name": "Эллиптический тренажер"
"name": "Эллиптический тренажер {name}"
},
"rower": {
"name": "Гребной тренажер"
"name": "Гребной тренажер {name}"
},
"indoor_bike": {
"name": "Велотренажер"
"name": "Велотренажер {name}"
}
}
}

0 comments on commit 8c814cc

Please sign in to comment.