How to trigger a "read value"?

Hi forum

I’m trying to implement a “reset button” that triggers a reset of simulation values in my weather station. Basically the “reset” works fine (correct command is send) but the last set values stay displayed in the browser. If I now change any of these values the last displayed value is used again (seems to come frome a cache). A real reset is only done if I save my item-file again - than all values are set back to 0.

Is there any possiblity to trigger the “read value” mechanism of openhab?

Thx & Regards

You could clear the items with a rule when the reset command is sent.

Thx @steve1 but this not yet clear to me. What do mean with “clear the items”?

The answer may depend on which bindings are bound to the items whose states you want to reset, and also what you specifically mean by “reset.” Do you have a rule or “pseudocode” that helps explain what you want to happen, and what is actually happening?

Used binding is KNX.

Neither rule nor pseudocode is used.

My weather station provides various simulation parameters (e.g. rain = on/off, speed of wind in m/s = 12m/s) for testing purpose. After testing it makes sense to “reset” all values of the simulation paramters in order to avoid problems with the next test scenario. For that reason one can send an “ON” to an reset item of the weather station and this resets the mentioned simulation parameters.

The reset is working fine but the state update of the simulation parameters in openhab is not working. I can manually send a read-request of an affeceted item via KNX then the state is set updated correctly in openhab. Since I’m using 15 parameters for 8 different house fronts it’s pretty annoying to updated every item manually.

As far as I understand it I need a meachnism which can actively send a read request for the affected items. How can I do that?

Thanks & Regards

Maybe you could define a group item WeatherGroup that contains all items you want to reset, and then send that or another item ResetWeather a command and have a rule to interact with each item. It’s written partially because I don’t know all the details.

rule ResetWeatherItems
  Item ResetWeather received command
  WeatherGroup.members.foreach[ item | item.sendCommand(whatever_you_send_to_trigger_a_read_request) ]

Exactly this is my problem - I don’t know HOW to trigger a read request so that the items get updated :smile:

Sorry being that complicated.

What do you do manually to update each item? I don’t see in the KNX binding code any explicit way to force a fresh read, but there are KNX binding experts lurking here who might know how that is possible, or if there is a feature that could be added for your scenario.

In the KNX programming software (ETS 4) one can select a group address (=item in openhab) and send actively a read (=update value) or write (=set new value) request. In my case I would need same functionality in openhab to actively read the status of the affected items.

Or, just coming into my mind: if I have changed some of this simulation parameters, then have send a “reset” and saving my item-file again, all values are displayed correctly after the reload.
The question is - what happens while all items are newly loaded so that the values are displayed correctly and can I use this functionality anyhow?


It would be great if a KNX expert could join in here, in order to avoid having to resort to tedious workarounds like reloading the items file. As someone who doesn’t know anything about KNX, it would seem more correct that if the value has changed somewhere on the KNX side, it ought to be reported soon thereafter to the KNX binding in openHAB, without the need to force a read or other workarounds. My usefulness in that discussion ends here, I’m afraid! :frowning:

There’s no way to request a Bus-Read for KNX yet, so the only way to really “request” is to put the affected items in one .items-File and touch this file in case of Reset.

Another way would be to set an autoRefresh for the DPTs, unfortunatly I didn’t use this feature yet, I don’t know the exact way to configure and it’s not in the wiki yet. Anyhow this would result in periodical read-requests for all affected DPTs.

Thank you anyway. I really appreciate your time and thoughts to help me. :smile:

Since my last posting I was already thinking in the same direction. In another thread we were discussing something similiar.

Maybe this approach can be used for touching the affected items. Will give it a try.

Cool, wasn’t aware that KNX that feature. Do you have any hint where I can get further information?

Thanks & Regards

Yes, didn’t find the information in first place, but it is in the wiki:

knx="[<[(< autoRefresh>)]][< dptId>:]< mainGA>"

so knx="<(60)1.001:1/2/3" would read from GA1/2/3 every 60 Seconds with DPT 1.001 (I didn’t test this)

But I tested it :wink: And it’s working for all items except my simulation parameters…strange. Will do some further testing.

Thank you @Udo_Hartmann

It seems an on-demand read request is still not supported. The autoRefresh is not an acceptable solution in many cases.
Is there already an issue for this feature? I couldn’t find one.

Why do you need a read request at all?

I need an up-to-date light value. The value is put on the bus by a sensor every 5 minutes, but at certain times I need an actual value instead of the value of up to 5 minutes ago.

EDIT: ok, just tested in ETS with changing light values, but the value remains the same anyway until the sensor does an update. So this won’t solve my problem.
I’ll leave the story below for whoever is interested :slight_smile:

Why? I’ll explain. It’s quite a story, so bear with me :slight_smile:
I have a stairway with 4 presence sensors on 4 floors, which also measure lux. I use the average over those 4 values to determine the Twilight state. Below a certain threshold, say 10 lux, the Twilight switch goes on, and if the average value goes over 10 lux, the switch goes off again. This switch is used to determine whether the lights in the stairway need to go on or not if there is movement (every floor has its own light).
Now the thing is, if it’s dark, and Twilight is set, and there is movement, a light goes on. Now the measured light value at 1 sensor increases, say with 45 lux. Even if the other 3 values are at 0 lux, the average is still above 10, and the Twilight switch goes off, and the light doesn’t turn on anymore if there is movement.
I solved this by decreasing the total light value from all 4 sensors by a certain value for every light that is turned on. So for example with 1 turned on light in total darkness I have the total value 0+0+0+45 lux. 1 light is on, so I decrease with 45 lux, and the total is 0 again. Twilight stays on.
But now there is still a problem: the light values aren’t actual. If a light value update was posted when the light was on, this value will remain on e.g. 45 lux, even after the light is turned off. Since the light is off, there is no compensation, resulting in an average value of more than 10 lux, and the Twilight switch goes off.

I hope I made my problem clear :slight_smile:
The next best thing I can do at this point is increase the rate in which the sensor puts light values on the bus, but I don’t like spamming the bus with useless telegrams (most of the time, the values are the same anyway). There is no option in the sensor to withhold a periodic update if the value is the same as the previous. It is possible to send an update if the value changes with a certain absolute amount, for example 25 lux. But the problem here is that lux has a logarithmic scale so in daylight the value changes are much larger than in twilight. The light value may change with hundreds of lux in seconds. So you end up continuously sending light values on the bus, which is even worse.

So in the end, the best solution is an on demand read.

I would suggest not to use the lightness sensor value at all, if the relevant light is switched on, but I guess this would not solve the problem.

I’d need a “read value” trigger for KNX group addresses too. The reason is my KNX MDT shutter actor (MDT JAL-0810.02). It sends the position only after the movement has finished. Thus, in openhab the shutter position is only updated at the end of a movement. Direct feedback, e.g. a changing shutter icons during movement is what I want.
Normally the position could be periodically read using:
{ knx="<(1):30/2/101" }
but this would flood the KNX bus.

The actor provides a moving status bit which then can be used to start polling the current position from the shutter.
Some ideas how to achieve that are very welcome.