Skip to content

Conversation

clinique
Copy link
Contributor

@clinique clinique commented Sep 18, 2025

Early push to inform that work has started
Resolves issue #16852

Signed-off-by: clinique <gael@lhopital.org>
@clinique clinique requested a review from magx2 as a code owner September 18, 2025 12:46
import com.google.gson.Gson;

/**
* @author Martin Grzeslowski - Initial contribution
Copy link
Contributor

Choose a reason for hiding this comment

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

You are the author of this class, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

@magx2
Copy link
Contributor

magx2 commented Sep 18, 2025

Hey, thanks for the implementation of v6. I had a quick look on my cellphone, tommorow I will take a deeper look at it (using my pc and IDE).

@clinique
Copy link
Contributor Author

Thanks for you insights @magx2 . This is very early dev stage. My main concern is to find the equivalences between old API and the new one (I'm a recent user of Pi-hole). If there are not much, maybe I'll introduce a new Thing with a distinct channel set. Let me know your thoughts.

Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: clinique <gael@lhopital.org>
@clinique clinique added the work in progress A PR that is not yet ready to be merged label Sep 18, 2025
@clinique clinique self-assigned this Sep 18, 2025
@clinique
Copy link
Contributor Author

@magx2 : I'm on a good track. Still searching equivalencies for some of the channel contents (null values line 88 of bundles/org.openhab.binding.pihole/src/main/java/org/openhab/binding/pihole/internal/rest/JettyAdminServiceV6.java).
After that, I'll have to take care of 'sid' refresh and some code cleansing.

*/
@NonNullByDefault
public interface AdminService {
public abstract class AdminService {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you make it a class? i do not see any logic added

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it shares properties (and 1 method) between the two versions of the AdminService

*/
@NonNullByDefault
public class PiHoleHandler extends BaseThingHandler implements AdminService {
public class PiHoleHandler extends BaseThingHandler {
Copy link
Contributor

Choose a reason for hiding this comment

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

Making AdminService a class required you to remove implements from here. It's not perfect cause adding new methods to JettyAdminService will not require you to expose those methods here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not see any obvious reason to expose these methods here. They are still available to actions.

}

return null;
return PI_HOLE_TYPE.equals(thingTypeUID)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not happy with this change. Adding more handlers will require you to get back to previous approach

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll revert.

<label>Server Version</label>
<description>Defines the API to be used with this server.</description>
<default>v5</default>
<advanced>true</advanced>
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure it should be advanced? By default it will not be visible for the user

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They intent is not to bring any change to existing installations, but I can remove the advanced option for sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

Removing advanced will not change current installations, it will only make it easier for new installations

* @author Martin Grzeslowski - Initial contribution
*/
@NonNullByDefault
public class JettyAdminServiceTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't forget to add tests for your service

Code review corrections.

Signed-off-by: gael@lhopital.org <gael@lhopital.org>
Signed-off-by: gael@lhopital.org <gael@lhopital.org>
@lolodomo lolodomo added the enhancement An enhancement or new feature for an existing add-on label Oct 4, 2025
@miloit
Copy link
Contributor

miloit commented Oct 16, 2025

Any updates? @clinique

@clinique
Copy link
Contributor Author

Hello @miloit , this PR is ready for review

@magx2
Copy link
Contributor

magx2 commented Oct 17, 2025

Hello @miloit , this PR is ready for review

OH, I thought you are still working on it. Will take a look on it later this week

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 work in progress A PR that is not yet ready to be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants