Expose hostname in settings manager
I've added a `hostname` property to the settings manager.
This commit is contained in:
parent
6e18a91d1f
commit
36a7ec3d2e
1 changed files with 6 additions and 1 deletions
|
|
@ -102,6 +102,11 @@ class SettingsManager(Thing):
|
|||
self.thing_settings["microscope_id"] = str(uuid4())
|
||||
return UUID(self.thing_settings["microscope_id"])
|
||||
|
||||
@thing_property
|
||||
def hostname(self) -> str:
|
||||
"""The hostname of the microscope, as reported by its operating system."""
|
||||
return gethostname()
|
||||
|
||||
@thing_action
|
||||
def get_things_state(self, metadata_getter: GetThingStates) -> Mapping:
|
||||
"""Metadata summarising the current state of all Things in the server"""
|
||||
|
|
@ -119,7 +124,7 @@ class SettingsManager(Thing):
|
|||
@property
|
||||
def thing_state(self) -> Mapping:
|
||||
state = {
|
||||
"hostname": gethostname(),
|
||||
"hostname": self.hostname,
|
||||
"microscope-uuid": str(self.microscope_id),
|
||||
}
|
||||
metadata = self.external_metadata
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue