How to stop DMX thing from updating item?

I have my lights running using an Art-Net LED dimmer.
I’m using the DMX binding to get a color thing in openHAB.

This is my .things file:

Bridge dmx:artnet-bridge:wohnzimmer_artnet "Wohnzimmer ArtNet Bridge" @ "Wohnzimmer" [ mode="unicast", address="192.168.0.208", universe=0 ] {
    color wohnzimmer_licht_rgb "Wohnzimmer Licht RGB" @ "Wohnzimmer" [dmxid="33/3", fadetime=0, dimtime=0]
}

I have bound a Color item to this thing in my .items file through a channel:

Color LivingRoomLightColor "Wohnzimmer Licht Farbe" <colorlight> (gLivingRoomLight, gLight, gMapDb) [ "Light", "Control" ] {channel="dmx:color:wohnzimmer_artnet:wohnzimmer_licht_rgb:color"[profile="system:follow"], alexa="Color"}

From my understanding the [profile="system:follow"] should make the item update the thing, but ignore updates from the thing to the item (however I’ve testet it with and without it and it seems to make no difference).

Whenever I update the item (through clicking on a color in the main UI), I can see a log output like this:

2024-06-24 21:38:36.111 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'LivingRoomLightColor' predicted to become 123,54,33
2024-06-24 21:38:36.113 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'LivingRoomLightColor' changed from 316.957,54.76200,32.941 to 123,54,33
2024-06-24 21:38:36.139 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'LivingRoomLightColor' changed from 123,54,33 to 240.000,46.47800,27.843
2024-06-24 21:38:36.141 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'LivingRoomLightColor' changed from 240.000,46.47800,27.843 to 163.043,54.76200,32.941
2024-06-24 21:38:36.143 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'LivingRoomLightColor' changed from 163.043,54.76200,32.941 to 122.608,54.76200,32.941

Sometimes it is even worse and it updates itself multiple times from a single click:

2024-06-24 21:38:38.083 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'LivingRoomLightColor' received command 212,54,33
2024-06-24 21:38:38.083 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'LivingRoomLightColor' predicted to become 212,54,33
2024-06-24 21:38:38.085 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'LivingRoomLightColor' changed from 122.608,54.76200,32.941 to 212,54,33
2024-06-24 21:38:38.117 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'LivingRoomLightColor' changed from 212,54,33 to 125.712,35.59200,23.137
2024-06-24 21:38:38.120 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'LivingRoomLightColor' changed from 125.712,35.59200,23.137 to 212.609,54.76200,32.941
2024-06-24 21:38:38.288 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'LivingRoomLightColor' received command 212,55,33
2024-06-24 21:38:38.289 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'LivingRoomLightColor' predicted to become 212,55,33
2024-06-24 21:38:38.291 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'LivingRoomLightColor' changed from 212.609,54.76200,32.941 to 212,55,33
2024-06-24 21:38:38.316 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'LivingRoomLightColor' changed from 212,55,33 to 211.915,55.95200,32.941
2024-06-24 21:38:40.127 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'LivingRoomLightColor' received command 211,56,33
2024-06-24 21:38:40.129 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'LivingRoomLightColor' predicted to become 211,56,33
2024-06-24 21:38:40.130 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'LivingRoomLightColor' changed from 211.915,55.95200,32.941 to 211,56,33

So the DMX binding is applying some dimming to the output it send out to the wire (which is nice), but is also sending back this information to the item (which is undesired in my case).

How can I prevent these updates from the thing to the item?

That’s not what the follow profile does at all. The follow profile will send a command to another Channel when the linked Channel updates the Item, so that the other device “follows” the state changes if the first device.

You don’t, at heart I can’t think of a way to. Maybe you can request a modification to the binding not to send these intermediate updates to the Item. Outside of that, the Item is going to reflect the state it’s been updated to.

I do suggest disabling autoupdate on the Item (item metadata option). This will prevent OH from predicting the new state of the Item based on the command and instead wait for the binding to update it instead. That will prevent that initial update to the predicted target value.

I’m general, if the device provides updates at all, autoupdate should be disabled so the Item only ever reflects the actual state of the device and not a predicted value.

On Items | openHAB #profiles it states for the “follow” profile:

… In the direction from the ThingHandler towards the Item, this Profile ignores state updates.

This sentence lead me to believe that it may do what I’m trying to achieve.

I’ve now created a simple JS transformation which should just log the value and then return null which should discard the update.

.items file

Color LivingRoomLightColor "Wohnzimmer Licht Farbe" <colorlight> (gLivingRoomLight, gLight, gMapDb) [ "Light", "Control" ] {channel="dmx:color:wohnzimmer_artnet:wohnzimmer_licht_rgb:color"[profile="transform:JS", toItemScript="everythingToNull.js"], alexa="Color"}

/transform/everythingToNull.js

(function(i) {
    const { log } = require("openhab");
    const logger = log("everythingToNull.transform");

    logger.info(`input: ${i}`);

    return null;
})(input)

Now I went to the thing in main UI at
http://myopenhabinstance/settings/things/dmx:color:wohnzimmer_artnet:wohnzimmer_licht_rgb/links/LivingRoomLightColor/color
and changed the values.

I could see the same behavior with the thing and item as before.
I could not see any log output in openhab.log which makes me believe that the profile is not used at all. Am I missing something to have the profile being used?

Yes, the profile is being used if it gets activated. When a script transform returns null, the original untransformed item update gets sent to the Item.

There is no way I know of to suppress an update to an Item from a Channel. You can modify it but not eliminate it entirely. The Item will be updated with something if the Channel issues an update.

That won’t trigger the profile. Profiles exist on the Item Channel Link. It only gets activated by the Item (if there is an “Item command to Thing” or “Item state to Thing” config) or by the Channel (default config, “Thing to Item”). You can not activate it through the REST API.

The documentation at Transformations | openHAB states:

A null return value will cause the input to be discarded and not propagated to the destination.

That should suppress the update in my understanding.

My understanding was that I’m changing the values of the thing here. When I change the values, I see the change reflected in the real world and on the item.

You can’t change the value of a Channel. Channels don’t have values. Channels generate events and those events are transmitted through the link to the item.

Please let me jump into that for a question/remark for clarification.
I know that the main purpose is that multiple devices follow a leading item. But if you use it with only one item linked to a channel and set it to “follow” you get what the OP wanted. I use that for my irrigation where the duration is set back frequently by the binding to a default value (which is unwanted).

OK, well I guess I’m wrong on most of the fronts here. I hope you can help OP with this since I can’t seem to.

Not sure if I can help. The definition looks right to me but I haven’t used text files for item definitions for quite some time.

@wertzui Wasn’t the profile just defined with [profile=“follow”]?
And I would try without the Alexa metadata to avoid any possible bouncing source.

1 Like

According to the items documentation it should be system:follow.
According to the transformation documentation it should be follow.

I tried both and also removed the Alexa metadata.
It made no change.

One thing I noticed while testing is that no matter which profile I set up in the .items file, it does not show up in the UI which shows the binding between the thing and the item at http://myopenhapinstance/settings/things/dmx:color:wohnzimmer_artnet:wohnzimmer_licht_rgb/links/LivingRoomLightColor/color
It just always stays at Standard.

that’s a good example why I switched to UI-defined items: No more searching for the correct syntax

After some time, I decided to give it another go today.
I updated my OpenHAB installation to 4.2.2 and guess what?
Using [profile="system:follow"] now does exactly what the documentation stated:
I suppresses all updates from the Thing to the Item.
It now also correctly shows up in the UI.

So I guess this was a bug that got fixed somewhere between 4.1.2 and 4.2.2.