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] Add Remote Temperature channel #10194

Merged
merged 7 commits into from
Apr 9, 2021

Conversation

mlobstein
Copy link
Contributor

The goal of this PR is to add a channel that will send values to the Remote Temperature endpoint of the thermostat's API. This functionality was requested by issue #9807. Some minor code cleanup was done also.

Signed-off-by: Michael Lobstein <[email protected]>
Signed-off-by: Michael Lobstein <[email protected]>
Signed-off-by: Michael Lobstein <[email protected]>
@Skinah Skinah added the enhancement An enhancement or new feature for an existing add-on label Feb 18, 2021
@cpmeister cpmeister self-assigned this Feb 25, 2021
Signed-off-by: Michael Lobstein <[email protected]>
@mlobstein mlobstein requested a review from cpmeister February 26, 2021 01:11
Comment on lines 292 to 295
connector.sendCommand("rem_temp", cmdInt.toString(), REMOTE_TEMP_RESOURCE);
} else {
connector.sendCommand("rem_mode", "0", REMOTE_TEMP_RESOURCE);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You should make sure that the units are what you expect before you send the command to the device.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am already parsing out the value of the command string into a whole number on line 232. This device is US centric and only supports Fahrenheit so it should already be understood by the user that they are sending a Fahrenheit temperature value to it.

Copy link
Contributor

@cpmeister cpmeister Feb 26, 2021

Choose a reason for hiding this comment

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

That may be the case but the user might be using Celsius as their system default so the UI would end up displaying and sending values with that unit instead. Certain countries have easy access to products that use Fahrenheit even though they actually use celsius. E.g. Canada.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to recap this functionality a bit... This new channel is a write-only channel, it does not display anything back, It allows a user to override the internal temperature reading of this thermostat with a temperature value from an external sensor. Presumably a rule would be used to monitor an item containing a temperature sensor's value and when it changes, it would update an item linked to this channel. What ever number is received by the thermostat would then display on its screen as the current temperature reading (a whole number Fahrenheit value) and then be sent back to the main temperature channel (and displayed per whatever unit is specified by their system default settings) when the binding does its next polling update.

I am sure that there are a few of these in Canada even though it was not sold there.....
If someone in a Celsius country is using this, they will simply have to do a conversion of the Celsius temperature value they want to use in the rule that will send the value to this new channel. This will hopefully force them to ensure that a sane value is sent instead of relying on an automatic conversion that might have unpredictable results.

Signed-off-by: Michael Lobstein <[email protected]>
break;
case REMOTE_TEMP:
if (cmdInt != -1) {
connector.sendCommand("rem_temp", cmdInt.toString(), REMOTE_TEMP_RESOURCE);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
connector.sendCommand("rem_temp", cmdInt.toString(), REMOTE_TEMP_RESOURCE);
QuantityType<?> quantity = ((QuantityType<Temperature>) command).toUnit(SIUnits.Celsius);
connector.sendCommand("rem_temp", String.valueOf(quantity.intValue()), REMOTE_TEMP_RESOURCE);

Please just make the recommended change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, done.

Signed-off-by: Michael Lobstein <[email protected]>
Signed-off-by: Michael Lobstein <[email protected]>
@mlobstein
Copy link
Contributor Author

@fwolter can this be merged in time for 3.1.0.M3?

@mlobstein mlobstein changed the title [radiothermostat] Add Remote Temperature channel [radiothermostat] Add Remote Temperature channel (ready for review ... please ?) Apr 1, 2021
Copy link
Member

@fwolter fwolter left a comment

Choose a reason for hiding this comment

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

LGTM

@fwolter fwolter merged commit 035556b into openhab:main Apr 9, 2021
@fwolter fwolter changed the title [radiothermostat] Add Remote Temperature channel (ready for review ... please ?) [radiothermostat] Add Remote Temperature channel Apr 9, 2021
@fwolter fwolter added this to the 3.1 milestone Apr 9, 2021
themillhousegroup pushed a commit to themillhousegroup/openhab2-addons that referenced this pull request May 10, 2021
* Add Remote Temperature channel

Signed-off-by: Michael Lobstein <[email protected]>

* Fix spelling error

Signed-off-by: Michael Lobstein <[email protected]>

* Fix spelling error2

Signed-off-by: Michael Lobstein <[email protected]>

* review changes

Signed-off-by: Michael Lobstein <[email protected]>

* review changes

Signed-off-by: Michael Lobstein <[email protected]>

* review changes

Signed-off-by: Michael Lobstein <[email protected]>

* minor README update

Signed-off-by: Michael Lobstein <[email protected]>
Signed-off-by: John Marshall <[email protected]>
@mlobstein mlobstein deleted the radiothermostat_remotetemp branch May 15, 2021 22:45
computergeek1507 pushed a commit to computergeek1507/openhab-addons that referenced this pull request Jul 13, 2021
* Add Remote Temperature channel

Signed-off-by: Michael Lobstein <[email protected]>

* Fix spelling error

Signed-off-by: Michael Lobstein <[email protected]>

* Fix spelling error2

Signed-off-by: Michael Lobstein <[email protected]>

* review changes

Signed-off-by: Michael Lobstein <[email protected]>

* review changes

Signed-off-by: Michael Lobstein <[email protected]>

* review changes

Signed-off-by: Michael Lobstein <[email protected]>

* minor README update

Signed-off-by: Michael Lobstein <[email protected]>
thinkingstone pushed a commit to thinkingstone/openhab-addons that referenced this pull request Nov 7, 2021
* Add Remote Temperature channel

Signed-off-by: Michael Lobstein <[email protected]>

* Fix spelling error

Signed-off-by: Michael Lobstein <[email protected]>

* Fix spelling error2

Signed-off-by: Michael Lobstein <[email protected]>

* review changes

Signed-off-by: Michael Lobstein <[email protected]>

* review changes

Signed-off-by: Michael Lobstein <[email protected]>

* review changes

Signed-off-by: Michael Lobstein <[email protected]>

* minor README update

Signed-off-by: Michael Lobstein <[email protected]>
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this pull request May 5, 2022
* Add Remote Temperature channel

Signed-off-by: Michael Lobstein <[email protected]>

* Fix spelling error

Signed-off-by: Michael Lobstein <[email protected]>

* Fix spelling error2

Signed-off-by: Michael Lobstein <[email protected]>

* review changes

Signed-off-by: Michael Lobstein <[email protected]>

* review changes

Signed-off-by: Michael Lobstein <[email protected]>

* review changes

Signed-off-by: Michael Lobstein <[email protected]>

* minor README update

Signed-off-by: Michael Lobstein <[email protected]>
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.

4 participants