Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse SmartHome » Non existing item for dynamic channel
Non existing item for dynamic channel [message #1737037] Tue, 05 July 2016 09:01
Lukasz Dywicki is currently offline Lukasz DywickiFriend
Messages: 33
Registered: July 2009
I started working on new bacent binding and I have dynamic list of channels. Bacnet is quite abstract, there is network, device and it's properties. I mapped network to bridge, device to thing and properties to channels. I'm not sure if I've done that properly cause I fetch bacnet device properties when related ThingHandler.bridgeHandlerInitialized method is called.
In same method I start thread which fetch present values and post channel updates, but these are ignored:
2016-07-05 10:50:26.673 [DEBUG] [home.core.internal.items.ItemUpdater] - Received update for non-existing item: Item 'bacnet_device_2251_0_ANALOG_VALUE_34' could not be found in the item registry

(gist with same code
    public void bridgeHandlerInitialized(ThingHandler thingHandler, Bridge bridge) {
        if (thingHandler instanceof BacNetBridgeHandler) {
            this.client = ((BacNetBridgeHandler) thingHandler).getClient();

            BacNetDeviceConfiguration configuration = getConfigAs(BacNetDeviceConfiguration.class);
            // hardcode network number temporary to 0
            this.device = new Device(, configuration.ip, configuration.port, 0);
            final List<Property> deviceProperties = client.getDeviceProperties(device);
            List<Channel> channels = new ArrayList<>();
            for (Property property : deviceProperties) {
                ChannelUID channelUID = new ChannelUID(getThing().getUID(),
                        property.getType().name() + "#" + property.getId());
                ChannelBuilder builder = null;
                switch (property.getType()) {
                    case ANALOG_INPUT:
                        builder = ChannelBuilder.create(channelUID, BacNetBindingConstants.CHANNEL_ANALOG_INPUT);
                    case ANALOG_OUTPUT:
                        builder = ChannelBuilder.create(channelUID, BacNetBindingConstants.CHANNEL_ANALOG_OUTPUT);
                    case ANALOG_VALUE:
                        builder = ChannelBuilder.create(channelUID, BacNetBindingConstants.CHANNEL_ANALOG_VALUE);
                    case BINARY_VALUE:
                        builder = ChannelBuilder.create(channelUID, BacNetBindingConstants.CHANNEL_BINARY_VALUE);
                    case BINARY_OUTPUT:
                        builder = ChannelBuilder.create(channelUID, BacNetBindingConstants.CHANNEL_BINARY_OUTPUT);
                if (builder == null) {
                    logger.warn("Unsupported type of property {}", property.getType());
                        .withProperties(ImmutableMap.of("id", Integer.toString(property.getId())));
            ThingBuilder thingBuilder = editThing().withChannels(channels);

            executor.scheduleAtFixedRate(new Runnable() {

                public void run() {
                    for (Property<?, Object> property : deviceProperties) {

                        String uid = property.getType().name() + "#" + property.getId();
                        // if (isLinked(uid.getAsString())) {
                        Object value = client.getPropertyValue(property);

                        if (value instanceof Integer) {
                            updateState(uid, new DecimalType((Integer) value));
                        } else if (value instanceof Boolean) {
                            updateState(uid, ((Boolean) value) ? OnOffType.ON : OnOffType.OFF);
                        } else if (value instanceof Float) {
                            updateState(uid, new DecimalType((Float) value));
                        } else {
                  "Unsupported return type {} for property {}", value, property);

            }, 0, 30, TimeUnit.SECONDS);

Do I miss anything in my code to get linking done? In GUI these channels are displayed properly:
Previous Topic:issue about applying proguard to binding
Next Topic:Channels not yet linked when initialize() method of handler is called?
Goto Forum:

Current Time: Sat Nov 17 07:22:17 GMT 2018

Powered by FUDForum. Page generated in 0.02518 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top