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

[hue] Added channel to enable / disable a motion sensor #8721

Merged

Conversation

cweitkamp
Copy link
Contributor

Added channel to enable / disable a motion sensor

Closes #8389

Signed-off-by: Christoph Weitkamp [email protected]

@cweitkamp cweitkamp added the enhancement An enhancement or new feature for an existing add-on label Oct 10, 2020
case CHANNEL_ENABLED:
configUpdate.setOn(OnOffType.ON.equals(command));
break;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

For other channels, I think you have to call the parent class (which handle few other channels).

Copy link
Contributor Author

@cweitkamp cweitkamp Oct 11, 2020

Choose a reason for hiding this comment

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

On the first glance, yes, but currently the presence sensor only has read-only channels thus no command has to be handled except this one.

break;
}

hueBridge.updateSensorConfig(sensor, configUpdate);
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be moved in your switch case.

@lolodomo
Copy link
Contributor

@cweitkamp
Copy link
Contributor Author

@lolodomo Thanks for your comments. I saw the superfluous check and thought about an improvement too. Problem is that StateUpdate uses a builder pattern to add more values. If we set it to null initially we have to add an even more complex logic inside the switch - case elements which will reduce readability of the code.

Copy link
Contributor

@cpmeister cpmeister left a comment

Choose a reason for hiding this comment

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

LGTM

@cpmeister
Copy link
Contributor

Looks like you need to run spotless.

Signed-off-by: Christoph Weitkamp <[email protected]>
@cweitkamp cweitkamp force-pushed the feature-8389-hue-sensor-deactivation branch from e074c52 to 9137064 Compare October 16, 2020 08:47
@cpmeister cpmeister merged commit 02963b8 into openhab:main Oct 16, 2020
@cpmeister cpmeister added this to the 3.0.0.M2 milestone Oct 16, 2020
@cweitkamp cweitkamp deleted the feature-8389-hue-sensor-deactivation branch October 17, 2020 06:56
boehan pushed a commit to boehan/openhab-addons that referenced this pull request Apr 12, 2021
* Added channel to activate/deactivate a motion sensor
* Applied spotless

Signed-off-by: Christoph Weitkamp <[email protected]>
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this pull request May 5, 2022
* Added channel to activate/deactivate a motion sensor
* Applied spotless

Signed-off-by: Christoph Weitkamp <[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.

[hue] Support activation/deactivation of motion sensor
3 participants