Skip to content

Commit

Permalink
Now passing zone setpoint ranges to HA on startup (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
climategadgets committed Oct 4, 2023
1 parent b8e21f1 commit f297a13
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ private Flux<ZoneTuple> announce(Map.Entry<Flux<Signal<Double, Void>>, Zone> sou
zone.getAddress(),
// VT: FIXME: propagate the right values here
new String[] {"off", "cool"},
// VT: FIXME: propagate
20, 33,
zone.getSetpointRange().min,
zone.getSetpointRange().max,
uniqueId,
new DeviceDiscoveryPacket(
uniqueId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public class ZoneDiscoveryPacket {
public final String temperatureUnit = "C";
public final String currentTemperatureTopic = "~/state";
public final String currentTemperatureTemplate = "{{value_json.current_temperature}}";
public final int minTemp;
public final int maxTemp;
public final double minTemp;
public final double maxTemp;
public final double tempStep = 0.1;

public final String uniqueId;

public final DeviceDiscoveryPacket device;

public ZoneDiscoveryPacket(String rootTopic, String name, String[] modes, int minTemp, int maxTemp, String uniqueId, DeviceDiscoveryPacket device) {
public ZoneDiscoveryPacket(String rootTopic, String name, String[] modes, double minTemp, double maxTemp, String uniqueId, DeviceDiscoveryPacket device) {
this.rootTopic = rootTopic;
this.name = name;
this.modes = modes;
Expand Down
4 changes: 2 additions & 2 deletions dz3r-model/src/main/java/net/sf/dz3r/model/Thermostat.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
*
* @see net.sf.dz3r.device.model.Thermostat
*
* @author Copyright &copy; <a href="mailto:[email protected]">Vadim Tkachenko</a> 2001-2021
* @author Copyright &copy; <a href="mailto:[email protected]">Vadim Tkachenko</a> 2001-2023
*/
public class Thermostat implements ProcessController<Double, CallingStatus, Void>, Addressable<String> {

private final Logger logger = LogManager.getLogger();

private final String name;
private final Range<Double> setpointRange;
public final Range<Double> setpointRange;

/**
* Thermostat setpoint.
Expand Down
6 changes: 5 additions & 1 deletion dz3r-model/src/main/java/net/sf/dz3r/model/Zone.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ public JmxDescriptor getJmxDescriptor() {

@Override
public String toString() {
return "{zone name=" + ts.getAddress() + ", settings={" + settings + "}}";
return "{zone name=" + ts.getAddress() + ", settings={" + settings + "}, range={" + ts.setpointRange + "}}";
}

public Range<Double> getSetpointRange() {
return ts.setpointRange;
}

@Override
Expand Down

0 comments on commit f297a13

Please sign in to comment.