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

[miio] Add support for BT Gateway switch on chuangmi.plug.212a01 #11657

Merged
merged 6 commits into from
Nov 29, 2021

Conversation

marcelrv
Copy link
Contributor

Signed-off-by: Marcel Verpaalen marcel@verpaalen.com

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
@marcelrv marcelrv added the enhancement An enhancement or new feature for an existing add-on label Nov 28, 2021
Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
Comment on lines 126 to 127
public static JsonElement getJsonElement(String element, JsonElement responseValue)
throws ClassCastException, IllegalStateException {
Copy link
Member

Choose a reason for hiding this comment

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

You'd better know before accessing it if it's the right type in the right state. Catching these is bad.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe I'm overly causious here.. as the responsevalue is something that comes from the device and can have rather unexpected values I normally rather have a friendly message than an ugly stacktrace.

That said, I think the code indeed has little chance to generate these errors even in case of strange inputs so i'll remove it

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
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 c6798ea into openhab:main Nov 29, 2021
@fwolter fwolter added this to the 3.2 milestone Nov 29, 2021
@marcelrv marcelrv deleted the miio-chanplug branch November 29, 2021 12:24
@wborn wborn changed the title [miio] add support for BT Gateway switch on chuangmi.plug.212a01 [miio] Add support for BT Gateway switch on chuangmi.plug.212a01 Dec 18, 2021
NickWaterton pushed a commit to NickWaterton/openhab-addons that referenced this pull request Dec 30, 2021
…nhab#11657)

* [miio] add support for BT Gateway switch on chuangmi.plug.212a01

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] improve conversion & add test for it

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] add one empty string test

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove unnessesary exceptions

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] add one more test for different inputs

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] typo

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
Signed-off-by: Nick Waterton <n.waterton@outlook.com>
mischmidt83 pushed a commit to mischmidt83/openhab-addons that referenced this pull request Jan 9, 2022
…nhab#11657)

* [miio] add support for BT Gateway switch on chuangmi.plug.212a01

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] improve conversion & add test for it

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] add one empty string test

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove unnessesary exceptions

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] add one more test for different inputs

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] typo

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
Signed-off-by: Michael Schmidt <mi.schmidt.83@gmail.com>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this pull request Jan 28, 2022
…nhab#11657)

* [miio] add support for BT Gateway switch on chuangmi.plug.212a01

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] improve conversion & add test for it

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] add one empty string test

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove unnessesary exceptions

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] add one more test for different inputs

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] typo

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
volkmarnissen pushed a commit to volkmarnissen/openhab-addons that referenced this pull request Mar 3, 2022
…nhab#11657)

* [miio] add support for BT Gateway switch on chuangmi.plug.212a01

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] improve conversion & add test for it

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] add one empty string test

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove unnessesary exceptions

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] add one more test for different inputs

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] typo

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this pull request May 5, 2022
…nhab#11657)

* [miio] add support for BT Gateway switch on chuangmi.plug.212a01

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] improve conversion & add test for it

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] add one empty string test

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove unnessesary exceptions

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] add one more test for different inputs

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] typo

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
andan67 pushed a commit to andan67/openhab-addons that referenced this pull request Nov 6, 2022
…nhab#11657)

* [miio] add support for BT Gateway switch on chuangmi.plug.212a01

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] improve conversion & add test for it

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] add one empty string test

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove unnessesary exceptions

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] add one more test for different inputs

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] typo

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
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.

None yet

2 participants