update device info in hass to display rpi-mqtt-monitor version and repo link

This commit is contained in:
Hristo
2024-01-28 16:07:58 +02:00
committed by Masoko
parent 9ceb42a101
commit 59eec6465f
2 changed files with 18 additions and 12 deletions

View File

@@ -1,5 +1,7 @@
from random import randrange from random import randrange
# Script version
version = 0.6.1
# MQTT server configuration # MQTT server configuration
mqtt_host = "ip address or host" mqtt_host = "ip address or host"
mqtt_user = "username" mqtt_user = "username"

View File

@@ -185,6 +185,9 @@ def get_network_ip():
return IP return IP
def print_values(): def print_values():
print(":: rpi-mqtt-monitor")
print(" Version: " + config.version)
print("")
print(":: Device Information") print(":: Device Information")
print(" Model Name: " + check_model_name().strip()) print(" Model Name: " + check_model_name().strip())
print(" Manufacturer: " + get_manufacturer().strip()) print(" Manufacturer: " + get_manufacturer().strip())
@@ -195,17 +198,17 @@ def print_values():
print(" Service Sleep Time: " + str(config.service_sleep_time)) print(" Service Sleep Time: " + str(config.service_sleep_time))
print("") print("")
print(":: Measured values") print(":: Measured values")
print(" CPU Load: " + str(cpu_load)) print(" CPU Load: " + str(cpu_load) + " %")
print(" CPU Temp: " + str(cpu_temp)) print(" CPU Temp: " + str(cpu_temp) + " °C")
print(" Used Space: " + str(used_space)) print(" Used Space: " + str(used_space) + " %")
print(" Voltage: " + str(voltage)) print(" Voltage: " + str(voltage) + " V")
print(" CPU Clock Speed: " + str(sys_clock_speed)) print(" CPU Clock Speed: " + str(sys_clock_speed) + " MHz")
print(" Swap: " + str(swap)) print(" Swap: " + str(swap) + " %")
print(" Memory: " + str(memory)) print(" Memory: " + str(memory) + " %")
print(" Uptime: " + str(uptime_days)) print(" Uptime: " + str(uptime_days) + " days")
print(" Wifi Signal: " + str(wifi_signal)) print(" Wifi Signal: " + str(wifi_signal) + " %")
print(" Wifi Signal dBm: " + str(wifi_signal_dbm)) print(" Wifi Signal dBm: " + str(wifi_signal_dbm) + " dBm")
print(" RPI5 Fan Speed: " + str(rpi5_fan_speed)) print(" RPI5 Fan Speed: " + str(rpi5_fan_speed) + " RPM")
print(" Update Available: " + str(git_update)) print(" Update Available: " + str(git_update))
print("") print("")
@@ -224,7 +227,8 @@ def config_json(what_config):
"manufacturer": manufacturer, "manufacturer": manufacturer,
"model": model_name, "model": model_name,
"name": hostname, "name": hostname,
"sw_version": os "sw_version": "rpi-mqtt-monitor " + config.version + " on " + os,
"configuration_url": "https://github.com/hjelev/rpi-mqtt-monitor"
} }
} }