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

Bindings with several classes with the same thing action scope #17785

Open
5 tasks
lolodomo opened this issue Nov 22, 2024 · 14 comments
Open
5 tasks

Bindings with several classes with the same thing action scope #17785

lolodomo opened this issue Nov 22, 2024 · 14 comments
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@lolodomo
Copy link
Contributor

It is not allowed to have several classes with the same thing action scope.
Here are the bindings not respecting this rule:

  • caddx
  • deconz
  • freeboxos
  • hue
  • openwebnet
@lolodomo lolodomo added the bug An unexpected problem or unintended behavior of an add-on label Nov 22, 2024
@clinique
Copy link
Contributor

I assume the correct way is like it is done in max for example ? "max-cube", "max-device"... ?
Will provide a fix for freeboxos

@clinique
Copy link
Contributor

Well @lolodomo , while I was on it I did it all.

@lolodomo
Copy link
Contributor Author

Note that changing the scope is a breaking change for users.

For hue binding for example, I believe one is for API v1 and the other for API v2. @andrewfg can you please confirm.
We could then decide to not change the scope for the second and only change the scope of the first. Users of API v1 are now probably less than API v2.

@lolodomo
Copy link
Contributor Author

@clinique : bindings README should be updated as the new scope has to be mentioned for each action.

@clinique
Copy link
Contributor

This seems a bit counter-intuitive, I thought getActions was defined:
getActions(String bindingId, String thingUid)

but it's
getActions(String scope, String thingUid)

It's fine when there's only one action class that can define scope = bindingID

then for Caddx it would give:
val actions = getActions("caddx-zone","caddx:zone:thebridge:zone4")

correct ?

@lolodomo
Copy link
Contributor Author

Yes, that's my understanding.

@lolodomo
Copy link
Contributor Author

Please make a test with freeboxos binding for example to confirm.

@clinique
Copy link
Contributor

I use rebootPlayer and rebootServer in Freeboxos, thus they had the same some and it used to work fine.

@lolodomo
Copy link
Contributor Author

lolodomo commented Nov 22, 2024

It is not allowed to have several classes with the same thing action scope.

This information is coming from @J-N-K . Please comment and confirm to avoid making useless changes.

@andrewfg
Copy link
Contributor

andrewfg commented Nov 22, 2024

I believe one is for API v1 and the other for API v2. @andrewfg can you please confirm

Yes. I think that is the case. I agree that if we should 'break' something, it should be rather in v1 than v2. But let me check in detail tomorrow..


EDIT: I confirm the above.

@lolodomo
Copy link
Contributor Author

lolodomo commented Nov 23, 2024

I use rebootPlayer and rebootServer in Freeboxos, thus they had the same some and it used to work fine.

That's a good reason I would prefer to have first a GO from @J-N-K before applying these breaking changes.

@lolodomo
Copy link
Contributor Author

For information, the only binding currently using different scopes is the max binding.

@lsiepel
Copy link
Contributor

lsiepel commented Nov 23, 2024

Slighlty offtopic; i'm implementing some actions for the telegram binding and want to use an array as parameter. It's not working, might be something different. But the question is if i can find some documentation on allowed/supported parameters.

The method with this signature does not show up in main UI (4.3.0M4) as other methods do. I don;t see a problem with the scope, the method name is unique

    @RuleAction(label = "send a test message", description = "Send a Telegram using the Telegram API.")
    public @ActionOutput(label = "Success", type = "java.lang.Boolean") boolean sendTelegramTo(
            @ActionInput(name = "chatIds") @Nullable Long @Nullable [] chatIds,
            @ActionInput(name = "message") @Nullable String message,
            @ActionInput(name = "replyMessageId") @Nullable Integer replyMessageId,
            @ActionInput(name = "silent") @Nullable Boolean silent,
            @ActionInput(name = "messageThreadId") @Nullable Integer messageThreadId,
            @ActionInput(name = "args") @Nullable Object... args) {

@lolodomo
Copy link
Contributor Author

The type of your parameters chatIds and args are not supported by Main UI.

The supported types are listed in this PR:
openhab/openhab-core#4392

String, boolean, Boolean, byte, Byte, short, Short, int, Integer, long, Long, float, Float, double, Double, Number, DecimalType, QuantityType<?>, LocalDateTime, LocalDate, LocalTime, ZonedDateTime, Date, Instant and Duration

Ps how a variable list of java Object could be...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

No branches or pull requests

4 participants