Light based on lux, and multisensor 6

Hi,

I have this script

  • alias: ‘Turn off light in alrum, based on lux’
    trigger:
    platform: time
    minutes: ‘/1’
    seconds: 00
    condition:
    condition: and
    conditions:
    - condition: numeric_state
    entity_id: sensor.aeotec_zw100_multisensor_6_luminance_11
    above: ‘300’
    action:
    • service: light.turn_off
      entity_id: group.alrumlys
    • service: light.turn_off
      entity_id: group.kokkenlys
    • service: light.turn_off
      entity_id: group.ganglys

My problem is that the lux device from aeon multisensor 6 only updates once a hour.

When sun is setting, the lux level would naturally be much higher than the current level, because the lux level can be 59minutes old.

How can i only run my script if the lux sensor is updated less than 5 minutes ago?

Another nice thing would be that the light isn’t turned off, if it has been turned on in lets say the last 60minutes.

Can Anyone point me in the right direction?

If you can use USB, you can change the reporting interval to be faster.

I can’t, and really don’t won’t to “spam” my z-wave network to often.

Once a hour is fine, i just need my lux script to take that into account.

So i just need to know how i made a condition that looks on last updated time.

Like
‘condition: lux.sensor’
last updated < 5min

Here is something you can play with, as it will tell you the number of seconds from “now” since the luminance was last changed:

as_timestamp(now()) - as_timestamp(states.sensor.aeotec_zw100_multisensor_6_luminance_11.last_changed)

Use the value_template for this. Something like:

condition: template
value_template: ' {{ as_timestamp(now()) - as_timestamp(states.sensor.aeotec_zw100_multisensor_6_luminance_11.last_changed) < 300 }}'

I use the same sensor on batteries and changed it to report every 15 minutes in the configuration > z-wave > node config options (I think you need to shorten the wakeup interval too) and still get reasonable battery life. I can’t tell you how long because I didn’t really keep track… but, regardless of what approach you use with you automation this should help improve things.