From a1434084ee8c2fa255d6a30491e0d694ba596748 Mon Sep 17 00:00:00 2001 From: Michael Lobstein Date: Tue, 31 Mar 2020 18:37:18 -0500 Subject: [PATCH 01/27] RadioThermostat Binding - initial contribution Signed-off-by: Michael Lobstein --- CODEOWNERS | 1 + bom/openhab-addons/pom.xml | 5 + .../.classpath | 32 + .../.project | 23 + .../NOTICE | 13 + .../README.md | 198 ++++++ .../pom.xml | 15 + .../src/main/feature/feature.xml | 9 + .../RadioThermostatBindingConstants.java | 82 +++ .../RadioThermostatConfiguration.java | 29 + .../RadioThermostatHandlerFactory.java | 66 ++ ...dioThermostatStateDescriptionProvider.java | 63 ++ .../handler/RadioThermostatHandler.java | 622 ++++++++++++++++++ .../internal/json/RadioThermostatData.java | 71 ++ .../json/RadioThermostatJsonHumidity.java | 34 + .../json/RadioThermostatJsonModel.java | 31 + .../json/RadioThermostatJsonName.java | 31 + .../json/RadioThermostatJsonResponse.java | 151 +++++ .../json/RadioThermostatJsonRuntime.java | 52 ++ .../RadioThermostatJsonRuntimeHeatCool.java | 52 ++ .../json/RadioThermostatJsonTime.java | 84 +++ .../resources/ESH-INF/binding/binding.xml | 11 + .../resources/ESH-INF/thing/thing-types.xml | 268 ++++++++ bundles/pom.xml | 1 + 24 files changed, 1944 insertions(+) create mode 100644 bundles/org.openhab.binding.radiothermostat/.classpath create mode 100644 bundles/org.openhab.binding.radiothermostat/.project create mode 100644 bundles/org.openhab.binding.radiothermostat/NOTICE create mode 100644 bundles/org.openhab.binding.radiothermostat/README.md create mode 100644 bundles/org.openhab.binding.radiothermostat/pom.xml create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/feature/feature.xml create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/RadioThermostatBindingConstants.java create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/RadioThermostatConfiguration.java create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/RadioThermostatHandlerFactory.java create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/RadioThermostatStateDescriptionProvider.java create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/handler/RadioThermostatHandler.java create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/json/RadioThermostatData.java create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/json/RadioThermostatJsonHumidity.java create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/json/RadioThermostatJsonModel.java create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/json/RadioThermostatJsonName.java create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/json/RadioThermostatJsonResponse.java create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/json/RadioThermostatJsonRuntime.java create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/json/RadioThermostatJsonRuntimeHeatCool.java create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/java/org/openhab/binding/radiothermostat/internal/json/RadioThermostatJsonTime.java create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/resources/ESH-INF/binding/binding.xml create mode 100644 bundles/org.openhab.binding.radiothermostat/src/main/resources/ESH-INF/thing/thing-types.xml diff --git a/CODEOWNERS b/CODEOWNERS index 58bf402a9a6c0..739d4e128ab48 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -147,6 +147,7 @@ /bundles/org.openhab.binding.powermax/ @lolodomo /bundles/org.openhab.binding.pulseaudio/ @peuter /bundles/org.openhab.binding.pushbullet/ @hakan42 +/bundles/org.openhab.binding.radiothermostat/ @mlobstein /bundles/org.openhab.binding.regoheatpump/ @crnjan /bundles/org.openhab.binding.rfxcom/ @martinvw @paulianttila /bundles/org.openhab.binding.rme/ @kgoderis diff --git a/bom/openhab-addons/pom.xml b/bom/openhab-addons/pom.xml index 00421d5781da4..1784d9ca69ada 100644 --- a/bom/openhab-addons/pom.xml +++ b/bom/openhab-addons/pom.xml @@ -729,6 +729,11 @@ org.openhab.binding.pushbullet ${project.version} + + org.openhab.addons.bundles + org.openhab.binding.radiothermostat + ${project.version} + org.openhab.addons.bundles org.openhab.binding.regoheatpump diff --git a/bundles/org.openhab.binding.radiothermostat/.classpath b/bundles/org.openhab.binding.radiothermostat/.classpath new file mode 100644 index 0000000000000..a5d95095ccaaf --- /dev/null +++ b/bundles/org.openhab.binding.radiothermostat/.classpath @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bundles/org.openhab.binding.radiothermostat/.project b/bundles/org.openhab.binding.radiothermostat/.project new file mode 100644 index 0000000000000..6efb0cb2923e5 --- /dev/null +++ b/bundles/org.openhab.binding.radiothermostat/.project @@ -0,0 +1,23 @@ + + + org.openhab.binding.radiothermostat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/bundles/org.openhab.binding.radiothermostat/NOTICE b/bundles/org.openhab.binding.radiothermostat/NOTICE new file mode 100644 index 0000000000000..38d625e349232 --- /dev/null +++ b/bundles/org.openhab.binding.radiothermostat/NOTICE @@ -0,0 +1,13 @@ +This content is produced and maintained by the openHAB project. + +* Project home: https://www.openhab.org + +== Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License 2.0 which is available at +https://www.eclipse.org/legal/epl-2.0/. + +== Source Code + +https://github.com/openhab/openhab-addons diff --git a/bundles/org.openhab.binding.radiothermostat/README.md b/bundles/org.openhab.binding.radiothermostat/README.md new file mode 100644 index 0000000000000..1719b0445c936 --- /dev/null +++ b/bundles/org.openhab.binding.radiothermostat/README.md @@ -0,0 +1,198 @@ +# RadioThermostat Binding + +This binding connects RadioThermostat/3M Filtrete models CT30, CT50/3M50, CT80, etc. with built-in Wi-Fi module to openHAB. + +The binding retrieves and periodically updates all basic system information from the thermostat. The main thermostat functions such +as thermostat mode, fan mode, temperature set point and hold mode can be controlled. System run-time information and humidity readings +are polled less frequently and can be disabled completely if not desired. Humidity information is available only when using a CT80 +thermostat and I have noticed that the humidity reported is very inaccurate. + +The main caveat for using this binding is to keep in mind that the web server in the thermostat is very slow. Do not over load it +with excessive amounts of simultaneous commands. When changing the thermostat mode, the current temperature set point is cleared and +a refresh of the thermostat data is done to get the new mode's set point. Since retrieving the thermostat's data is the slowest +operation, it will take several seconds after changing the mode before the new set point is displayed. The 'Program Mode' command +is untested and according to the published API is only available on a CT80 Rev B. + +## Supported Things + +There is exactly one supported thing type, which represents the thermostat. +It has the `rtherm` id. +Multiple Things can be added if more than one thermostat is to be controlled. + +## Binding Configuration + +The binding has no configuration options, all configuration is done at Thing level. + +## Thing Configuration + +The thing has a few configuration parameters: + +| Parameter | Description | +|-----------------|----------------------------------------------------------------------------------------------------------| +| hostName | The host name or IP address of the thermostat. Mandatory. | +| refresh | Overrides the refresh interval of the thermostat data. Optional, the default is 2 minutes. | +| logRefresh | Overrides the refresh interval of the run-time logs & humidity data. Optional, the default is 10 minutes. | +| disableLogs | Disable retrieval of run-time logs from the thermostat. Optional, the default is 0. | +| disableHumidity | Disable retrieval of humidity information from the thermostat. Optional, the default is 0. | + +## Channels + +The thermostat information that is retrieved is available as these channels: + +| Channel ID | Item Type | Description | +|-----------------------|----------------------|---------------------------------------------------------------------------| +| name | String | The name of the thermostat | +| model | String | The model number and firmware version of the thermostat | +| temperature | Number:Temperature | The current temperature reading of the thermostat | +| humidity | Number | The current humidity reading of the thermostat (CT80 only) | +| mode | Number | The current operating mode of the HVAC system | +| fan_mode | Number | The current operating mode of the fan | +| program_mode | Number | The program schedule that the thermostat is running (CT80 Rev B only) | +| set_point | Number:Temperature | The current temperature set point of the thermostat | +| status | Number | Indicates the current running status of the HVAC system | +| fan_status | Number | Indicates the current fan status of the HVAC system | +| override | Number | Indicates if the normal program set-point has been manually overridden | +| hold | Number | Indicates if the current set point temperature is to be held indefinitely | +| day | Number | The current day of the week reported by the thermostat (0 = Monday) | +| hour | Number | The current hour of the day reported by the thermostat (24 hr) | +| minute | Number | The current minute past the hour reported by the thermostat | +| dt_stamp | String | The current day of the week and time reported by the thermostat (E HH:mm) | +| last_update | DateTime | Last successful contact with thermostat | +| today_heat_hour | Number | The number of hours of heating run-time today | +| today_heat_minute | Number | The number of minutes of heating run-time today | +| today_cool_hour | Number | The number of hours of cooling run-time today | +| today_cool_minute | Number | The number of minutes of cooling run-time today | +| yesterday_heat_hour | Number | The number of hours of heating run-time yesterday | +| yesterday_heat_minute | Number | The number of minutes of heating run-time yesterday | +| yesterday_cool_hour | Number | The number of hours of cooling run-time yesterday | +| yesterday_cool_minute | Number | The number of minutes of cooling run-time yesterday | + +## Full Example + +radiotherm.map: + +```text +UNDEF_stus=- +NULL_stus=- +-_stus=- +0_stus=Off +1_stus=Heating +2_stus=Cooling +UNDEF_fstus=- +NULL_fstus=- +-_fstus=- +0_fstus=Off +1_fstus=On +UNDEF_mode=- +NULL_mode=- +-_mode=- +0_mode=Off +1_mode=Heat +2_mode=Cool +3_mode=Auto +UNDEF_fan=- +NULL_fan=- +-_fan=- +0_fan=Auto +1_fan=Auto/Circulate +2_fan=On +UNDEF_pgm=- +NULL_pgm=- +-_pgm=- +-1_pgm=None +0_pgm=Program A +1_pgm=Program B +2_pgm=Vacation +3_pgm=Holiday +UNDEF_over=- +NULL_over=- +-_over=- +0_over=No +1_over=Yes +UNDEF_hold=- +NULL_hold=- +-_hold=- +0_hold=Off +1_hold=On + +``` + +radiotherm.things: + +```java +radiothermostat:rtherm:mytherm1 "My 1st floor thermostat" [ hostName="192.168.10.1", refresh=2, logRefresh=10, disableLogs=0, disableHumidity=0 ] +radiothermostat:rtherm:mytherm2 "My 2nd floor thermostat" [ hostName="mythermhost2", refresh=1, logRefresh=20, disableLogs=1, disableHumidity=1 ] +``` + +radiotherm.items: + +```java +String Therm_Name "Thermostat Name [%s]" { channel="radiothermostat:rtherm:mytherm1:name" } +String Therm_Model "Thermostat Model [%s]" { channel="radiothermostat:rtherm:mytherm1:model" } + +Number:Temperature Therm_Temp "Current Temperature [%.1f °F] " { channel="radiothermostat:rtherm:mytherm1:temperature" } +// Humidity only supported on CT80 +Number Therm_Hum "Current Humidity [%d %%]" { channel="radiothermostat:rtherm:mytherm1:humidity" } +Number Therm_Mode "Thermostat Mode [MAP(radiotherm.map):%s_mode]" { channel="radiothermostat:rtherm:mytherm1:mode" } +// The Auto/Circulate option will only appear for CT80 +Number Therm_Fmode "Fan Mode [MAP(radiotherm.map):%s_fan]" { channel="radiothermostat:rtherm:mytherm1:fan_mode" } +// Program Mode only supported on CT80 Rev B +Number Therm_Pmode "Program Mode [MAP(radiotherm.map):%s_pgm]" { channel="radiothermostat:rtherm:mytherm1:program_mode" } +Number:Temperature Therm_Setpt "Set Point [%d °F]" { channel="radiothermostat:rtherm:mytherm1:set_point" } +Number Therm_Status "Status [MAP(radiotherm.map):%s_stus]" { channel="radiothermostat:rtherm:mytherm1:status" } +Number Therm_FanStatus "Fan Status [MAP(radiotherm.map):%s_fstus]" { channel="radiothermostat:rtherm:mytherm1:fan_status" } +Number Therm_Override "Override [MAP(radiotherm.map):%s_over]" { channel="radiothermostat:rtherm:mytherm1:override" } +Number Therm_Hold "Hold [MAP(radiotherm.map):%s_hold]" { channel="radiothermostat:rtherm:mytherm1:hold" } + +Number Therm_Day "Thermostat Day [%s]" { channel="radiothermostat:rtherm:mytherm1:day" } +Number Therm_Hour "Thermostat Hour [%s]" { channel="radiothermostat:rtherm:mytherm1:hour" } +Number Therm_Minute "Thermostat Minute [%s]" { channel="radiothermostat:rtherm:mytherm1:minute" } +String Therm_Dstmp "Thermostat DateStamp [%s]"