Check light status and turn off or on

Hi Newbee here …
I have searched through a few blueprints and can’t find what I’m looking for… Can anyone help??
Here’s what I want to do…
Using motion sensors, if motion detected and the sun is less than 11deg (getting dark) then turn the light on at a certain brightness level
I e. 17:00 - 22:00 = 100%
22:01-07:00 = 50%
Then
Check light status to make sure it’s happened
If not then repeat
After 5 mins of no movement
Turn lights off
Then check the status of the lights and repeat if not triggered

I do some of what you want

- id: 'Study Lights on via Motion'
  alias: Study Lights On via Motion
  description: Control Study Lights with Shelly Motion Detection
  trigger:
  - platform: state
    entity_id: binary_sensor.shellymotionsensor_xxxxxxxxx_motion
    to: 'on'
  condition:
    - condition: state
      entity_id: light.study_cans_current_value
      state: 'off'
    - condition: state
      entity_id: sensor.day_part
      state: 'Night'    
  action:
  - service: light.turn_on
    target:
      entity_id: light.study_cans_current_value
    data:
      brightness_pct: "{{states('input_number.brightness') | float(0)}}"
  mode: single

it uses an input number for brightness and I have a template for night morning day

template
  - name: "Day Part"
    unique_id: "Day Part"
    state: >-
      {% set state = states('sensor.time') %}
      {% if states('sensor.sunset')| as_timestamp | timestamp_custom('%H:%M') <= state < '23:59' %}
        Night
      {% elif '00:00' <= state < states('sensor.sunrise')| as_timestamp | timestamp_custom('%H:%M') %}
        Night
      {% elif states('sensor.sunrise')| as_timestamp | timestamp_custom('%H:%M') <= state < '08:00' %}
        Morning
      {% elif '08:00' <= state < '17:00' %}
        Day
      {% else %}
        Evening
      {% endif %}  

Thank you, however I’m new and not a coder so was looking for a prebuilt blueprint to install and use
Thanks a million