[DEPRECATED] wx-ApiXU-driver

What about people who live in extreme northern latitudes where it doesn’t get dark all summer, or short winter daylight.. They probably want to poll lux 24 hrs a day.

Yeah, that's why I clarified it by saying when lux is 5.

It won’t know that unless it polls to check. It’s always dark ( or light ) if you don’t open your HA eyes (poll).

Good banter, but I didn't ask for eyes shut (no polling), just more sleep (less polling when dark).

Hi @csteele
It's 10am here in the UK and again Lux is showing 5.
From the logs there is no Lux check happening.
Before I save the preferences again is there anything else you want me to check.
EDIT: Sorry it looks like it's doing its 5 minute check but no result is happening.

Same thing happened here this morning too. I saved preferences and it went back to normal.....thought it was just me.

I am testing that idea of reduced polling when lux is low and while it's working, it also means I have extra debugging added.

dev:10 2019-06-29 08:36:40.314 am debug Lux: 4052, 300
dev:10 2019-06-29 08:36:40.291 am info  wx-ApiXU lux calc for: 90001
dev:10 2019-06-29 08:36:39.661 am info  wx-ApiXU poll for: 90001
dev:10 2019-06-29 08:31:40.288 am debug Lux: 3936, 300
dev:10 2019-06-29 08:31:40.279 am info  wx-ApiXU lux calc for: 90001
dev:10 2019-06-29 08:21:40.084 am debug Lux: 3704, 300
dev:10 2019-06-29 08:21:40.075 am info  wx-ApiXU lux calc for: 90001
dev:10 2019-06-29 08:11:39.904 am debug Lux: 3471, 300
.
,
,
dev:10 2019-06-29 02:06:40.443 am debug Lux: 5, 1800
dev:10 2019-06-29 02:06:40.426 am info  wx-ApiXU lux calc for: 90001
dev:10 2019-06-29 02:06:39.678 am info  wx-ApiXU poll for: 90001
dev:10 2019-06-29 01:36:40.508 am debug Lux: 5, 1800
dev:10 2019-06-29 01:36:40.468 am info  wx-ApiXU lux calc for: 90001
dev:10 2019-06-29 01:36:40.401 am info  skip wx-ApiXU forecast precip
dev:10 2019-06-29 01:36:40.378 am debug Lux: 5, 1800

What I did notice is that the Current State column of the driver was showing: illuminance : 5

Logs showed the correct value (non 5) and yet the display on the driver page was old. I clicked the browser's refresh and it became correct. I didn't need to hit save preferences.

Sorry @bobbles, I think 10am UK time is 2am to me.

Yes, when debug logs auto disable (30 min) then the messages get very terse. You're seeing the message saying Lux is being calculated but it's true, the result isn't shown in the logs. The info message is new, and the result has always been shown in the Current States column.

In other words, letting you know that Lux is occurring is new, the result remains where its always been.

Said another way... you're going to know that the lux calculation occurred because you didn't get 1) an Error (a programming error) or 2) you didn't get: "no wx-ApiXU lux without sunRiseSet value."

I've continued the experiment with reducing Lux calculations based on extremely low level... it seems to be working correctly. I guess the obvious next question is, does anybody actually want this :smiley:

dev:10 2019-06-29 10:36:39.784 pm debug Lux: 5, 1800
dev:10 2019-06-29 10:36:39.775 pm info  wx-ApiXU lux calc for: 90001
dev:10 2019-06-29 10:06:40.359 pm info  skip wx-ApiXU forecast precip
dev:10 2019-06-29 10:06:40.338 pm debug Lux: 5, 1800
dev:10 2019-06-29 10:06:40.326 pm info  wx-ApiXU lux calc for: 90001
dev:10 2019-06-29 10:06:39.585 pm info  wx-ApiXU poll for: 90001
dev:10 2019-06-29 09:51:40.137 pm debug Lux: 5, 1800
dev:10 2019-06-29 09:51:40.128 pm info  wx-ApiXU lux calc for: 90001
dev:10 2019-06-29 09:41:39.942 pm debug Lux: 8, 300
dev:10 2019-06-29 09:41:39.932 pm info  wx-ApiXU lux calc for: 90001
dev:10 2019-06-29 09:36:40.639 pm info  skip wx-ApiXU forecast precip
dev:10 2019-06-29 09:36:40.636 pm debug Lux: 8, 300

