Skip to content

Commit

Permalink
Add user defined device name to device id's
Browse files Browse the repository at this point in the history
  • Loading branch information
krisgesling committed Nov 24, 2021
1 parent ffaa940 commit b3833c0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
Expand Down
10 changes: 9 additions & 1 deletion skill/device_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions ui/settings/about.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b3833c0

Please sign in to comment.