Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[radiothermostat] Added Absolute Setpoint Mode #8393

Merged
merged 8 commits into from
Sep 9, 2020
Merged

[radiothermostat] Added Absolute Setpoint Mode #8393

merged 8 commits into from
Sep 9, 2020

Conversation

silverfunk
Copy link

@silverfunk silverfunk commented Sep 4, 2020

When controlled remotely Radio Thermostat's can function in 2 modes. In temporary mode setpoint changes will be temporary; with the thermostat returning to run its program after a period of time. In absolute mode setpoint changes are permanent. The thermostat will maintain the given setpoint temperature until it is changed, completely ignoring the program. With OpenHab controlling the thermostat it is often not desirable to have the thermostat run its own program. Adding the absolute setpoint mode allows users to control the thermostat setpoint entirely through OpenHab.

@TravisBuddy
Copy link

Travis tests were successful

Hey @silverfunk,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@TravisBuddy
Copy link

Travis tests were successful

Hey @silverfunk,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@silverfunk silverfunk changed the title Added Absolute Setpoint Mode [radiothermostat] Added Absolute Setpoint Mode Sep 4, 2020
@Hilbrand Hilbrand added the enhancement An enhancement or new feature for an existing add-on label Sep 4, 2020
@Hilbrand
Copy link
Member

Hilbrand commented Sep 4, 2020

I'm not familiar with this device. But Is this something that is set once and than not changed? Or does it make sense for the user to sometimes change the setpoint temporary and other times permanent? In that case it might make more sense to have this as a channel parameter of a separate temporarySetPoint channel?

@marcelrv
Copy link
Contributor

marcelrv commented Sep 4, 2020

Indeed afree with @Hilbrand would suggest the same.
Make some sort of 'mode' channel instead, which than would be like program mode or permanent instead of doing this via config option.

I would also recommend not to use 'absolute' as channel name, I don't think it well describes the intent of the functionality

@Hilbrand
Copy link
Member

Hilbrand commented Sep 4, 2020

I would opt for a specific channel for temporarySetPoint as it would be easier. The user can simply pick a channel. Otherwise the user must first make sure the correct mode is set and then set the setpoint.

@TravisBuddy
Copy link

Travis tests were successful

Hey @silverfunk,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@mlobstein
Copy link
Contributor

I would opt for a specific channel for temporarySetPoint as it would be easier. The user can simply pick a channel. Otherwise the user must first make sure the correct mode is set and then set the setpoint.

I am not entirely sure this is needed. With the current implementation, the user can set the 'hold' switch on which will cause the temperature to maintain its current set point indefinitely. The thermostat will ignore its internal program schedule while in hold mode.

| logRefresh | Overrides the refresh interval of the run-time logs & humidity data. Optional, the default is 10 minutes. |
| isCT80 | Flag to enable additional features only available on the CT80 thermostat. Optional, the default is false. |
| disableLogs | Disable retrieval of run-time logs from the thermostat. Optional, the default is false. |
| absolute | Controls temporary or absolute mode. When false setpoint changes are temporary; the thermostat will return to its program after a time. When true setpoint changes are perminant; the thermostat will ignore its program maintaining the given setpoint. Optional, the default is false. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling: 'permanent'

@silverfunk
Copy link
Author

silverfunk commented Sep 8, 2020

The main idea behind creating an absolute mode is to allow the thermostat to be operated primarily via a program in the thermostat (thermostat driven) vs. operated via a smart home controller (openHAB). Without an absolute mode the thermostat only temporarily changes to the given setpoint, reverting later back to its program. Yes, hold could be used to force this same behavior but then hold cannot be used for smart home controller operations. For example I use hold on my thermostats to inform openHAB that it should maintain the setpoint regardless of whether or not people are home, e.g. it is hold for the thermostat and the smart home controller.

The real point of adding an absolute mode is to essentially make the thermostat a dumb device. In this mode it controls the temperature based solely on what openHAB tells it to do. I do not want it to have other ideas of how and when the temperature should be changed. In my house openHAB is able to tell the thermostat to control the temperature based on when people are home, whether or not we are in bed for the night, and the price I am paying for electricity. In an absolute mode the thermostat's only function is to monitor the temperature and turn on the furnace or AC when it gets beyond the setpoint ranges. I do not want the thermostat to be able to make decisions beyond what openHAB tells it to do.

When I originally contemplated this functionality I dithered between making it a parameter on the thing or a separate item channel. Ultimately I decided to go with a parameter on the thing because I could not fathom a reason why anyone would want to switch between the two. But that being said I am open to allowing for flexibility. If there is a desire to make the absolute mode into an item channel I can do that. I do think this would have to be an on/off switch though. Creating separate temporary and absolute setpoint items, while possible, would be complicated for a user interface. The thermostat is only able to maintain one active setpoint, either temporary or absolute. If both setpoints were items you could have a sitemap where both are visible but there is no indication which one is active. Changing one would inherently change the mode of the thermostat with no indication the thermostat was functioning differently.

