eventList2, triggers and notifications, triggering all the time...

Whilst not quite back in the primaeval slime of Luup ignorance, but nearing the edge of the rocks of UPnP having crossed the beach of JSON, I find that I can’t get past the tide-line eventList2 and get notifications (or triggers) to work for a new device with generic sensors…

The device (Netatmo plugin) has several children of different varieties, but the measurements in questions (pressure, noise, CO[sub]2[/sub]) I’ve chosen (perhaps unwisely) to represent as ‘generic’ sensors, there being no UPnP standard.

Only caring about UI5 compatibility (it’s what I’ve got) (and perhaps I’m being cheap) I have several entries in “eventList2” of the device JSON file for a typical child device (pressure in this case) like this:

"eventList2": [ { "id": 1, "label": { "lang_tag": "pressure_goes_above", "text": "Pressure goes above" }, "serviceId": "urn:micasaverde-com:serviceId:GenericSensor1", "argumentList": [ { "id": 1, "dataType": "i4", "name": "CurrentLevel", "comparisson": ">", "prefix": { "lang_tag":"pressure", "text": "Pressure" }, "suffix": {}, "HumanFriendlyText": { "lang_tag": "hft_pressure_goes_above", "text": "Pressure reported by _DEVICE_NAME_ goes above _ARGUMENT_VALUE_" } } ] },

This seems to generate the requisite information in the “Notifications” tab of the device, and triggers and events can be set up, apparently correctly, in the UI. But triggers or events seem to be generated on every update of the device variable “CurrentLevel”.

I had a suggestion (thanks Richard):

?which sounds promising, although I can’t find anything about it either in existing ‘documentation’ or by scanning some favourite device JSON files.

Any suggestions on what to do next would be most welcome. Thanks.

Is the value of CurrentLevel an integer value or does it have decimals? If it were to change at all (jitter for example), but you only saw it formatted as an integer…

Ah, interesting. It depends on the units setting for some sensors.
Pressure can have zero (mbar, mmHg) or two (inHg) decimal places.
noise (dB) and CO[sub]2[/sub] (ppm) are integers.

What you see is what you get as a value in this case, the formatting is specific about precision.
In any case, the Luup variable for the trigger is, of course, a string…
…so it can’t change without you seeing it.

And it WILL change. For example, a rising pressure measurement for which you want a trigger at, say, 1030 mbar, but the pressure continues rising. My understanding (previously) was that the trigger would happen as the value crosses the threshold, but then not until it falls below it and rises past it again. That seems to be how it works for other sensors?

Hello,

I can speak about at least one sensor that behaves like your description : the 4in1 from AeonLabs…
When I started with domotics and Vera, I bought a 4in1 to do my tests… and spent many hours trying to understand why on earth this **** sensor would fire scene actions at each update, when trigger limit already crossed !!!
Later, with oregon sensors, I realized this was specifically due to 4in1.

So to summarize, if you set a trigger in a scene (or any plugin depending on trigger) to fire when ‘value goes above / under xxxx’, the trigger indeed fires when you cross the value and your condition become true, but also for each update during all the time the condition remains true.

I have opened a ticket at MCV, and since they told me they ‘could reproduce the issue in their lab’ and ‘forwarded the issue to dev team’, I have got no more answer on this ! To conclude, in this case, it seems related to a vera firmware bug.

I now better understand what issue you’re raising and I’ve not heard of it with the two thermostat plugins. I would hope that temperature sensors don’t behave differently, but you could possibly test by temporarily changing a generic sensor to a temperature sensor and seeing if that makes any difference. (It would be awful if it did make a difference, but at least you would know.)

Sorry I can’t be more helpful.

watou

There ARE other children which are standard temperature devices, driven by EXACTLY the same parent code, and, bad news or good, it works in precisely the way that you would hope and expect - correctly! …

… I think the experience I just outlined above shows that this is not device firmware - there are no physical devices - but I am struggling to find anything significant between XML and JSON files for the TemperatureSensor1 device/service and the GenericSensor1 ones. I DO note that the GenericSensor1 appears to be an incomplete adaption of a LightSensor1.

More experimentation needed, perhaps.
Thanks both for your observations to date.

—[Edit: I should add that the temperature test was for a value with one decimal place, so it’s not an integer-thing]—

I was wrong bout it being in the D_.json file … It was something in the Service Definition File S_.xml file for the State variable.

But I still can’t find the documentation that I read before …

I’ve had a user report the same behaviour with Heliotrope, for what it’s worth. I’m with Theduck38 that it’s an underlying bug in LuaUPnP and whether it fires repeatedly is outside our control as plugin developers.

(Working around dodgy comparisson [sic] bugs is part of the reason why the Combination Switch exists.)

They can also use the PLEG to decide on the behavior they want.

Ah, OK. I will do a bit more tinkering. I wonder if there’s a service I can use which doesn’t do this.

(Working around dodgy comparisson [sic] bugs is part of the reason why the Combination Switch exists.)

…shameless self-publicising of your own plugins!

But, seriously, thanks for the guidance and suggested workarounds.

Bazinga!

[url=http://forum.micasaverde.com/index.php?topic=6004.0]http://forum.micasaverde.com/index.php?topic=6004.0[/url]

[tt] “norepeat”: “1”,[/tt]

in the eventList2 of the JSON file.

Curiously, I see that this appears in Heliotrope, but @futzle says she still has problems with that.

I will give it a go.

[quote=“RichardTSchaefer, post:7, topic:177068”]I was wrong bout it being in the D_.json file … It was something in the Service Definition File S_.xml file for the State variable.

But I still can’t find the documentation that I read before …[/quote]

Is this perhaps:

<stateVariable allowRepeats="yes">

as per: [url=http://forum.micasaverde.com/index.php/topic,16372.msg125268.html#msg125268]http://forum.micasaverde.com/index.php/topic,16372.msg125268.html#msg125268[/url]

Confused, now (even more) about these items [allowRepeats, norepeat] and their interactions.