Expose pi_heating_demand to Home Assistant (#9759)

* homeassistant: expose pi_heating_demand on climate

This allows homeassistant to access the actual percentage actuation currently used on thermostats.

* Update homeassistant.ts

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
This commit is contained in:
Filip Sandborg
2021-11-20 13:59:04 +01:00
committed by GitHub
parent 0f3315063f
commit c793cc83ad
+17
View File
@@ -288,6 +288,23 @@ export default class HomeAssistant extends Extension {
discoveryEntries.push(discoveryEntry);
}
const piHeatingDemand = firstExpose.features.find((f) => f.name === 'pi_heating_demand');
if (piHeatingDemand) {
const discoveryEntry = {
type: 'sensor',
object_id: endpoint ? `${piHeatingDemand.name}_${endpoint}` : `${piHeatingDemand.name}`,
mockProperties: [piHeatingDemand.property],
discovery_payload: {
value_template: `{{ value_json.${piHeatingDemand.property} }}`,
...(piHeatingDemand.unit && {unit_of_measurement: piHeatingDemand.unit}),
entity_category: 'diagnostic',
icon: 'mdi:radiator',
},
};
discoveryEntries.push(discoveryEntry);
}
discoveryEntries.push(discoveryEntry);
} else if (firstExpose.type === 'lock') {
assert(!endpoint, `Endpoint not supported for lock type`);