Automation - switch on lights for 5 seconds

Hi,
In our bathroom we have a fan that is connected to lights, so whenever lights are switch on the fan kicks in. The fan itself has a timer so after the lights are switched off it will continue running for about 30 minutes. We also have a BLE humidity sensor. This works great most of the time and keeps the humidity below 60%. However in the winter time when the window is closed humidity is often above 70% and we have to manually start the fan or open windows.

I have now fitted a micro-switch behind the light/fan switch and I am trying to put together an automation that will:

  1. trigger when the humidity is above 70%
  2. condition - check that the lights were off for 30 minutes
  3. action (this is where I am stuck) - switch the lights on for 5 seconds? How do I do that?

Can someone point me in the right direction?
Thanks

So far I have this:

alias: "Bathroom - Humidity control "
description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - sensor.ble_humidity_gvh5075_403a
    from: "70"
condition:
  - condition: state
    entity_id: switch.bathroom_lights
    state: "off"
    for:
      hours: 0
      minutes: 30
      seconds: 0
action: []

In the action part,

Switch on the lights
Add a delay of five minutes
Switch off the lights

If this is the case then I am not sure this is what you want as your trigger?
You are using a state trigger with a ‘from’, therefore this will only ever trigger when the state is exactly 70 and changes from 70 either upwards or downwards. It will not trigger under any other conditions (I.E. if sensor goes from 71 to 69 it wont trigger, OR 65 to 72 it wont trigger) It would have to at some point have read exactly 70 and then changed for this current trigger to work.

I think you are probably looking for a numerical trigger something like this:

  - platform: numerical_state
    entity_id: sensor.ble_humidity_gvh5075_403a
    above: "70"

This will trigger each and every time the sensors reading goes from any value below 70 to any value above 70.