@TravisBuddy
Copy link

Travis tests were successful

Hey @silverfunk,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

…/ESH-INF/thing/thing-types.xml

Co-authored-by: cpmeister <[email protected]>
Signed-off-by: Ted Jordan <[email protected]>
@TravisBuddy
Copy link

Travis tests were successful

Hey @silverfunk,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

Co-authored-by: mlobstein
Signed-off-by: Ted Jordan <[email protected]>
@TravisBuddy
Copy link

Travis tests were successful

Hey @silverfunk,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

Copy link
Member

@Hilbrand Hilbrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your extensive explanation. I now better understand it's usage. This is more about how to one wants to use the thermostat. I can image that if you want to run in absolute mode you never should send a temporary command as this will trigger the thermostat to start following it's program again. The naming of this option can be a discussion, but I guess it would best make sense to follow naming closely to what the thermostat uses and thus follow the terminology used as used in the pr.

I've one review request. Instead of using the a boolean to make it a options list. You can actually test this value in the initialize method and set the specific command, instead of testing it every time, since doesn't change anymore.

Comment on lines 61 to 65
<parameter name="absolute" type="boolean">
<label>Run in Absolute Setpoint Mode</label>
<description>Optional Flag to run in absolute or temporary setpoint mode</description>
<default>false</default>
</parameter>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<parameter name="absolute" type="boolean">
<label>Run in Absolute Setpoint Mode</label>
<description>Optional Flag to run in absolute or temporary setpoint mode</description>
<default>false</default>
</parameter>
<parameter name="setpointMode" type="text">
<label>Setpoint Mode</label>
<description>Run in absolute or temporary setpoint mode</description>
<default>temporary</default>
<options>
<option value="absolute">Absolute</option>
<option value="temporary">Temporary</option>
</options>
</parameter>

@mlobstein
Copy link
Contributor

mlobstein commented Sep 8, 2020

The main idea behind creating an absolute mode is to allow the thermostat to be operated primarily via a program in the thermostat (thermostat driven) vs. operated via a smart home controller (openHAB). Without an absolute mode the thermostat only temporarily changes to the given setpoint, reverting later back to its program.

That makes sense. I had never explored absolute mode myself. It is rather strange that there is no way to tell if the thermostat is using an absolute setpoint or not. So from the binding perspective it makes sense to chose one mode or the other and stick with it instead of providing a way to dynamically switch. I have attached some refactoring changes to the code to remove the SuppressWarnings mainly and improve a few little things. Please add them to your PR (note .java files renamed to .txt)

RadioThermostatConfiguration.java.txt

RadioThermostatStateDescriptionProvider.java.txt

RadioThermostatHandler.java.txt

@fwolter
Copy link
Member

fwolter commented Sep 8, 2020

@mlobstein You could also file a PR for the forked repo of @silverfunk

Changed the absolute parameter to setpointMode.

Signed-off-by: silverfunk <[email protected]>
@TravisBuddy
Copy link

Travis tests have failed

Hey @silverfunk,
please read the following log in order to understand the failure reason. There might also be some helpful tips along the way.
It will be awesome if you fix what is wrong and commit the changes.

this.isCT80 = config.isCT80;
this.disableLogs = config.disableLogs;

if (hostName == null || hostName == "") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be hostName.equals(""), sorry about that.

@TravisBuddy
Copy link

Travis tests were successful

Hey @silverfunk,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@silverfunk
Copy link
Author

@mlobstein, I incorporated your refactoring changes. Thank you for the updates.

In temporary mode the thermostat displays "Temporary" on the thermostat's screen while it is adjusting to the given temporary setpoint. In absolute mode it does not display "Temporary". That's the only indication I've seen that differentiates between the two modes. I have found nothing in the API to designate a difference between the modes.

@TravisBuddy
Copy link

Travis tests were successful

Hey @silverfunk,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@silverfunk silverfunk requested a review from cpmeister September 9, 2020 03:28
@TravisBuddy
Copy link

Travis tests were successful

Hey @silverfunk,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

Copy link
Member

@Hilbrand Hilbrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@marcelrv marcelrv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Hilbrand
Copy link
Member

Hilbrand commented Sep 9, 2020

@mlobstein any last words before I merge 😉

@mlobstein
Copy link
Contributor

@mlobstein any last words before I merge wink

LGTM

@Hilbrand Hilbrand merged commit 811d329 into openhab:2.5.x Sep 9, 2020
CSchlipp pushed a commit to CSchlipp/openhab-addons that referenced this pull request Sep 12, 2020
@wborn wborn added this to the 2.5.9 milestone Sep 18, 2020
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request Sep 19, 2020
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants