Advice on creating routine for first time

I have a traditional outdoor PIR sensor, this is wired into a Zigbee switch module.
If the PIR (which is set to work in daylight too) detects somebody, the Zigbee switch goes on.
Zigbee entity is called ‘light.carport_pir’ and is turned on with motion (PIR is set to min activation time, so <1 min).

I have a Ecowitt weather station which includes a Solar Lux sensor, called ‘sensor.gw1200a_solar_lux’, once its below say 50 then it’s dark outside.

I also have a Tuya Wi-Fi LED flood light ‘light.carport_led’ connected via Tuya Local.

Can I create a automation for the PIR to trigger the LED on with a preset brightness level and colour only if the Lux is <50? Stay on for 5 mins and then go back off again.

Can this be done via the wizard, and not via YAML?
I have tried via the GUI and can successfully select ‘When’ and CarPort_PIR turned on - but I cannot seem to find the Lux sensor to set a ‘And if’ value.

Thanks in advance :slight_smile:

If the sensor’s device class is properly set by the integration, I would expect you to be able to use the Illuminance conditions… otherwise you can use a Numeric State condition (which can be found in the condition selector by search or by navigating as follows:

"By Type" Tab > "Generic" section > "Entity" option > Numeric State

When it comes to automations, nearly everything that can be done in YAML is available in the GUI Editor. But YAML is efficient, editable, and portable… you can literally copy it from here on the forum and paste it into the Automation Editor. That’s why the forum guidelines call for providing properly-formatted YAML whenever possible… the existing alternatives are slow and non-portable.


Regarding the automation… Does light.carport_pir physically control power to the bulb, or is it effectively a binary sensor that is a “light” in name only?