Random rgb_color in scene

I cannot seem to get this script to work on my TP-Link Lights. Anyone else have any issues?
Looks like the only errors I have in the logs are related to a service.
Logger: homeassistant.helpers.service
Source: helpers/service.py:128
First occurred: 6:32:08 PM (2 occurrences)
Last logged: 6:32:08 PM

Unable to find referenced entities input_boolean.motion_detection
Unable to find referenced entities automation.sense_lights_change

well, that is clear isnt it? HA notices you reference entities you dont have… your probably copied this (old) config of mine, and didnt check whether you have all entities in your own config. (or maybe even need)

Great info in this topic.

I came up with this automation.

I have 2 groups of lights and this automation alternates both groups to have different random colours to each other.
i added - ‘100’ to keep the saturation at 100 percent to get rid of weaker colours that had too much white in them, leaving me with bright and vibrant party colours.

alias: Random Light Colors all
description: ''
trigger:
  - platform: time_pattern
    seconds: /03
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: light.new_lights
    data_template:
      hs_color:
        - '{{ (range(0, 360)|random) }}'
        - '100'
      brightness_pct: 100
  - service: light.turn_on
    target:
      entity_id: light.party_lights
    data_template:
      hs_color:
        - '{{ (range(0, 360)|random) }}'
        - '100'
      brightness_pct: 100
mode: single

Here is an example of my groups of lights in configuration.yaml

light:
  - platform: group
    name: New Lights
    entities:
      - light.computer_desk
      - light.nearer_left
      - light.nearer_middle
      - light.nearer_right
      - light.further_left
      - light.further_middle
      - light.further_right
      - light.sliding_door
      - light.tasmota
      - light.bar_right
  
  - platform: group
    name: Party Lights
    entities:
      - light.bar_left
      - light.garage_door
      - light.cupboard
      - light.lower_left
      - light.lower_middle
      - light.lower_right