diff --git a/__init__.py b/__init__.py index b27913f..df1ef30 100644 --- a/__init__.py +++ b/__init__.py @@ -30,7 +30,7 @@ from mycroft.util.parse import normalize from mycroft import MycroftSkill, intent_handler -from .skill.device_id import get_mycroft_uuid, get_pantacor_device_id +from .skill.device_id import get_device_name, get_mycroft_uuid, get_pantacor_device_id from .skill.versions import ( get_mycroft_build_datetime, get_mycroft_core_commit, @@ -702,6 +702,7 @@ def show_device_settings_about(self, _): self.gui["mycroftContainerBuildDate"] = get_mycroft_build_datetime() skills_repo_path = f"{self.config_core['data_dir']}/.skills-repo" self.gui["mycroftSkillsUpdateDate"] = get_skill_update_datetime(skills_repo_path) + self.gui["deviceName"] = get_device_name() self.gui["mycroftUUID"] = get_mycroft_uuid() self.gui["pantacorDeviceId"] = get_pantacor_device_id() self.gui["state"] = "settings/about" diff --git a/skill/device_id.py b/skill/device_id.py index da66987..229a1bb 100644 --- a/skill/device_id.py +++ b/skill/device_id.py @@ -12,10 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -from mycroft.api import _get_pantacor_device_id +from mycroft.api import DeviceApi, _get_pantacor_device_id from mycroft.identity import IdentityManager +from mycroft.util import LOG +def get_device_name(): + try: + return DeviceApi().get()["name"] + except Exception as err: + LOG.exception("API Error", err) + return ":error:" + def get_mycroft_uuid(): """Get the UUID of a Mycroft device paired with the Mycroft backend.""" identity = IdentityManager.get() diff --git a/ui/settings/about.qml b/ui/settings/about.qml index 558dd32..c2a2ec0 100644 --- a/ui/settings/about.qml +++ b/ui/settings/about.qml @@ -155,6 +155,12 @@ Item { Layout.preferredHeight: Kirigami.Units.smallSpacing } + Label { + id: deviceNameLabel + Layout.alignment: Qt.AlignHCenter + text: "Device Name: " + sessionData.deviceName + } + Label { id: mycroftUUIDLabel Layout.alignment: Qt.AlignHCenter