-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[gree] Add channel for temperature sensor #8303
Conversation
Attaching sources and binary JARs as per PR guidelines hoping that these might help anyone reviewing this PR. Thanks :) |
Travis tests were successfulHey @taboneclayton, |
Is it worth the breaking change? We are going from 2.5.7 to 2.5.8. The user doesn't expect a breaking change. Why not keep the Channel name the same and clarify it in the label/description? |
I originally retained the original channel name in order to minimize the changes required and remain backwards compatible. Below are the reasons for which I ended up reconsidering to rename the existing
Despite all of the above I understand that 2.5.8 is a patch version bump and therefore should contain no breaking changes. I have a local commit which reverts to the |
I appreciate your contribution, it was also on my list. |
Travis tests were successfulHey @taboneclayton, |
1 similar comment
Travis tests were successfulHey @taboneclayton, |
Thanks for reviewing and for your comments @fwolter , @markus7017. Agree with both your comments and don't see the need to break backwards compatibility. The name of the temperature channel has been reverted to the original name |
@fwolter how do we proceed? |
If you approve the change, I'd do so, too. |
....openhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/GreeConfiguration.java
Outdated
Show resolved
Hide resolved
...penhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/handler/GreeHandler.java
Show resolved
Hide resolved
...penhab.binding.gree/src/main/java/org/openhab/binding/gree/internal/handler/GreeHandler.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.gree/src/main/resources/ESH-INF/i18n/gree.properties
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.gree/src/main/resources/ESH-INF/thing/thing-types.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.gree/src/main/resources/ESH-INF/i18n/gree.properties
Show resolved
Hide resolved
bundles/org.openhab.binding.gree/src/main/resources/ESH-INF/i18n/gree.properties
Show resolved
Hide resolved
bundles/org.openhab.binding.gree/src/main/resources/ESH-INF/i18n/gree_DE.properties
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.gree/src/main/resources/ESH-INF/i18n/gree_DE.properties
Outdated
Show resolved
Hide resolved
Travis tests were successfulHey @taboneclayton, |
2 similar comments
Travis tests were successfulHey @taboneclayton, |
Travis tests were successfulHey @taboneclayton, |
Also updated PR description to match the most current list of changes. |
@taboneclayton Please sign you code updates
as comment to the push |
<parameter name="currentTemperatureOffset" type="decimal" step="0.5" required="true" unit="C"> | ||
<default>-40</default> | ||
<unitLabel>Degrees Celsius</unitLabel> | ||
<advanced>true</advanced> | ||
</parameter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's intuitive if configuring an offset of 0, would result in an offset of +40°C. Can you subtract the internal offset in the code, so an offset of 0 is really 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the idea here is that the device returns the data with a 40 degree offset. But that value 40 is not guaranteed. So therefor this parameter is there correct that. If it would always be 40 this offset would not be needed or maybe could be a boolean. To switch between 40 and 0 in case there is no offset. So it very much depends if the 40 is fixed or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this was the exact reasoning behind it. On the Gree devices which I have installed at home, the offset is that of +40°C. So the offset required for calibration for this particular device is actually -40 and not 0.
Judging from online research this seems to be the case with the majority of devices but I cannot vouch for that since new models might behave differently.
The idea for this configuration parameter was that other devices might come with an offset which is different from +40°C. So the idea was that the binding would offset exactly by the amount which is specified in this parameter and not make any assumptions other than setting the default at -40 which seems to be the most common at the time.
If for some other Gree device, the offset is +30°C, the required value here would be -30 and not +10.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markus7017 you as the codeowner, WDYT? Are you aware of any device type that has a different offset than -40°C?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, as you said it seems that all devices have an offset of 40°C. Having this offset configurable would allow the user to do adjustment when the temp is really 1°C off etc., which is a useful feature.
We have no proof that there are other offsets than 40°. Therefore I would make this assumption and do the math in the binding. In case a device has something != 40, this is adjustable as a work around. We could then decide how to model this (e.g,. by a different thing type), but so far I don't see this scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I favor
- keeping the parameter, but as normalized offset
- hard code the -40 as constant in the code
So 0 means 0 for the user, but -40 for the binding, 1=-39, -2=-42 etc.
@taboneclayton it might me that 0.5 steps are supported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@taboneclayton From my point of view this is the only open issue. Could you change it that way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated as suggested. I think this should address all requests for changes. However there is a merge conflict in thing-types.xml
due to the introduction of spotless. Don't want to merge from upstream to avoid problems. Should I rebase to resolve the conflict?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes do rebase and git push --force-with-lease
back to GitHub.
Also do run mvn spotless:apply
on your binding to make sure your changes also comply with the style, otherwise it might break the build of your binding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Travis tests were successfulHey @taboneclayton, |
234f746
to
4be7258
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It might be sufficient to only run mvn spotless:apply
.
…h is available on GREE AC devices. New channel name is currentTemperature. To avoid confusion between target and current temperature, the old channel has been renamed from temperature to targetTemperature. Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
…red to match placement of strings between DE and EN. Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
- Moved developer-related information from README to code. - Moved hardcoded default value for current temperature offset to a constant value Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
- Renaming GREE_PROP_TEMP_SENSOR to GREE_PROP_CURRENT_TEMP_SENSOR - Simplified description for currentTemperatureOffset label Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
…ameter Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
…w an internal constant within the plugin and the external config parameter defaults to 0 degrees celsius. The sensor reading is then being added to the internal offset and the config parameter offset to come up with the final value. Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
…R_OFFSET Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
d222860
to
c009648
Compare
Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
c009648
to
50bf3e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good for me
@taboneclayton Good job! :-) |
@taboneclayton I tried the version with the merged PR. currentTemperatur shows -40°C for my unit. |
Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
Signed-off-by: Clayton Tabone <taboneclayton@gmail.com>
New Feature/Improvement
Added a new channel called "currentTemperature" which maps to the temperature sensor which is present on GREE AC devices. This should allow for the addition of rules which are based on the actual room temperature, Eg: switch on AC in heating/cooling mode if room temperature is higher/lower than X. This temperature sensing channel can also be used to control other features like ventilation, etc by comparing the indoor and outdoor temperature. This usually requires a dedicated temperature sensor for reading the indoor temperature and such temperature is readily available in GREE AC devices and readable over this binding with the help of this PR.
### Breaking Change!TheThis binding which was only recently introduced already contained a temperature channel called "temperature". This was meant to be able to set the desired/target temperature on the AC device. In order to avoid any confusion between the desired/target and actual/current temperature channels, the old existing channel has been renamed from "temperature" to "targetTemperature".
temperature
channel name has been reverted to the original naming so no breaking changes.Additional Notes:
This is my first contribution to openHAB so please make sure that everything is in order.
I am not 100% sure if I messed up any character encoding in the il8n strings.The character encoding has been modified from UTF8 to ISO 8859-1. Also, my proficiency in the German language is very limited so certain translation strings might require some improvements.Static code analysis passes successfully and the changes have been tested locally on openHAB versions 2.5.7 and 2.5.8 running on Rasbian Buster on a Raspberry Pi 3.