├── lib └── gson-2.7.jar ├── target ├── org.openhab.binding.draytonwiser-2.2.0-SNAPSHOT.jar ├── classes │ └── org │ │ └── openhab │ │ └── binding │ │ └── draytonwiser │ │ ├── internal │ │ ├── config │ │ │ ├── Cloud.class │ │ │ ├── Device.class │ │ │ ├── Friday.class │ │ │ ├── Monday.class │ │ │ ├── Room.class │ │ │ ├── Sunday.class │ │ │ ├── System.class │ │ │ ├── HeatHub.class │ │ │ ├── RoomStat.class │ │ │ ├── Saturday.class │ │ │ ├── Schedule.class │ │ │ ├── SetPoint.class │ │ │ ├── Thursday.class │ │ │ ├── Tuesday.class │ │ │ ├── SetPoint_.class │ │ │ ├── SetPoint__.class │ │ │ ├── SetPoint___.class │ │ │ ├── UpgradeInfo.class │ │ │ ├── Wednesday.class │ │ │ ├── SetPoint____.class │ │ │ ├── SetPoint_____.class │ │ │ ├── BoilerSettings.class │ │ │ ├── HeatingChannel.class │ │ │ ├── LocalDateAndTime.class │ │ │ └── SetPoint______.class │ │ ├── DraytonWiserHandlerFactory.class │ │ └── connection │ │ │ └── DraytonWiserConnection.class │ │ ├── handler │ │ ├── DraytonWiserHandler.class │ │ └── DraytonWiserBridgeHandler.class │ │ └── DraytonWiserBindingConstants.class ├── maven-archiver │ └── pom.properties ├── local-artifacts.properties ├── p2artifacts.xml ├── MANIFEST.MF ├── p2content.xml └── maven-status │ └── maven-compiler-plugin │ └── compile │ └── default │ └── inputFiles.lst ├── src └── main │ └── java │ └── org │ └── openhab │ └── binding │ └── draytonwiser │ ├── internal │ ├── config │ │ ├── Monday.java │ │ ├── Friday.java │ │ ├── Tuesday.java │ │ ├── Saturday.java │ │ ├── Sunday.java │ │ ├── Thursday.java │ │ ├── Wednesday.java │ │ ├── SetPoint.java │ │ ├── SetPoint_.java │ │ ├── SetPoint__.java │ │ ├── SetPoint___.java │ │ ├── SetPoint____.java │ │ ├── SetPoint_____.java │ │ ├── SetPoint______.java │ │ ├── UpgradeInfo.java │ │ ├── BoilerSettings.java │ │ ├── RoomStat.java │ │ ├── LocalDateAndTime.java │ │ ├── SmartValve.java │ │ ├── Cloud.java │ │ ├── HeatingChannel.java │ │ ├── PublishRequests.java │ │ ├── Example.java │ │ ├── Schedule.java │ │ ├── Room.java │ │ ├── System.java │ │ ├── Device.java │ │ └── HeatHub.java │ ├── DraytonWiserHandlerFactory.java │ └── connection │ │ └── DraytonWiserConnection.java │ ├── handler │ ├── DraytonWiserBridgeHandler.java │ └── DraytonWiserHandler.java │ └── DraytonWiserBindingConstants.java ├── OSGI-INF └── org.openhab.binding.draytonwiser.internal.DraytonWiserHandlerFactory.xml ├── ESH-INF ├── binding │ └── binding.xml ├── i18n │ └── draytonwiser_xx_XX.properties └── thing │ └── thing-types.xml ├── pom.xml ├── LICENSE ├── META-INF └── MANIFEST.MF ├── about.html └── README.md /lib/gson-2.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/lib/gson-2.7.jar -------------------------------------------------------------------------------- /target/org.openhab.binding.draytonwiser-2.2.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/org.openhab.binding.draytonwiser-2.2.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/Cloud.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/Cloud.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/Device.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/Device.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/Friday.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/Friday.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/Monday.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/Monday.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/Room.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/Room.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/Sunday.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/Sunday.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/System.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/System.class -------------------------------------------------------------------------------- /target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Thu Nov 16 22:07:03 GMT 2017 3 | version=2.2.0-SNAPSHOT 4 | groupId=org.openhab.binding 5 | artifactId=org.openhab.binding.draytonwiser 6 | -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/HeatHub.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/HeatHub.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/RoomStat.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/RoomStat.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/Saturday.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/Saturday.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/Schedule.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/Schedule.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/Thursday.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/Thursday.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/Tuesday.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/Tuesday.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/handler/DraytonWiserHandler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/handler/DraytonWiserHandler.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint_.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint_.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint__.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint__.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint___.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint___.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/UpgradeInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/UpgradeInfo.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/Wednesday.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/Wednesday.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/DraytonWiserBindingConstants.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/DraytonWiserBindingConstants.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint____.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint____.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint_____.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint_____.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/BoilerSettings.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/BoilerSettings.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/HeatingChannel.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/HeatingChannel.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/LocalDateAndTime.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/LocalDateAndTime.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint______.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/config/SetPoint______.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/handler/DraytonWiserBridgeHandler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/handler/DraytonWiserBridgeHandler.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/DraytonWiserHandlerFactory.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/DraytonWiserHandlerFactory.class -------------------------------------------------------------------------------- /target/classes/org/openhab/binding/draytonwiser/internal/connection/DraytonWiserConnection.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobPope/DraytonWiser/HEAD/target/classes/org/openhab/binding/draytonwiser/internal/connection/DraytonWiserConnection.class -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/Monday.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import java.util.List; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Monday { 9 | 10 | @SerializedName("SetPoints") 11 | @Expose 12 | public List setPoints = null; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/Friday.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import java.util.List; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Friday { 9 | 10 | @SerializedName("SetPoints") 11 | @Expose 12 | public List setPoints = null; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/Tuesday.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import java.util.List; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Tuesday { 9 | 10 | @SerializedName("SetPoints") 11 | @Expose 12 | public List setPoints = null; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/Saturday.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import java.util.List; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Saturday { 9 | 10 | @SerializedName("SetPoints") 11 | @Expose 12 | public List setPoints = null; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/Sunday.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import java.util.List; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Sunday { 9 | 10 | @SerializedName("SetPoints") 11 | @Expose 12 | public List setPoints = null; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/Thursday.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import java.util.List; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Thursday { 9 | 10 | @SerializedName("SetPoints") 11 | @Expose 12 | public List setPoints = null; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/Wednesday.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import java.util.List; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Wednesday { 9 | 10 | @SerializedName("SetPoints") 11 | @Expose 12 | public List setPoints = null; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/SetPoint.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class SetPoint { 8 | 9 | @SerializedName("Time") 10 | @Expose 11 | public Integer time; 12 | @SerializedName("DegreesC") 13 | @Expose 14 | public Integer degreesC; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/SetPoint_.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class SetPoint_ { 8 | 9 | @SerializedName("Time") 10 | @Expose 11 | public Integer time; 12 | @SerializedName("DegreesC") 13 | @Expose 14 | public Integer degreesC; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/SetPoint__.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class SetPoint__ { 8 | 9 | @SerializedName("Time") 10 | @Expose 11 | public Integer time; 12 | @SerializedName("DegreesC") 13 | @Expose 14 | public Integer degreesC; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/SetPoint___.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class SetPoint___ { 8 | 9 | @SerializedName("Time") 10 | @Expose 11 | public Integer time; 12 | @SerializedName("DegreesC") 13 | @Expose 14 | public Integer degreesC; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/SetPoint____.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class SetPoint____ { 8 | 9 | @SerializedName("Time") 10 | @Expose 11 | public Integer time; 12 | @SerializedName("DegreesC") 13 | @Expose 14 | public Integer degreesC; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/SetPoint_____.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class SetPoint_____ { 8 | 9 | @SerializedName("Time") 10 | @Expose 11 | public Integer time; 12 | @SerializedName("DegreesC") 13 | @Expose 14 | public Integer degreesC; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/SetPoint______.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class SetPoint______ { 8 | 9 | @SerializedName("Time") 10 | @Expose 11 | public Integer time; 12 | @SerializedName("DegreesC") 13 | @Expose 14 | public Integer degreesC; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/UpgradeInfo.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class UpgradeInfo { 8 | 9 | @SerializedName("id") 10 | @Expose 11 | public Integer id; 12 | @SerializedName("FirmwareFilename") 13 | @Expose 14 | public String firmwareFilename; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /OSGI-INF/org.openhab.binding.draytonwiser.internal.DraytonWiserHandlerFactory.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/BoilerSettings.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class BoilerSettings { 8 | 9 | @SerializedName("ControlType") 10 | @Expose 11 | public String controlType; 12 | @SerializedName("FuelType") 13 | @Expose 14 | public String fuelType; 15 | @SerializedName("CycleRate") 16 | @Expose 17 | public String cycleRate; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /target/local-artifacts.properties: -------------------------------------------------------------------------------- 1 | #Thu Nov 16 22:07:03 GMT 2017 2 | artifact.attached.p2metadata=C\:\\Users\\poper\\openhab2-master\\git\\openhab2-addons\\addons\\binding\\org.openhab.binding.draytonwiser\\target\\p2content.xml 3 | artifact.main=C\:\\Users\\poper\\openhab2-master\\git\\openhab2-addons\\addons\\binding\\org.openhab.binding.draytonwiser\\target\\org.openhab.binding.draytonwiser-2.2.0-SNAPSHOT.jar 4 | artifact.attached.p2artifacts=C\:\\Users\\poper\\openhab2-master\\git\\openhab2-addons\\addons\\binding\\org.openhab.binding.draytonwiser\\target\\p2artifacts.xml 5 | -------------------------------------------------------------------------------- /ESH-INF/binding/binding.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | DraytonWiser Binding 8 | This is the binding for the Drayton Wiser smart thermostat. 9 | Rob Pope 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/RoomStat.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class RoomStat { 8 | 9 | @SerializedName("id") 10 | @Expose 11 | public Integer id; 12 | @SerializedName("SetPoint") 13 | @Expose 14 | public Integer setPoint; 15 | @SerializedName("MeasuredTemperature") 16 | @Expose 17 | public Integer measuredTemperature; 18 | @SerializedName("MeasuredHumidity") 19 | @Expose 20 | public Integer measuredHumidity; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /target/p2artifacts.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | org.openhab.binding 9 | pom 10 | 2.2.0-SNAPSHOT 11 | 12 | 13 | org.openhab.binding.draytonwiser 14 | 2.2.0-SNAPSHOT 15 | 16 | DraytonWiser Binding 17 | eclipse-plugin 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/LocalDateAndTime.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class LocalDateAndTime { 8 | 9 | @SerializedName("Year") 10 | @Expose 11 | public Integer year; 12 | @SerializedName("Month") 13 | @Expose 14 | public String month; 15 | @SerializedName("Date") 16 | @Expose 17 | public Integer date; 18 | @SerializedName("Day") 19 | @Expose 20 | public String day; 21 | @SerializedName("Time") 22 | @Expose 23 | public Integer time; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /ESH-INF/i18n/draytonwiser_xx_XX.properties: -------------------------------------------------------------------------------- 1 | # FIXME: please substitute the xx_XX with a proper locale, ie. de_DE 2 | # FIXME: please do not add the file to the repo if you add or change no content 3 | # binding 4 | binding.draytonwiser.name = 5 | binding.draytonwiser.description = 6 | 7 | # thing types 8 | thing-type.draytonwiser.sample.label = 9 | thing-type.draytonwiser.sample.description = 10 | 11 | # channel types 12 | channel-type.draytonwiser.sample-channel.label = 13 | channel-type.draytonwiser.sample-channel.description = -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/SmartValve.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class SmartValve { 8 | 9 | @SerializedName("id") 10 | @Expose 11 | public Integer id; 12 | @SerializedName("SetPoint") 13 | @Expose 14 | public Integer setPoint; 15 | @SerializedName("MeasuredTemperature") 16 | @Expose 17 | public Integer measuredTemperature; 18 | @SerializedName("PercentageDemand") 19 | @Expose 20 | public Integer percentageDemand; 21 | @SerializedName("WindowState") 22 | @Expose 23 | public String windowState; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/handler/DraytonWiserBridgeHandler.java: -------------------------------------------------------------------------------- 1 | package org.openhab.binding.draytonwiser.handler; 2 | 3 | import org.eclipse.smarthome.core.thing.Bridge; 4 | import org.eclipse.smarthome.core.thing.Thing; 5 | import org.eclipse.smarthome.core.thing.binding.BaseBridgeHandler; 6 | 7 | public abstract class DraytonWiserBridgeHandler extends BaseBridgeHandler { 8 | 9 | public DraytonWiserBridgeHandler(Bridge bridge) { 10 | super(bridge); 11 | } 12 | 13 | @Override 14 | public void initialize() { 15 | 16 | } 17 | 18 | @Override 19 | public void dispose() { 20 | 21 | } 22 | 23 | @Override 24 | public void thingUpdated(Thing thing) { 25 | super.thingUpdated(thing); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/Cloud.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import java.util.List; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Cloud { 9 | 10 | @SerializedName("Environment") 11 | @Expose 12 | public String environment; 13 | @SerializedName("WiserApiHost") 14 | @Expose 15 | public String wiserApiHost; 16 | @SerializedName("BootStrapApiHost") 17 | @Expose 18 | public String bootStrapApiHost; 19 | @SerializedName("PublishRequests") 20 | @Expose 21 | public PublishRequests publishRequests; 22 | @SerializedName("ScheduleIdsToPublish") 23 | @Expose 24 | public List scheduleIdsToPublish = null; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/HeatingChannel.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import java.util.List; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class HeatingChannel { 9 | 10 | @SerializedName("id") 11 | @Expose 12 | public Integer id; 13 | @SerializedName("Name") 14 | @Expose 15 | public String name; 16 | @SerializedName("RoomIds") 17 | @Expose 18 | public List roomIds = null; 19 | @SerializedName("PercentageDemand") 20 | @Expose 21 | public Integer percentageDemand; 22 | @SerializedName("DemandOnOffOutput") 23 | @Expose 24 | public String demandOnOffOutput; 25 | @SerializedName("HeatingRelayState") 26 | @Expose 27 | public String heatingRelayState; 28 | @SerializedName("IsSmartValvePreventingDemand") 29 | @Expose 30 | public Boolean isSmartValvePreventingDemand; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/PublishRequests.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class PublishRequests { 8 | 9 | @SerializedName("RoomTimeSeries") 10 | @Expose 11 | public Boolean roomTimeSeries; 12 | @SerializedName("EcoMode") 13 | @Expose 14 | public Boolean ecoMode; 15 | @SerializedName("BoilerOnOffEvent") 16 | @Expose 17 | public Boolean boilerOnOffEvent; 18 | @SerializedName("PercentageDemand") 19 | @Expose 20 | public Boolean percentageDemand; 21 | @SerializedName("ZigbeeDebug") 22 | @Expose 23 | public Boolean zigbeeDebug; 24 | @SerializedName("FotaProgress") 25 | @Expose 26 | public Boolean fotaProgress; 27 | @SerializedName("SupportPackage") 28 | @Expose 29 | public Boolean supportPackage; 30 | @SerializedName("PairingToken") 31 | @Expose 32 | public Boolean pairingToken; 33 | @SerializedName("Notification") 34 | @Expose 35 | public Boolean notification; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/Example.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import java.util.List; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Example { 9 | 10 | @SerializedName("System") 11 | @Expose 12 | public System system; 13 | @SerializedName("Cloud") 14 | @Expose 15 | public Cloud cloud; 16 | @SerializedName("HeatingChannel") 17 | @Expose 18 | public List heatingChannel = null; 19 | @SerializedName("Room") 20 | @Expose 21 | public List room = null; 22 | @SerializedName("Schedule") 23 | @Expose 24 | public List schedule = null; 25 | @SerializedName("Device") 26 | @Expose 27 | public List device = null; 28 | @SerializedName("UpgradeInfo") 29 | @Expose 30 | public List upgradeInfo = null; 31 | @SerializedName("SmartValve") 32 | @Expose 33 | public List smartValve = null; 34 | @SerializedName("RoomStat") 35 | @Expose 36 | public List roomStat = null; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /target/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-SymbolicName: org.openhab.binding.draytonwiser;singleton:=true 3 | Export-Package: org.openhab.binding.draytonwiser,org.openhab.binding.d 4 | raytonwiser.handler 5 | Bundle-Name: DraytonWiser Binding 6 | Bundle-Version: 2.2.0.201711162206 7 | Bundle-ClassPath: . 8 | Bundle-ManifestVersion: 2 9 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 10 | Bundle-Vendor: openHAB 11 | Import-Package: com.google.gson,com.google.gson.annotations,com.google 12 | .common.collect,org.apache.http,org.apache.http.client,org.apache.htt 13 | p.client.methods,org.apache.http.entity,org.apache.http.impl.client,o 14 | rg.apache.http.message,org.eclipse.jdt.annotation;resolution:=optiona 15 | l,org.eclipse.smarthome.config.core,org.eclipse.smarthome.core.librar 16 | y.types,org.eclipse.smarthome.core.thing,org.eclipse.smarthome.core.t 17 | hing.binding,org.eclipse.smarthome.core.thing.binding.builder,org.ecl 18 | ipse.smarthome.core.thing.type,org.eclipse.smarthome.core.types,org.o 19 | penhab.binding.draytonwiser,org.openhab.binding.draytonwiser.handler, 20 | org.osgi.service.component.annotations;resolution:=optional,org.slf4j 21 | Service-Component: OSGI-INF/*.xml 22 | 23 | -------------------------------------------------------------------------------- /META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ClassPath: . 3 | Bundle-ManifestVersion: 2 4 | Bundle-Name: DraytonWiser Binding 5 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 6 | Bundle-SymbolicName: org.openhab.binding.draytonwiser;singleton:=true 7 | Bundle-Vendor: openHAB 8 | Bundle-Version: 2.2.0.qualifier 9 | Export-Package: 10 | org.openhab.binding.draytonwiser, 11 | org.openhab.binding.draytonwiser.handler 12 | Import-Package: 13 | com.google.gson, 14 | com.google.gson.annotations, 15 | com.google.common.collect, 16 | org.apache.http, 17 | org.apache.http.client, 18 | org.apache.http.client.methods, 19 | org.apache.http.entity, 20 | org.apache.http.impl.client, 21 | org.apache.http.message, 22 | org.eclipse.jdt.annotation;resolution:=optional, 23 | org.eclipse.smarthome.config.core, 24 | org.eclipse.smarthome.core.library.types, 25 | org.eclipse.smarthome.core.thing, 26 | org.eclipse.smarthome.core.thing.binding, 27 | org.eclipse.smarthome.core.thing.binding.builder, 28 | org.eclipse.smarthome.core.thing.type, 29 | org.eclipse.smarthome.core.types, 30 | org.openhab.binding.draytonwiser, 31 | org.openhab.binding.draytonwiser.handler, 32 | org.osgi.service.component.annotations;resolution:=optional, 33 | org.slf4j 34 | Service-Component: OSGI-INF/*.xml 35 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/Schedule.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class Schedule { 8 | 9 | @SerializedName("id") 10 | @Expose 11 | public Integer id; 12 | @SerializedName("Monday") 13 | @Expose 14 | public Monday monday; 15 | @SerializedName("Tuesday") 16 | @Expose 17 | public Tuesday tuesday; 18 | @SerializedName("Wednesday") 19 | @Expose 20 | public Wednesday wednesday; 21 | @SerializedName("Thursday") 22 | @Expose 23 | public Thursday thursday; 24 | @SerializedName("Friday") 25 | @Expose 26 | public Friday friday; 27 | @SerializedName("Saturday") 28 | @Expose 29 | public Saturday saturday; 30 | @SerializedName("Sunday") 31 | @Expose 32 | public Sunday sunday; 33 | @SerializedName("Type") 34 | @Expose 35 | public String type; 36 | @SerializedName("CurrentSetpoint") 37 | @Expose 38 | public Integer currentSetpoint; 39 | @SerializedName("NextEventTime") 40 | @Expose 41 | public Integer nextEventTime; 42 | @SerializedName("NextEventSetpoint") 43 | @Expose 44 | public Integer nextEventSetpoint; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /about.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | About 7 | 8 | 9 |

About This Content

10 | 11 |

March 30, 2017

12 |

License

13 | 14 |

15 | The openHAB community makes available all content in this plug-in ("Content"). Unless otherwise 16 | indicated below, the Content is provided to you under the terms and conditions of the 17 | Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available 18 | at http://www.eclipse.org/legal/epl-v10.html. 19 | For purposes of the EPL, "Program" will mean the Content. 20 |

21 | 22 |

23 | If you did not receive this Content directly from the openHAB community, the Content is 24 | being redistributed by another party ("Redistributor") and different terms and conditions may 25 | apply to your use of any object code in the Content. Check the Redistributor's license that was 26 | provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise 27 | indicated below, the terms and conditions of the EPL still apply to any source code in the Content 28 | and such source code may be obtained at openhab.org. 29 |

30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/Room.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import java.util.List; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Room { 9 | 10 | @SerializedName("id") 11 | @Expose 12 | public Integer id; 13 | @SerializedName("OverrideType") 14 | @Expose 15 | public String overrideType; 16 | @SerializedName("OverrideSetpoint") 17 | @Expose 18 | public Integer overrideSetpoint; 19 | @SerializedName("RoomStatId") 20 | @Expose 21 | public Integer roomStatId; 22 | @SerializedName("ScheduleId") 23 | @Expose 24 | public Integer scheduleId; 25 | @SerializedName("Name") 26 | @Expose 27 | public String name; 28 | @SerializedName("Mode") 29 | @Expose 30 | public String mode; 31 | @SerializedName("DemandType") 32 | @Expose 33 | public String demandType; 34 | @SerializedName("CalculatedTemperature") 35 | @Expose 36 | public Integer calculatedTemperature; 37 | @SerializedName("CurrentSetPoint") 38 | @Expose 39 | public Integer currentSetPoint; 40 | @SerializedName("PercentageDemand") 41 | @Expose 42 | public Integer percentageDemand; 43 | @SerializedName("ControlOutputState") 44 | @Expose 45 | public String controlOutputState; 46 | @SerializedName("DisplayedSetPoint") 47 | @Expose 48 | public Integer displayedSetPoint; 49 | @SerializedName("SmartValveIds") 50 | @Expose 51 | public List smartValveIds = null; 52 | @SerializedName("WindowState") 53 | @Expose 54 | public String windowState; 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/System.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class System { 8 | 9 | @SerializedName("PairingStatus") 10 | @Expose 11 | public String pairingStatus; 12 | @SerializedName("TimeZoneOffset") 13 | @Expose 14 | public Integer timeZoneOffset; 15 | @SerializedName("AutomaticDaylightSaving") 16 | @Expose 17 | public Boolean automaticDaylightSaving; 18 | @SerializedName("Version") 19 | @Expose 20 | public Integer version; 21 | @SerializedName("FotaEnabled") 22 | @Expose 23 | public Boolean fotaEnabled; 24 | @SerializedName("ValveProtectionEnabled") 25 | @Expose 26 | public Boolean valveProtectionEnabled; 27 | @SerializedName("EcoModeEnabled") 28 | @Expose 29 | public Boolean ecoModeEnabled; 30 | @SerializedName("BoilerSettings") 31 | @Expose 32 | public BoilerSettings boilerSettings; 33 | @SerializedName("UnixTime") 34 | @Expose 35 | public Integer unixTime; 36 | @SerializedName("CloudConnectionStatus") 37 | @Expose 38 | public String cloudConnectionStatus; 39 | @SerializedName("ZigbeeModuleVersion") 40 | @Expose 41 | public String zigbeeModuleVersion; 42 | @SerializedName("ZigbeeEui") 43 | @Expose 44 | public String zigbeeEui; 45 | @SerializedName("LocalDateAndTime") 46 | @Expose 47 | public LocalDateAndTime localDateAndTime; 48 | @SerializedName("HeatingButtonOverrideState") 49 | @Expose 50 | public String heatingButtonOverrideState; 51 | @SerializedName("HotWaterButtonOverrideState") 52 | @Expose 53 | public String hotWaterButtonOverrideState; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/DraytonWiserBindingConstants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2017 by the respective copyright holders. 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * which accompanies this distribution, and is available at 7 | * http://www.eclipse.org/legal/epl-v10.html 8 | */ 9 | package org.openhab.binding.draytonwiser; 10 | 11 | import java.util.Set; 12 | 13 | import org.eclipse.jdt.annotation.NonNullByDefault; 14 | import org.eclipse.smarthome.core.thing.ThingTypeUID; 15 | 16 | import com.google.common.collect.Sets; 17 | 18 | /** 19 | * The {@link DraytonWiserBindingConstants} class defines common constants, which are 20 | * used across the whole binding. 21 | * 22 | * @author Rob Pope - Initial contribution 23 | */ 24 | @NonNullByDefault 25 | public class DraytonWiserBindingConstants { 26 | 27 | private static final String BINDING_ID = "draytonwiser"; 28 | 29 | // List of all Thing Type UIDs 30 | public static final ThingTypeUID THING_TYPE_HEATHUB = new ThingTypeUID(BINDING_ID, "heathub"); 31 | public static final ThingTypeUID THING_TYPE_ROOM = new ThingTypeUID(BINDING_ID, "room"); 32 | public static final ThingTypeUID THING_TYPE_ROOMSTAT = new ThingTypeUID(BINDING_ID, "roomstat"); 33 | // Not needed? 34 | // public static final ThingTypeUID THING_TYPE_THERMOSTAT = new ThingTypeUID(BINDING_ID, "thermostat"); 35 | // public static final ThingTypeUID BRIDGE_THING_TYPE = new ThingTypeUID(BINDING_ID, "heathub"); 36 | 37 | // List of all Channel ids 38 | public static final String CHANNEL_TEMPERATURE = "currentTemperature"; 39 | public static final String CHANNEL_HUMIDITY = "currentHumidity"; 40 | public static final String CHANNEL_SETPOINT = "currentSetPoint"; 41 | public static final String CHANNEL_BATTERYLEVEL = "batteryLevel"; 42 | 43 | public static final Set SUPPORTED_THING_TYPES_UIDS = Sets.newHashSet(THING_TYPE_ROOM, 44 | THING_TYPE_ROOMSTAT); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/Device.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class Device { 8 | 9 | @SerializedName("id") 10 | @Expose 11 | public Integer id; 12 | @SerializedName("ProductType") 13 | @Expose 14 | public String productType; 15 | @SerializedName("ProductIdentifier") 16 | @Expose 17 | public String productIdentifier; 18 | @SerializedName("ActiveFirmwareVersion") 19 | @Expose 20 | public String activeFirmwareVersion; 21 | @SerializedName("Manufacturer") 22 | @Expose 23 | public String manufacturer; 24 | @SerializedName("ModelIdentifier") 25 | @Expose 26 | public String modelIdentifier; 27 | @SerializedName("DisplayedSignalStrength") 28 | @Expose 29 | public String displayedSignalStrength; 30 | @SerializedName("HardwareVersion") 31 | @Expose 32 | public String hardwareVersion; 33 | @SerializedName("SerialNumber") 34 | @Expose 35 | public String serialNumber; 36 | @SerializedName("ProductRange") 37 | @Expose 38 | public String productRange; 39 | @SerializedName("ProductModel") 40 | @Expose 41 | public String productModel; 42 | @SerializedName("ProductFamily") 43 | @Expose 44 | public String productFamily; 45 | @SerializedName("OtaImageQueryCount") 46 | @Expose 47 | public Integer otaImageQueryCount; 48 | @SerializedName("LastOtaImageQueryCount") 49 | @Expose 50 | public Integer lastOtaImageQueryCount; 51 | @SerializedName("BatteryVoltage") 52 | @Expose 53 | public Integer batteryVoltage; 54 | @SerializedName("BatteryLevel") 55 | @Expose 56 | public String batteryLevel; 57 | @SerializedName("Rssi") 58 | @Expose 59 | public Integer rssi; 60 | @SerializedName("Lqi") 61 | @Expose 62 | public Integer lqi; 63 | @SerializedName("OtaLastImageSentBytes") 64 | @Expose 65 | public Integer otaLastImageSentBytes; 66 | @SerializedName("PendingZigbeeMessageMask") 67 | @Expose 68 | public Integer pendingZigbeeMessageMask; 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/DraytonWiserHandlerFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2017 by the respective copyright holders. 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * which accompanies this distribution, and is available at 7 | * http://www.eclipse.org/legal/epl-v10.html 8 | */ 9 | package org.openhab.binding.draytonwiser.internal; 10 | 11 | import static org.openhab.binding.draytonwiser.DraytonWiserBindingConstants.THING_TYPE_ROOM; 12 | 13 | import java.util.Collections; 14 | import java.util.Set; 15 | 16 | import org.eclipse.jdt.annotation.NonNullByDefault; 17 | import org.eclipse.jdt.annotation.Nullable; 18 | import org.eclipse.smarthome.core.thing.Thing; 19 | import org.eclipse.smarthome.core.thing.ThingTypeUID; 20 | import org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory; 21 | import org.eclipse.smarthome.core.thing.binding.ThingHandler; 22 | import org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory; 23 | import org.openhab.binding.draytonwiser.handler.DraytonWiserHandler; 24 | import org.osgi.service.component.annotations.Component; 25 | 26 | /** 27 | * The {@link DraytonWiserHandlerFactory} is responsible for creating things and thing 28 | * handlers. 29 | * 30 | * @author Rob Pope - Initial contribution 31 | */ 32 | @Component(service = ThingHandlerFactory.class, immediate = true, configurationPid = "binding.draytonwiser") 33 | @NonNullByDefault 34 | public class DraytonWiserHandlerFactory extends BaseThingHandlerFactory { 35 | 36 | private static final Set SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_ROOM); 37 | 38 | @Override 39 | public boolean supportsThingType(ThingTypeUID thingTypeUID) { 40 | return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); 41 | } 42 | 43 | @Override 44 | protected @Nullable ThingHandler createHandler(Thing thing) { 45 | ThingTypeUID thingTypeUID = thing.getThingTypeUID(); 46 | 47 | if (thingTypeUID.equals(THING_TYPE_ROOM)) { 48 | return new DraytonWiserHandler(thing); 49 | } 50 | 51 | return null; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/config/HeatHub.java: -------------------------------------------------------------------------------- 1 | 2 | package org.openhab.binding.draytonwiser.internal.config; 3 | 4 | import java.util.List; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class HeatHub { 9 | 10 | @SerializedName("System") 11 | @Expose 12 | private System system; 13 | @SerializedName("HeatingChannel") 14 | @Expose 15 | private List heatingChannel = null; 16 | @SerializedName("Room") 17 | @Expose 18 | private List room = null; 19 | @SerializedName("Schedule") 20 | @Expose 21 | private List schedule = null; 22 | @SerializedName("Device") 23 | @Expose 24 | private List device = null; 25 | @SerializedName("UpgradeInfo") 26 | @Expose 27 | private List upgradeInfo = null; 28 | @SerializedName("RoomStat") 29 | @Expose 30 | private List roomStat = null; 31 | @SerializedName("Cloud") 32 | @Expose 33 | private Cloud cloud; 34 | 35 | public System getSystem() { 36 | return system; 37 | } 38 | 39 | public void setSystem(System system) { 40 | this.system = system; 41 | } 42 | 43 | public List getHeatingChannel() { 44 | return heatingChannel; 45 | } 46 | 47 | public void setHeatingChannel(List heatingChannel) { 48 | this.heatingChannel = heatingChannel; 49 | } 50 | 51 | public List getRoom() { 52 | return room; 53 | } 54 | 55 | public void setRoom(List room) { 56 | this.room = room; 57 | } 58 | 59 | public List getSchedule() { 60 | return schedule; 61 | } 62 | 63 | public void setSchedule(List schedule) { 64 | this.schedule = schedule; 65 | } 66 | 67 | public List getDevice() { 68 | return device; 69 | } 70 | 71 | public void setDevice(List device) { 72 | this.device = device; 73 | } 74 | 75 | public List getUpgradeInfo() { 76 | return upgradeInfo; 77 | } 78 | 79 | public void setUpgradeInfo(List upgradeInfo) { 80 | this.upgradeInfo = upgradeInfo; 81 | } 82 | 83 | public List getRoomStat() { 84 | return roomStat; 85 | } 86 | 87 | public void setRoomStat(List roomStat) { 88 | this.roomStat = roomStat; 89 | } 90 | 91 | public Cloud getCloud() { 92 | return cloud; 93 | } 94 | 95 | public void setCloud(Cloud cloud) { 96 | this.cloud = cloud; 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Drayton Wiser Smart Thermostat Binding 2 | 3 | Currently very limited to getting and setting room temperatures. 4 | 5 | ## Supported Things 6 | 7 | At the moment this only supports a room and gets the humidity from one device in the room. Many things are on the todo list. 8 | 9 | ## Discovery 10 | 11 | Not yet implemented 12 | 13 | ## Binding Configuration 14 | 15 | To install copy the .jar file to the addons folder. On linux this is `/usr/share/openhab2/addons` 16 | 17 | Find your HeatHub (the part that connects to the boiler) by following these instructions from [Chris Evans](https://community.openhab.org/t/drayton-wiser-thermostat-binding/35640/24?u=andrew-schofield): 18 | * Log out of the app. Make sure you’re at the login screen 19 | * Tap Setup / Create Account (even though your system has already been set up). 20 | * Select the HubR type 21 | * Press the Setup button on the hub 22 | * This will start the WiserHeatXXX access point. 23 | * Connect to WiserHeatXXX with a real computer. You should get an IP in the 192.168.8.0/24 range. 24 | * Perform a GET to the /secret/ endpoint at 192.168.8.1. You might be able to use a browser, I didn’t try. If you prefer powershell like me… 25 | 26 | `Invoke-RestMethod -Method Get -UseBasicParsing -Uri http://192.168.8.1/secret/` 27 | 28 | * You’ll get the secret back as a string. 29 | * Now finish the setup… 30 | * Follow the on-screen instructions to connect your smartphone to WiserHeatXXX 31 | * Tap Skip when prompted to set up your heating system. 32 | * Follow the on-screen instructions to connect your Heat HubR to the 33 | * Internet by selecting your new Wi-Fi network. 34 | * Tap Skip when prompted to register an account. 35 | * You have now changed to a new Wi-Fi network. You will see the home screen and can proceed to control your heating as normal 36 | 37 | ## Thing Configuration 38 | 39 | Then add the Room to your things file: 40 | 41 | `draytonwiser:room:livingroom [ deviceIP="192.168.3.6", authToken="YOUR_SECRET_KEY" ]` 42 | 43 | Replace `livingroom` with the name you've given your room in the Drayton Wiser App, removing any whitespace 44 | 45 | ## Channels 46 | 47 | Channels currently supported are Temperature, Humidity and Set Point Temperature. 48 | 49 | In the items file add the following: 50 | ``` 51 | //Thermostat 52 | Number temperature "Temperature [%.1f °C]" (gTemp) { channel = "draytonwiser:room:livingroom:currentTemperature" } 53 | Number humidity "Humidity [%d %%]" { channel = "draytonwiser:room:livingroom:currentHumidity" } 54 | Number setPoint "Set Point [%.1f °C]" { channel = "draytonwiser:room:livingroom:currentSetPoint" } 55 | ``` 56 | 57 | Be sure to update the channel to reflect your channel set in the things file. 58 | 59 | ## Full Example 60 | 61 | //ToDo 62 | -------------------------------------------------------------------------------- /ESH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Will be resolved by discovery in the future 15 | 16 | 17 | 18 | 19 | Currently needs to be identified by packet sniffing local network traffic. Sent in the header of any web request with the SECRET key value pair. 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Room thing for DraytonWiser Binding 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | Thermostat device including TRVs 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Number 52 | 53 | Current temperature channel for DraytonWiser Binding 54 | 55 | 56 | 57 | 58 | Number 59 | 60 | Current Humidity channel for DraytonWiser Binding 61 | 62 | 63 | 64 | 65 | Number 66 | 67 | Set Point Control channel for DraytonWiser Binding 68 | 69 | 70 | 71 | 72 | Number 73 | 74 | Current Battery Level for the Room Stat 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /target/p2content.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Bundle-SymbolicName: org.openhab.binding.draytonwiser;singleton:=true Bundle-Version: 2.2.0.201711162206 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /target/maven-status/maven-compiler-plugin/compile/default/inputFiles.lst: -------------------------------------------------------------------------------- 1 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\Sunday.java 2 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\connection\DraytonWiserConnection.java 3 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\Tuesday.java 4 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\SetPoint__.java 5 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\Wednesday.java 6 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\DraytonWiserBindingConstants.java 7 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\SetPoint.java 8 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\Schedule.java 9 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\BoilerSettings.java 10 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\Cloud.java 11 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\Thursday.java 12 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\SetPoint_____.java 13 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\handler\DraytonWiserHandler.java 14 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\HeatingChannel.java 15 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\Saturday.java 16 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\Friday.java 17 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\RoomStat.java 18 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\SetPoint______.java 19 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\UpgradeInfo.java 20 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\SetPoint___.java 21 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\handler\DraytonWiserBridgeHandler.java 22 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\Device.java 23 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\DraytonWiserHandlerFactory.java 24 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\System.java 25 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\SetPoint_.java 26 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\LocalDateAndTime.java 27 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\SetPoint____.java 28 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\Room.java 29 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\Monday.java 30 | C:\Users\poper\openhab2-master\git\openhab2-addons\addons\binding\org.openhab.binding.draytonwiser\src\main\java\org\openhab\binding\draytonwiser\internal\config\HeatHub.java 31 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/internal/connection/DraytonWiserConnection.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014-2017 by the respective copyright holders. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | package org.openhab.binding.draytonwiser.internal.connection; 9 | 10 | import java.io.IOException; 11 | import java.io.InputStream; 12 | import java.net.HttpURLConnection; 13 | import java.net.URL; 14 | import java.util.Scanner; 15 | 16 | import org.apache.http.HttpResponse; 17 | import org.apache.http.client.methods.HttpPatch; 18 | import org.apache.http.entity.ContentType; 19 | import org.apache.http.entity.StringEntity; 20 | import org.apache.http.impl.client.CloseableHttpClient; 21 | import org.apache.http.impl.client.HttpClientBuilder; 22 | import org.openhab.binding.draytonwiser.internal.config.HeatHub; 23 | import org.openhab.binding.draytonwiser.internal.config.Room; 24 | import org.slf4j.Logger; 25 | import org.slf4j.LoggerFactory; 26 | 27 | import com.google.gson.Gson; 28 | 29 | /** 30 | * Implementation for Drayton Wiser url connection, based on the Yahoo Weather binding by Christoph Weitkamp. 31 | * 32 | * @author Rob Pope - Created first version 33 | * 34 | */ 35 | public class DraytonWiserConnection { 36 | 37 | private final Logger logger = LoggerFactory.getLogger(DraytonWiserConnection.class); 38 | 39 | // private static final String WEBSERVICE_URL = "http://192.168.3.6/data/domain/"; 40 | 41 | private static final String METHOD = "GET"; 42 | 43 | private static final int TIMEOUT = 10 * 1000; // 10s 44 | 45 | public HeatHub getResponseFromQuery(String WEBSERVICE_URL, String AUTHTOKEN) { 46 | try { 47 | 48 | URL url = new URL("http://" + WEBSERVICE_URL + "/data/domain/"); 49 | HttpURLConnection con = (HttpURLConnection) url.openConnection(); 50 | con.setConnectTimeout(TIMEOUT); 51 | con.setRequestMethod(METHOD); 52 | con.setRequestProperty("SECRET", AUTHTOKEN); 53 | 54 | InputStream response = con.getInputStream(); 55 | 56 | try (Scanner scanner = new Scanner(response)) { 57 | String responseBody = scanner.useDelimiter("\\A").next(); 58 | 59 | HeatHub hh = new Gson().fromJson(responseBody, HeatHub.class); 60 | 61 | return hh; 62 | } 63 | /* 64 | * return HttpUtil.executeUrl(METHOD, 65 | * WEBSERVICE_URL + "&q=" + URLEncoder.encode(query, StandardCharsets.UTF_8.toString()), TIMEOUT); 66 | */ 67 | 68 | } catch (IOException e) { 69 | logger.warn("Communication error occurred while getting your Drayton Wiser information: {}", 70 | e.getMessage()); 71 | } 72 | return null; 73 | } 74 | 75 | public void setRoomTemperature(String WEBSERVICE_URL, String AUTHTOKEN, String roomName, int newTemp) { 76 | try { 77 | 78 | // Find room ID based on name 79 | String roomId = getRoomID(WEBSERVICE_URL, AUTHTOKEN, roomName); 80 | 81 | CloseableHttpClient http = HttpClientBuilder.create().build(); 82 | 83 | String payload = "{\"RequestOverride\":{\"Type\":\"Manual\",\"SetPoint\":" + Integer.toString(newTemp) 84 | + " }}"; 85 | HttpPatch updateRequest = new HttpPatch("http://192.168.3.6/data/domain/Room/" + roomId); 86 | updateRequest.setEntity(new StringEntity(payload, ContentType.APPLICATION_JSON)); 87 | updateRequest.setHeader("SECRET", AUTHTOKEN); 88 | 89 | HttpResponse response = http.execute(updateRequest); 90 | String out = response.getEntity().toString(); 91 | logger.debug(out); 92 | 93 | } catch (IOException e) { 94 | logger.warn("Communication error occurred while getting your Drayton Wiser information: {}", 95 | e.getMessage()); 96 | } 97 | } 98 | 99 | public String getRoomID(String WEBSERVICE_URL, String AUTHTOKEN, String roomName) { 100 | // Convert config room name to lowercase with no spaces 101 | roomName = roomName.toLowerCase().replaceAll("\\s+", ""); 102 | 103 | try { 104 | 105 | URL url = new URL("http://" + WEBSERVICE_URL + "/data/domain/"); 106 | HttpURLConnection con = (HttpURLConnection) url.openConnection(); 107 | con.setConnectTimeout(TIMEOUT); 108 | con.setRequestMethod(METHOD); 109 | con.setRequestProperty("SECRET", AUTHTOKEN); 110 | 111 | InputStream response = con.getInputStream(); 112 | 113 | try (Scanner scanner = new Scanner(response)) { 114 | String responseBody = scanner.useDelimiter("\\A").next(); 115 | HeatHub hh = new Gson().fromJson(responseBody, HeatHub.class); 116 | for (Room myRoom : hh.getRoom()) { 117 | String myRoomName = myRoom.name.toLowerCase().replaceAll("\\s+", ""); 118 | if (myRoomName.equals(roomName)) { 119 | return myRoom.id.toString(); 120 | } 121 | } 122 | } 123 | } catch (IOException e) { 124 | logger.warn("Communication error occurred while getting your Drayton Wiser information: {}", 125 | e.getMessage()); 126 | } 127 | return null; 128 | } 129 | } -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/draytonwiser/handler/DraytonWiserHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2017 by the respective copyright holders. 3 | * 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * which accompanies this distribution, and is available at 7 | * http://www.eclipse.org/legal/epl-v10.html 8 | */ 9 | package org.openhab.binding.draytonwiser.handler; 10 | 11 | import static org.openhab.binding.draytonwiser.DraytonWiserBindingConstants.*; 12 | 13 | import java.util.concurrent.ScheduledFuture; 14 | import java.util.concurrent.TimeUnit; 15 | 16 | import org.eclipse.smarthome.core.library.types.DecimalType; 17 | import org.eclipse.smarthome.core.thing.ChannelUID; 18 | import org.eclipse.smarthome.core.thing.Thing; 19 | import org.eclipse.smarthome.core.thing.ThingStatus; 20 | import org.eclipse.smarthome.core.thing.ThingStatusDetail; 21 | import org.eclipse.smarthome.core.thing.binding.BaseThingHandler; 22 | import org.eclipse.smarthome.core.types.Command; 23 | import org.eclipse.smarthome.core.types.State; 24 | import org.eclipse.smarthome.core.types.UnDefType; 25 | import org.openhab.binding.draytonwiser.internal.config.HeatHub; 26 | import org.openhab.binding.draytonwiser.internal.config.Room; 27 | import org.openhab.binding.draytonwiser.internal.config.RoomStat; 28 | //Additional Imports 29 | import org.openhab.binding.draytonwiser.internal.connection.DraytonWiserConnection; 30 | import org.slf4j.Logger; 31 | import org.slf4j.LoggerFactory; 32 | 33 | /** 34 | * The {@link DraytonWiserHandler} is responsible for handling commands, which are 35 | * sent to one of the channels. 36 | * 37 | * @author Rob Pope - Initial contribution 38 | */ 39 | // @NonNullByDefault 40 | public class DraytonWiserHandler extends BaseThingHandler { 41 | 42 | private static final String DEVICE_IP_PARAM = "deviceIP"; 43 | private static final String AUTH_TOKEN_PARAM = "authToken"; 44 | private final Logger logger = LoggerFactory.getLogger(DraytonWiserHandler.class); 45 | 46 | private final DraytonWiserConnection connection = new DraytonWiserConnection(); 47 | 48 | private String DraytonWiserAddress; 49 | private String DraytonWiserToken; 50 | private HeatHub DraytonWiserHeatHub; 51 | ScheduledFuture refreshJob; 52 | 53 | public DraytonWiserHandler(Thing thing) { 54 | super(thing); 55 | } 56 | 57 | @Override 58 | public void handleCommand(ChannelUID channelUID, Command command) { 59 | if (channelUID.getId().equals(CHANNEL_TEMPERATURE)) { 60 | // TODO: handle command 61 | 62 | // Note: if communication with thing fails for some reason, 63 | // indicate that by setting the status with detail information 64 | // updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, 65 | // "Could not control device at IP address x.x.x.x"); 66 | } 67 | if (channelUID.getId().equals(CHANNEL_SETPOINT)) { 68 | int newSetPoint = Integer.parseInt(command.toString()) * 10; 69 | String roomName = channelUID.getThingUID().getId(); 70 | connection.setRoomTemperature(DraytonWiserAddress, DraytonWiserToken, roomName, newSetPoint); 71 | } 72 | } 73 | 74 | @Override 75 | public void initialize() { 76 | logger.debug("Initialising Drayton Wiser Handler"); 77 | 78 | org.eclipse.smarthome.config.core.Configuration config = getThing().getConfiguration(); 79 | DraytonWiserAddress = (String) config.get(DEVICE_IP_PARAM); 80 | DraytonWiserToken = (String) config.get(AUTH_TOKEN_PARAM); 81 | 82 | // Connect to the heat hub 83 | // DraytonWiserData = connection.getResponseFromQuery("abc123"); 84 | DraytonWiserHeatHub = connection.getResponseFromQuery(DraytonWiserAddress, DraytonWiserToken); 85 | 86 | updateStatus(ThingStatus.ONLINE); 87 | 88 | startAutomaticRefresh(); 89 | 90 | } 91 | 92 | @Override 93 | public void dispose() { 94 | refreshJob.cancel(true); 95 | } 96 | 97 | public void startAutomaticRefresh() { 98 | // refreshJob.cancel(true); 99 | refreshJob = scheduler.scheduleWithFixedDelay(() -> { 100 | try { 101 | boolean success = updateDraytonWiserData(); 102 | if (success) { 103 | String thingUID = getThing().getUID().getId(); 104 | updateState(new ChannelUID(getThing().getUID(), CHANNEL_TEMPERATURE), getTemperature(thingUID)); 105 | updateState(new ChannelUID(getThing().getUID(), CHANNEL_HUMIDITY), getHumidity(thingUID)); 106 | updateState(new ChannelUID(getThing().getUID(), CHANNEL_SETPOINT), getSetPoint(thingUID)); 107 | } 108 | } catch (Exception e) { 109 | logger.debug("Exception occurred during execution: {}", e.getMessage(), e); 110 | updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, e.getMessage()); 111 | } 112 | }, 0, 60, TimeUnit.SECONDS); 113 | } 114 | 115 | private synchronized boolean updateDraytonWiserData() { 116 | DraytonWiserHeatHub = connection.getResponseFromQuery(DraytonWiserAddress, DraytonWiserToken); 117 | return true; 118 | } 119 | 120 | private State getTemperature(String thingUID) { 121 | float temp = 0; 122 | 123 | if (DraytonWiserHeatHub != null) { 124 | /* 125 | * for (RoomStat roomstat : DraytonWiserHeatHub.getRoomStat()) { 126 | * temp = roomstat.getMeasuredTemperature(); 127 | * temp = temp / 10; 128 | * } 129 | * if (temp != 0) { 130 | * return new DecimalType(temp); 131 | * } 132 | */ 133 | // Added for new logic (Only interested in Rooms) 134 | for (Room room : DraytonWiserHeatHub.getRoom()) { 135 | String roomName = room.name.toLowerCase().replaceAll("\\s+", ""); 136 | if (roomName.equals(thingUID)) { 137 | temp = room.calculatedTemperature; 138 | temp = temp / 10; 139 | } 140 | } 141 | if (temp != 0) { 142 | return new DecimalType(temp); 143 | } 144 | } 145 | return UnDefType.UNDEF; 146 | // return new DecimalType("1"); 147 | } 148 | 149 | private State getHumidity(String thingUID) { 150 | int hum = 0; 151 | if (DraytonWiserHeatHub != null) { 152 | /* 153 | * for (RoomStat roomstat : DraytonWiserHeatHub.getRoomStat()) { 154 | * hum = roomstat.getMeasuredHumidity(); 155 | * } 156 | * 157 | * if (hum != 0) { 158 | * return new DecimalType(hum); 159 | * } 160 | */ 161 | for (Room room : DraytonWiserHeatHub.getRoom()) { 162 | String roomName = room.name.toLowerCase().replaceAll("\\s+", ""); 163 | if (roomName.equals(thingUID)) { 164 | for (RoomStat roomstat : DraytonWiserHeatHub.getRoomStat()) { 165 | if (roomstat.id == room.roomStatId) { 166 | hum = roomstat.measuredHumidity; 167 | } 168 | } 169 | } 170 | } 171 | if (hum != 0) { 172 | return new DecimalType(hum); 173 | } 174 | } 175 | return UnDefType.UNDEF; 176 | // return new DecimalType("1"); 177 | } 178 | 179 | private State getSetPoint(String thingUID) { 180 | float setpoint = 0; 181 | if (DraytonWiserHeatHub != null) { 182 | /* 183 | * for (RoomStat roomstat : DraytonWiserHeatHub.getRoomStat()) { 184 | * setpoint = roomstat.getSetPoint(); 185 | * setpoint = setpoint / 10; 186 | * } 187 | * if (setpoint != 0) { 188 | * return new DecimalType(setpoint); 189 | * } 190 | */ 191 | for (Room room : DraytonWiserHeatHub.getRoom()) { 192 | String roomName = room.name.toLowerCase().replaceAll("\\s+", ""); 193 | if (roomName.equals(thingUID)) { 194 | setpoint = room.displayedSetPoint; 195 | setpoint = setpoint / 10; 196 | } 197 | } 198 | if (setpoint != 0) { 199 | return new DecimalType(setpoint); 200 | } 201 | 202 | } 203 | return UnDefType.UNDEF; 204 | // return new DecimalType("1"); 205 | } 206 | } 207 | --------------------------------------------------------------------------------