I've got my normal Lux repeat at 5 mins (300 seconds) and the test is for Lux less than 6... aka 5 which changes the repeat to 30 mins (1800 seconds).

1 Like

As @halfrican.ak I think alluded - any tidying up of code and reduction in polling for the same outcome, would be appreciated. :+1:t2:

2 Likes

Released v1.2.1 with:

  • Made repeating updateLux() run slower at night with lowLuxEvery.
  • Converted Cobra's updateCheck to Async.

It's in the 1.2 series.. make sure you understand the potential for breaking automations that occurred with 1.2.0

There's a new option:

26%20PM

It defaults to "don't change" - meaning the driver works the same as before. No matter what your selection, click Save Preferences to initialize the option.

1 Like

Are you seeing any LUX issues today? We had thunderstorms come through and the LUX value stayed pegged at 4200 when the LUX outside was probably more like 800. Happens on both your drivers and @bangali’s driver.

im getting this

click Save Preferences to initialize the option.

I'm not seeing Lux issues here. I haven't seen a cloud all day either :smiley:

In broad sweeping terms.. Lux is (lux from APIXU) adjusted by (cloud cover from APIXU)

It's not going to respond to a cloud passing overhead, and I don't know what they specify their accuracy to be... if they specify at all. If the Reporting Stations that feed into your Response are slow, then so will the calculation. :slight_smile:

Done that, I updated from the mini driver where I had to use %20 in the middle of my post code could that be it?

Re-Import 1.2.1 hf1, please.

I've noticed for a few mornings in a row that the lux does not update from 5.0. I've also been having high response times in my HE (logged via NodeRed). The only recent driver change is from the old bangali driver to this, so wondering if anyone else having similar issues?

Edit: I updated to latest version, still 5.0 lux. Switched back to Bangali's driver, and lux updated to 8500 immediately.

if you turn on debugging and click Save Preferences, a lot of logs show.. but pretty much at the end is this:

dev:16 2019-06-30 08:17:53.282 pm debug condition: 1000 | condition text: Sunny | condition factor: 1 | lux: 42
dev:16 2019-06-30 08:17:53.278 pm debug between sunset and twilight
dev:16 2019-06-30 08:17:53.253 pm info wx-ApiXU lux calc for: 90001

Says it's entering Lux Calc.. and then based on time of day it decides between the 5 times of day and displays that. Lastly it details the components of the equation. Sunny, no clouds (1%) and lux after cloud factor = 42,

Obviously your time of day is different, but the ONLY case where lux is forced to be 5 is the last time of day:

	else if (!timeOfDayIsBetween(twilight_begin, twilight_end, localTime))      {
		if (debugOutput) log.debug "between non-twilight"
		lux = 5l

(notice it's: NOT timeOfDayIsBetween... )

I'm wondering if.. for your lat/long, the Sunrise/sunset values are not "ready" at 12:10:23AM It shouldn't make a lot of difference since day to day, those times shift a couple of minutes.

Lux is relying on the values stored in:

Are yours "close enough"?

@csteele

Latest version of driver went "nuts" on me last night, was polling lux constantly until I set the "night time lux interval" to other than "don't change". I am using 30 min interval by default so perhaps that tripped up the night/day interval calculation?

Edit: good news is that even though I was noticing some slowish automations it didn't bring the hub to it's knees like it would have if it were not for Async polling. :wink:

1 Like