Skip to content

Commit

Permalink
fix(home assistant discovery): Set correct device class for 'rate_per…
Browse files Browse the repository at this point in the history
…_time_unit' (#182)
  • Loading branch information
Slider0007 authored Oct 20, 2024
1 parent cdf84c1 commit 1f68acb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion code/components/mqtt_ctrl/server_mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ bool mqttServer_publishHADiscovery(int _qos)
.friendlyName = "Rate",
.icon = "swap-vertical",
.unit = rateUnit,
.deviceClass = meterType == "energy" ? "power" : "volume_flow_rate",
.stateClass = "measurement"
};
publishOK &= publishHADiscoveryTopic(&HADiscoveryData, _qos);
Expand All @@ -578,7 +579,8 @@ bool mqttServer_publishHADiscovery(int _qos)
.friendlyName = "Rate / Interval",
.icon = "arrow-expand-vertical",
.unit = valueUnit != "" ? valueUnit + "/" + to_stringWithPrecision(processingInterval, 1) + "min" : "",
.stateClass = "measurement"
.stateClass = "measurement",
.entityCategory = "diagnostic"
};
publishOK &= publishHADiscoveryTopic(&HADiscoveryData, _qos);

Expand Down

0 comments on commit 1f68acb

Please sign in to comment.