[UPDATED] - Average All (Temperature, Humidity, Illuminance, Ambient Pressure & Motion)



Sorry Andy but this has stopped working for me today too.
I have 2 lux sensors reporting to a virtual Lux Sensor.
Spotted this earlier today.
As you can see, everything was going along nicely until it just stopped.
Logs weren't live so cannot supply more info I'm afraid.

BTW your original app is humming along nicely but I only have one lux sensor configured for it.


Ok guys thanks for the info.
I’ll try and have a look at this and I’ll add some extral logging to see if we can find where it falls over.
I have a couple of temperature devices that have been running for ages without and problems so it may be related to the driver (as each part of the app is really only a duplication of the formula for average calculation)
I’ll also go back to the original app and compare methods & processes.

@bobgodbold which driver are you using for the old app?



Your original one.
Average Virtual Illuminance Device.
V1.2.0 - Added 'Units' to events & Cleaned out old ST code

This app.

This driver


@bobgodbold @halfrican.ak

bear with me, I think I have found the issue but I intend to release a new driver and app very soon with the fix included.
It should be done very soon.



I have released new versions of:

Parent: V1.0.1
Child: V1.2.0

And I have consolidated the drivers into one device.

I have also removed the 'trend' from the drivers (which, I believe was part of the problem)

Also added to the driver code is a new attribute 'LastReportingDevice'
This will show you which of your physical sensors last reported to the app/driver

Both the driver and the app now covers 'ambient pressure' (from a weather device?)

As always, have a play and let me know if there are any problems


Do you use any Cobra apps

Well I've made it pass the 72 hour point without a failure, so things are looking much improved. Both my outside average lux and my Garage average temp have been working flawlessly using a 0 time-out in app.

Thanks for all your work on this Andy!


Thanks Mark



Ugh, failed to update again today. Wasn't running the log since everything was working so well.


Was it the illumination or temperature that failed or both?

Can you also please check the lastreporting device and make a note of which device reported last?



Up to now I’ve only really used temperature (which has been working ok for me without problems)
I’ll dig out an old aeon multisensor that I have somewhere and set that up with my weewx setup so I can get some averages.
I’ll run it for a few days to see if I have the same issue.
I’ll add some additional logging to see if I can find anything
I leave my logs open all the time so if anything shows up I’ll know.



Without touching anything else, is it possible to reboot your hub?
I want to see if that clears anything and it starts working again.



Hi Andy.
Mine stopped working yesterday morning aswell. Both the old and the new version reporting lux to different virtual lux devices failed at around the same time.
I did a reboot and this did nothing. Opened both of the apps, made a change and saved. Changed back and saved. Lux started reporting again.
Sorry but I didn't have logs running.
Looking at the device logs, the lux sensors kept reporting but the virtual lux sensor just stopped reporting. Nothing in the logs.


Just lux failed, last device was living sensor.


@halfrican.ak @bobgodbold

New version of child and driver uploaded now :slight_smile:

Child V1.3.0
Driver V1.1.0

There were a couple of variables not defined correctly (I think) which may have contributed to the issue.
I’ve sorted that now and added a bit more logging to confirm.



If this works ok then ‘average motion’ will be next. :slight_smile:



@bobgodbold @halfrican.ak

Guys, a quick question.
How often do your illumination sensors report to the app?



Every 5 minutes or if lux changes by more than 1000


So it’s not flooding the app with data then.
I thought that might have something to do with it, but obviously not



I would assume not, but keep in mind since the two sensors I'm using aren't perfectly synced the reports don't come in at exactly 5 min intervals. Usually I see one update a few seconds before the other.

I suppose a level change of 1000 lux would be fairly common during daylight hours so that might be fairly frequent. I will remove that setting so that it only reports every 5 mins regardless of level change and see if that helps any.


Updated 18/09/2018

Driver: V1.2.0
ChildApp V1.4.0

This now contains all previous fixes

Added average 'Motion'
Obviously this does not average out motion events (Motion is either active or inactive) :slight_smile:
What it does do is group motion sensors together so any motion on any sensor sets the virtual device as 'active'.
Is has a configurable delay so that when ALL motion sensors become inactive a timer starts.
When the timer runs out, the virtual device becomes 'inactive'

As always.. have a play and let me know if you find any bugs