-
-
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
[hue] Add channels for time of last sensor update (API v2) #15552
Conversation
67919f7
to
c1598f6
Compare
Small note (to self / @andrewfg): Consider trying to figure out when |
c1598f6
to
41cac0f
Compare
@jlaur I will study this in more detail over the weekend, but I already have some quick suggestions..
EDIT: @jlaur as this PR has increased in scope from your original concept, I am happy to take over the coding, if you prefer. Please let me know. EDIT 2: probably the 'camera-motion' sensor could be coded in OH as the same channel as current 'motion' sensor; the advantage of doing that would be that we could reduce the total number of channels in OH things. WDYT? |
41cac0f
to
db9457a
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.
- It is inconsistent to implement this xxx-report model only for motion and temperature sensors. You should implement it for light-level, button, and relative-rotary sensor channels as well.
- Last week Philips Signify introduced their range of home security products, and consequently they added new resource types for camera-motion, contact and tamper security sensors. These also use the xxx-report model. The full support for those new resource / things should not be added in this PR, but please consider if there is anything necessary in this PR in order prepare the foundations for that subsequent PR to come.
- So I suggest the DTOs for motion-report, temperature-report, button-report, light-level-report, relative-rotary-report, tamper-report, contact-report, camera-motion-report etc. should all descend from a common base-sensor-report class that implements the updated resp. changed JSON field. Note: I don't know why some sensor DTO's use updated and others use changed field names, but apparently they are synonyms, so the base class could deserialize both these alternate field names as one actual class field.
...b.binding.hue/src/main/java/org/openhab/binding/hue/internal/dto/clip2/LightLevelReport.java
Show resolved
Hide resolved
bundles/org.openhab.binding.hue/src/main/resources/OH-INF/update/instructions.xml
Show resolved
Hide resolved
...enhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/dto/clip2/MotionReport.java
Show resolved
Hide resolved
....binding.hue/src/main/java/org/openhab/binding/hue/internal/dto/clip2/TemperatureReport.java
Show resolved
Hide resolved
...ng.hue/src/main/java/org/openhab/binding/hue/internal/serialization/InstantDeserializer.java
Show resolved
Hide resolved
@jlaur see the following post from March this year.. https://hueblog.com/2023/03/14/hue-bridge-update-brings-back-popular-feature/ |
...b.binding.hue/src/main/java/org/openhab/binding/hue/internal/dto/clip2/LightLevelReport.java
Outdated
Show resolved
Hide resolved
...b.binding.hue/src/main/java/org/openhab/binding/hue/internal/dto/clip2/LightLevelReport.java
Outdated
Show resolved
Hide resolved
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 have just created #15601 to add support for security devices. And #15602 to fix the deprecated DTOs for button
and relative_rotary
sensors. They both depend on some underlying infrastructure that I am expecting to be introduced in this PR (e.g. the BaseReport
class).
@jlaur can you please look at #15601 and #15602 to give you an idea what I am counting on?
Thanks, I was unaware of these. I managed to refactor
See above.
See above. I see you already created a draft PR. I will have a look at that also to make sure I get it right. I already noticed that button is a bit different since there is one report per individual button.
Agreed. |
a6b0ffc
to
e05503e
Compare
...enhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/dto/clip2/ButtonReport.java
Show resolved
Hide resolved
...enhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/dto/clip2/RotaryReport.java
Show resolved
Hide resolved
e05503e
to
12b5118
Compare
@jlaur I will only be able to look at this finally next week |
12b5118
to
f3cc301
Compare
...ab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java
Outdated
Show resolved
Hide resolved
f3cc301
to
e6a4b0b
Compare
e6a4b0b
to
541f435
Compare
@jlaur a few points..
|
I believe I responded to all comments, can you check? |
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
...ab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java
Outdated
Show resolved
Hide resolved
df61a95
to
52bf2d7
Compare
2c31252
to
95b4724
Compare
Resolves openhab#15546 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
85cd948
to
551a916
Compare
@openhab/add-ons-maintainers - a review would be much appreciated, since there's currently a moderate activity level for this binding, and additional issues waiting in line to be tackled as well. Thanks in advance. 😉 |
@openhab/add-ons-maintainers there is also a new PR #15601 to support new Hue security products that depends on this PR being merged :) |
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.
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
…5552) * Add channels for last motion/temperature sensor update (API v2) * Add channel for last light level sensor update (API v2) * Add channel for last rotary steps update (API v2) * Add channel for last button update (API v2) Resolves openhab#15546 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
This introduces new channels:
motion-last-updated
for API v2 which is equivalent to channellast_updated
for API v1 thing type 0107 (motion sensor).temperature-last-updated
for API v2 which is equivalent to channellast_updated
for API v1 thing type 0302 (temperature sensor).light-level-last-updated
for API v2 which is equivalent to channellast_updated
for API v1 thing type 0106 (light sensor).button-last-updated
for API v2.rotary-steps-last-updated
for API v2.Additionally, the
motion
/temperature
/light-level
/button-last-event
/rotary-steps
channels have been refactored to use new DTO fields with fallback to the now deprecated fields.Resolves #15546
Resolves #15599
Relevant DTO documentation
GET /resource/motion/{id} response
motion: required(object)
Deprecated. Moved to motion_report/motion.
Deprecated. Motion is valid when motion_report property is present, invalid when absent.
last time the value of this property is changed.
true if motion is detected
See https://developers.meethue.com/develop/hue-api-v2/api-reference/#resource_motion__id__get for full response.
GET /resource/temperature/{id} response
temperature: required(object)
Deprecated. Moved to Temperature_report/temperature
Deprecated. Indication whether the value presented in temperature is valid
last time the value of this property is changed.
Temperature in 1.00 degrees Celsius
See https://developers.meethue.com/develop/hue-api-v2/api-reference/#resource_temperature__id__get for full response.
GET /resource/light_level/{id} response
light: required(object)
Deprecated. Moved to light_level_report/light_level
Deprecated. Indication whether the value presented in light_level is valid
last time the value of this property is changed.
Light level in 10000*log10(lux) +1 measured by sensor. Logarithmic scale used because the human eye adjusts to light levels and small changes at low lux levels are more noticeable than at high lux levels. This allows use of linear scale configuration sliders.
See https://developers.meethue.com/develop/hue-api-v2/api-reference/#resource_light_level__id__get for full response.
GET /resource/button/{id} response
button: required(object)
Deprecated. Move to button_report/event
last time the value of this property is updated.
event which can be send by a button control
Duration of a light transition or timed effects in ms.
list of all button events that this device supports
See https://developers.meethue.com/develop/hue-api-v2/api-reference/#resource_button__id__get for full response.
GET /resource/relative_rotary/{id} response
relative_rotary: required(object)
Deprecated. Renamed to RelativeRotaryReport. Indicate which type of rotary event is received
Indicate which type of rotary event is received
A rotation opposite to the previous rotation, will always start with new start command.
amount of rotation since previous event in case of repeat, amount of rotation since start in case of a start_event. Resolution = 1000 steps / 360 degree rotation.
duration of rotation since previous event in case of repeat, amount of rotation since start in case of a start_event. duration is specified in miliseconds.
last time the value of this property is updated.
Indicate which type of rotary event is received
A rotation opposite to the previous rotation, will always start with new start command.
amount of rotation since previous event in case of repeat, amount of rotation since start in case of a start_event. Resolution = 1000 steps / 360 degree rotation.
duration of rotation since previous event in case of repeat, amount of rotation since start in case of a start_event. duration is specified in miliseconds.
See https://developers.meethue.com/develop/hue-api-v2/api-reference/#resource_relative_rotary__id__get for full response.