mirror of
https://github.com/tcivie/meshtastic-metrics-exporter.git
synced 2024-12-27 14:39:57 -08:00
Fixed bug with the names of the devices not being decoded
This commit is contained in:
parent
2a9b47b4b3
commit
aebb5a0456
2
.env
2
.env
|
@ -27,4 +27,4 @@ MESH_HIDE_DESTINATION_DATA=false
|
|||
## Filtered ports in the exporter (default: 1, can be a comma-separated list of ports)
|
||||
FILTERED_PORTS=0
|
||||
## Hide message content in the TEXT_MESSAGE_APP packets (default: true) (Currently we only log message length, if we hide then all messages would have the same length)
|
||||
HIDE_MESSAGE=true
|
||||
HIDE_MESSAGE=false
|
|
@ -361,15 +361,17 @@ class ClientDetails:
|
|||
self.role: Config.DeviceConfig.Role = role
|
||||
|
||||
def get_role_name_from_role(self):
|
||||
for name, value in Config.DeviceConfig.Role.__dict__.items():
|
||||
if isinstance(value, int) and value == self.role:
|
||||
return name
|
||||
descriptor = Config.DeviceConfig.Role.DESCRIPTOR
|
||||
for enum_value in descriptor.values:
|
||||
if enum_value.number == self.role:
|
||||
return enum_value.name
|
||||
return 'UNKNOWN_ROLE'
|
||||
|
||||
def get_hardware_model_name_from_code(self):
|
||||
for name, value in HardwareModel.__dict__.items():
|
||||
if isinstance(value, int) and value == self.hardware_model:
|
||||
return name
|
||||
descriptor = HardwareModel.DESCRIPTOR
|
||||
for enum_value in descriptor.values:
|
||||
if enum_value.number == self.hardware_model:
|
||||
return enum_value.name
|
||||
return 'UNKNOWN_HARDWARE_MODEL'
|
||||
|
||||
def to_dict(self):
|
||||
|
|
Loading…
Reference in a new issue