fix direct hass api integration (#211)
This commit is contained in:
@@ -590,9 +590,12 @@ def config_json(what_config, device="0", hass_api=False):
|
|||||||
elif what_config == "rpi_power_status":
|
elif what_config == "rpi_power_status":
|
||||||
data["icon"] = "mdi:flash"
|
data["icon"] = "mdi:flash"
|
||||||
data["name"] = get_translation("rpi_power_status")
|
data["name"] = get_translation("rpi_power_status")
|
||||||
|
data["state_class"] = "none"
|
||||||
elif what_config == "apt_updates":
|
elif what_config == "apt_updates":
|
||||||
data["icon"] = "mdi:update"
|
data["icon"] = "mdi:update"
|
||||||
data["name"] = get_translation("apt_updates")
|
data["name"] = get_translation("apt_updates")
|
||||||
|
data["unit_of_measurement"] = "updates"
|
||||||
|
data["state_class"] = "measurement"
|
||||||
elif what_config == "ds18b20_status":
|
elif what_config == "ds18b20_status":
|
||||||
data["icon"] = "hass:thermometer"
|
data["icon"] = "hass:thermometer"
|
||||||
data["name"] = device + " " + get_translation("temperature")
|
data["name"] = device + " " + get_translation("temperature")
|
||||||
@@ -637,8 +640,9 @@ def config_json(what_config, device="0", hass_api=False):
|
|||||||
result = {
|
result = {
|
||||||
"name": data["name"],
|
"name": data["name"],
|
||||||
"icon": data["icon"],
|
"icon": data["icon"],
|
||||||
"state_class": data["state_class"],
|
|
||||||
}
|
}
|
||||||
|
if "state_class" in data:
|
||||||
|
result["state_class"] = data["state_class"]
|
||||||
if "unit_of_measurement" in data:
|
if "unit_of_measurement" in data:
|
||||||
result["unit_of_measurement"] = data["unit_of_measurement"]
|
result["unit_of_measurement"] = data["unit_of_measurement"]
|
||||||
if "device_class" in data:
|
if "device_class" in data:
|
||||||
|
|||||||
Reference in New Issue
Block a user