Skip to content

Commit

Permalink
Now returning correct HVAC device type in metadata request
Browse files Browse the repository at this point in the history
  • Loading branch information
climategadgets committed Aug 22, 2024
1 parent b2f5a06 commit 53e50ef
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,16 @@ private Flux<HvacDeviceMeta> renderHvacMeta(HvacDeviceConfig source) {

private HvacDeviceMeta renderHvacDeviceMeta(GenericHvacDeviceConfig source) {

var type = switch (source.getClass().getSimpleName()) {
case "HeatpumpConfig", "HeatpumpHATConfig" -> HvacDeviceMeta.Type.HEAT_PUMP;
case "SwitchableHvacDeviceConfig" -> HvacDeviceMeta.Type.SWITCHABLE;
case "VariableHvacConfig" -> HvacDeviceMeta.Type.VARIABLE;
default -> throw new IllegalArgumentException("Unrecognized HVAC device type: " + source.getClass().getSimpleName());
};

return new HvacDeviceMeta(
source.id(),
HvacDeviceMeta.Type.SWITCHABLE,
type,
source.filter() != null
);
}
Expand Down

0 comments on commit 53e50ef

Please sign in to comment.