Filtering a config object within a node that uses it

I have a config object that is used to store/select a list of different types of IoT devices. I also have a set of specific nodes for each type of IoT device

I would like to know, is it possible to filter the devices dropdown to only shows the devices that have a productId that is specific to the node that use it. This is to prevent the user selecting the wrong device type within the configuration of a particular node type.

e.g: openThings-pir.html contains:

<script type="text/javascript">
    RED.nodes.registerType('openThings-pir', {
        category: 'Energenie 314RT',
        color: '#de348c',
        defaults: {
            name: { value: "Motion Sensor" },
            device: { type: "openThings-device", required: true },

And openThings-device.html contains:

<script type="text/javascript">
    RED.nodes.registerType('openThings-device', {
        category: 'config',
        defaults: {
            name: { value: "MiHome Device" },
            productId: { required: true },
            product: { value: "Select device from dropdown", required: false },
            deviceId: { required: true },
            control: { value: "Unknown", required: false }

e.g. in my pir node I want to do is only display PIR devices in the dropdown (ie. ones that have a node-config-input-device-productId == 12 ). In my switch socket node i only want switch sockets, etc...

Hi @Achronite,
If I'm not mistaken the node->configNode link is a many-to-1 relation. So a node can have 1 config node, but a single config node can be shared across multiple nodes. If I am correct, that would be a problem for your setup?
I have always thought that a node can get access to a config node, but not the other way around (since it can be shared between multiple nodes). But I can be mistaken...

Hi @BartButenaers I don't believe that I am trying to do anything unusual in selecting which config applies to the node. I just want the list of configs to be filtered first, so that only the config items that apply can be selected from the dropdown. So in the example below I don't want the option to select the Motion Sensor, I only want the Radiator Valves to be shown.


As it stands, there's no way to filter that list.

But I can see the value in being able to do so. Have added an item to the backlog for this.

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