Skip to content

Commit

Permalink
Fix missing string translation and add battery level to device tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
mikey0000 committed Aug 16, 2024
1 parent fb8b1f9 commit d2f6012
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions custom_components/mammotion/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
from typing import Any

from cryptography.utils import cached_property
from homeassistant.components.device_tracker import SourceType, TrackerEntity
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -57,6 +58,11 @@ def longitude(self) -> float | None:
"""Return longitude value of the device."""
return self.coordinator.device.luba_msg.location.device.longitude

@property
def battery_level(self) -> int | None:
"""Return the battery level of the device."""
return self.coordinator.data.report_data.dev.battery_val

@property
def source_type(self) -> SourceType:
"""Return the source type, e.g., GPS or router, of the device."""
Expand Down
4 changes: 4 additions & 0 deletions custom_components/mammotion/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
"button": {
"start_map_sync": {
"name": "Sync maps"
},
"resync_rtk_dock": {
"name": "Sync RTK and dock",
"description": "Syncs RTK and dock location for when you move them."
}
},
"switch": {
Expand Down

0 comments on commit d2f6012

Please sign in to comment.