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

[speedtest] Binding for Ookla's Speedtest - Initial contribution #9913

Merged
merged 48 commits into from Apr 7, 2023

Conversation

bigbasec
Copy link
Contributor

The goal of this binding was to create an easy to setup speedtest option. It's fairly low frills, though should work with very limited interaction outside of the main ui.

Does require the installation of Ookla's speedtest though has been tested on Linux, Windows and openHabian without issue.

Jar file : https://github.com/bigbasec/openhab-addons/releases/download/v0.4/org.openhab.binding.speedtest-3.1.0-SNAPSHOT.jar

@wborn
Copy link
Member

wborn commented Jan 22, 2021

It might be an idea to merge any missing functionality into the speedtest thing that is already part of the Network Binding. 🤔

See: https://www.openhab.org/addons/bindings/network/#thing-configuration

@bigbasec
Copy link
Contributor Author

That is all covered in the post on the forum. I didn't do that for a reason.

@Hilbrand Hilbrand added the new binding If someone has started to work on a binding. For a new binding PR. label Jan 22, 2021
@MikeTheTux
Copy link
Contributor

Successfully tested under Linux running OH3.0.1 in a Docker using v0.5

@Skinah Skinah changed the title [speedtest] OH3 Initial Speedtest Binding [speedtest] Speedtest Binding - Initial contribution Jun 25, 2021
@Skinah Skinah changed the title [speedtest] Speedtest Binding - Initial contribution [speedtest] Binding for Ookla's Speedtest - Initial contribution Jun 25, 2021
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/oh3-and-speedtest-ookla/124721/25

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/speedtest-cli-by-ookla-internet-up-downlink-measurement-integration/94447/106

@Skinah
Copy link
Contributor

Skinah commented Oct 3, 2021

@bigbasec When you have completed going over the suggestions please post that you have finished and want someone to take a look.

@lsiepel
Copy link
Contributor

lsiepel commented Jan 24, 2023

As I can see there are some comments to be addressed and a conflict to be resolved I'm updating review status.

Think everything is addressed now.

Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

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

Thank you for this new binding. I have provided a few comments mostly towards the documentation.

There are some compiler warnings to check. There are also some checkstyle warnings left. You could take a look at target/code-analysis/report.html.

@openhab/add-ons-maintainers - I could use a second pair of eyes on the approach of requiring software installation on the host OS and calling an executable.

bundles/org.openhab.binding.speedtest/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.speedtest/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.speedtest/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.speedtest/README.md Outdated Show resolved Hide resolved
bundles/org.openhab.binding.speedtest/README.md Outdated Show resolved Hide resolved
<channel-type id="triggerTest" advanced="true">
<item-type>Switch</item-type>
<label>Trigger Test</label>
<description>Trigger in order to run Speedtest manually</description>
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a stateless channel? In this case you could apply this policy:

Suggested change
<description>Trigger in order to run Speedtest manually</description>
<description>Trigger in order to run Speedtest manually</description>
<autoUpdatePolicy>veto</autoUpdatePolicy>

See https://www.openhab.org/docs/developer/bindings/thing-xml.html#auto-update-policies

Copy link
Contributor

@MikeTheTux MikeTheTux Mar 5, 2023

Choose a reason for hiding this comment

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

veto would be one possiblity to keep the state to OFF even when receiving the ON command.

Right now it is implemented in a way, that the framework sets the state to ON and the binding sets the sate back to OFF after the test was executed:

        if (ch.equals(SpeedtestBindingConstants.TRIGGER_TEST)) {
            if (command instanceof OnOffType) {
                if (command == OnOffType.ON) {
                    getSpeed();
                    updateState(channelUID, OnOffType.OFF);
                }
            }
        }

@jlaur, is there a preferred solution?

Copy link
Contributor

@jlaur jlaur Mar 8, 2023

Choose a reason for hiding this comment

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

Not that I'm aware of, I think both are valid solutions, and in both cases I believe you need to handle concurrent state changes (i.e. receiving ON while a speed test is already in progress).

MikeTheTux and others added 3 commits March 5, 2023 09:01
Signed-off-by: Michael Weger <weger.michael@gmx.net>
Signed-off-by: Michael Weger <weger.michael@gmx.net>
@MikeTheTux
Copy link
Contributor

There are some compiler warnings to check. There are also some checkstyle warnings left. You could take a look at target/code-analysis/report.html.

@jlaur, compiled it in an OH4.0.0 environment and report.html contains zero findings.

Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

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

It looks already quite nice! 👍
I also added a few minor comments.

@jlaur
Copy link
Contributor

jlaur commented Mar 12, 2023

@openhab/add-ons-maintainers - I could use a second pair of eyes on the approach of requiring software installation on the host OS and calling an executable.

@wborn - thanks for joining the review, can you help with input here?

@wborn
Copy link
Member

wborn commented Mar 12, 2023

can you help with input here?

What kind of input?

We already have some other add-ons that require software installation and that create processes to use this software:

@jlaur
Copy link
Contributor

jlaur commented Mar 12, 2023

can you help with input here?

What kind of input?

We already have some other add-ons that require software installation and that create processes to use this software:

That kind of input. 🙂 Thanks! I just needed confirmation that having such requirements is fine/acceptable.

Signed-off-by: Michael Weger <weger.michael@gmx.net>
Signed-off-by: Michael Weger <weger.michael@gmx.net>
Signed-off-by: Michael Weger <weger.michael@gmx.net>
Signed-off-by: Michael Weger <weger.michael@gmx.net>
@jlaur
Copy link
Contributor

jlaur commented Apr 2, 2023

@bigbasec - there are three compiler warnings left to fix:

Warning:  /home/runner/work/openhab-addons/openhab-addons/bundles/org.openhab.binding.speedtest/src/main/java/org/openhab/binding/speedtest/internal/SpeedtestHandler.java:[164,39] Potential null pointer access: this expression has a '@Nullable' type
Warning:  /home/runner/work/openhab-addons/openhab-addons/bundles/org.openhab.binding.speedtest/src/main/java/org/openhab/binding/speedtest/internal/SpeedtestHandler.java:[174,36] Potential null pointer access: this expression has a '@Nullable' type
Warning:  /home/runner/work/openhab-addons/openhab-addons/bundles/org.openhab.binding.speedtest/src/main/java/org/openhab/binding/speedtest/internal/SpeedtestHandler.java:[175,13] Potential null pointer access: this expression has a '@Nullable' type

I'll comment one of them with a proposed solution.

Signed-off-by: Michael Weger <weger.michael@gmx.net>
Signed-off-by: Michael Weger <weger.michael@gmx.net>
Signed-off-by: Michael Weger <weger.michael@gmx.net>
Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

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

Thanks again for your contribution, @bigbasec and @MikeTheTux. LGTM!

Now, you could add your binding's logo to the openHAB website. See https://www.openhab.org/docs/developer/bindings/#add-your-binding-s-logo-to-the-openhab-website

@jlaur jlaur merged commit 86f829f into openhab:main Apr 7, 2023
3 checks passed
@jlaur jlaur added this to the 4.0 milestone Apr 7, 2023
FordPrfkt pushed a commit to FordPrfkt/openhab-addons that referenced this pull request Apr 20, 2023
…nhab#9913)

Also-by: Brian Homeyer <bhomeyer@gmail.com>
Signed-off-by: Michael Weger <weger.michael@gmx.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new binding If someone has started to work on a binding. For a new binding PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants