Filter things in Action

Hi all
Could you someone help with one question?

I have created a binding with Rule Action.
When I create rule I can select my action и fill parameters. But one of the parameters is thing which my binding realize.


Select station shoul contain thing created by my binding.

The parameter Select station is genereated by code

        final ConfigDescriptionParameter stationParam = ConfigDescriptionParameterBuilder.create(CONFIG_PARAM_NAME_STATION,

        Input stationInput = new Input(CONFIG_PARAM_NAME_STATION, String.class.getName(),
                CONFIG_STATION, CONFIG_STATION_DESCRIPTION, null, true, null, null);

It allows me to select a thing from all available things, but i need filter this list only with my things with
public static final String BINDING_ID = “yandexstation”;
public static final String THING_TYPE_ID = “station”;

I tried this code:

        List<FilterCriteria> filter = new ArrayList<>();
        FilterCriteria criteria1 = new FilterCriteria("bindingId", BINDING_ID);
        FilterCriteria criteria2 = new FilterCriteria("thingTypeId", THING_TYPE_ID);

This is not works for me, opened window this all things for select one
And when i save the rule and then try edit it I see follow
window has not any parametrs except Thing Selection and it filter and allow me to select one of my things


What do I wrong and it is possible to filter things when create a rule action and show window with all my parameters when I edit rule action?

Full code is here org.openhab.binding.yandexstation/src/main/java/org/openhab/binding/yandexstation/internal/actions/types/ at e1697ea221d50129bf1f218805d29cb4aee23e1f · d51x/org.openhab.binding.yandexstation · GitHub

Thanks in advance. Sorry for my English

It’s not clear what you use case is but the Thing is implicit in the Action. If you have two Yandex Stations you’d have two Things to represent each one. Each Thing would have its own Action. When you go to select the Action as part of the rule in the UI, you’d have two options to choose from, one for each Thing. So to choose the right station you’d choose the right Action. You wouldn’t pass the Thing to the Action.

That’s the typical way this is handled.

Now with my code I am getting this with all things when choose ‘Select Station’


but I need getting the list with only highlighted things

Again, I don’t know your use case. But also again, you select the station by selecting the Action. There is no reason to need to select the station from the Action.

If you have a Thing named FOO and another named BAR. You would select the Action yandestation:station:FOO:actionname to communicate with FOO and yandestation:station:BAR:actionname to communicate with BAR. Each Action is tied to a specific station. If you want to send a command to FOO, you’d choose the FOO Action in the first place. You wouldn’t choose the FOO Action and then select the FOO station as an argument to the Action. That’s redundant.

My use case is

I create an own action in binding and when I create a rule I want to configure action Say Text and select the desired yandex-device (respresent as thing)

and then I receive the list with all available things, but I need only things for my binding (yandexstation)

Hello Dimitri,
The config parameter context is suggestion for UI what to show to user. Sadly, there is no standardization (as far I know), of how additional criteria can be specified. The main ui has very basic selection logic which renders different forms based on value declared by your addon:

You need to verify individual parameter kinds (i.e. parameter-item, parameter-thing) to see how to influence specific contexts. I found that both thing picker and item picker control widgets have option to specify filterType property, however I see no direct use of these.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.