Skip to content

Commit

Permalink
add mac address to machine_data
Browse files Browse the repository at this point in the history
  • Loading branch information
jneilliii committed May 3, 2023
1 parent d6dfecd commit 8af3e17
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion octoprint_simplyprint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def get_update_information(self):
__plugin_name__ = "SimplyPrint Cloud"
__plugin_pythoncompat__ = ">=3.7,<4"
# Remember to bump the version in setup.py as well
__plugin_version__ = "4.1.0rc1"
__plugin_version__ = "4.1.0rc2"


def __plugin_load__():
Expand Down
7 changes: 7 additions & 0 deletions octoprint_simplyprint/websocket/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def get_system_info(self) -> Dict[str, Any]:
info["core_count"] = os.cpu_count()
info["total_memory"] = psutil.virtual_memory().total
info.update(self.get_network_info())
info["mac"] = self.get_mac_address()

port = self._get_public_port()

Expand All @@ -69,6 +70,12 @@ def get_system_info(self) -> Dict[str, Any]:
def _get_python_version(self) -> str:
return ".".join(str(part) for part in sys.version_info[:3])

def get_mac_address():
mac_int = uuid.getnode()
mac_hex = "{:012x}".format(mac_int)
mac_address = ":".join(mac_hex[i:i + 2] for i in range(0, 12, 2)).upper()
return mac_address

def _get_routed_ip(self) -> Optional[str]:
src_ip = None
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
# Remember to bump the version in octoprint_simplyprint/__init__.py as well
plugin_version = "4.1.0rc1"
plugin_version = "4.1.0rc2"

# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
Expand Down

0 comments on commit 8af3e17

Please sign in to comment.