Light Template Assistance

I have some pool lights that I control via the Pentair integration. The integration has a light entity, which is little more than a switch. I can set the color of the lights by calling a service and passing two values. I’m trying to configure a light template to be able to configure the different color modes as light effects, but I’m really struggling as templating is a bit advanced for me.

Here is an action from a working automation I have configured

  action:
  - service: screenlogic.set_color_mode
    data:
      color_mode: color_swim
    target:
      device_id: 5f3822b93d2f4c0d3ddef83d22838361

I’m looking at the light template documentation, but I cannot for the life of me figure out how to configure effects. I have a working light template that simply sets the color_mode to color_swim as the power on action, but I would really like to be able to set effects via the effects drop down in Lovelace, and then be able to call this light from other automations.

  - platform: template
    lights:
      pentair_lights:
        friendly_name: Pool Lights
        value_template: "{{ states('light.pool_lights')}}"
        turn_on: 
          - alias: "Color Swim"
            service: screenlogic.set_color_mode
            data:
              color_mode: color_swim
            target: 
              device_id: 5f3822b93d2f4c0d3ddef83d22838361
        turn_off: 
          service: light.turn_off
          entity_id: light.pool_lights

I don’t know if i can help you (& i need to go out in a minute). But why aren’t you using the “light.turn_on” “service call”? It should work as you are using the “light.turn_off” service call.

Any assistance is appreciated!

I will once I figure out how to set the effects. This is just temporary so that when I turn on the light it sets my favorite color_mode, and to prove that I can call a service in the light template.

I actually had it setup with light.turn_on initially before I realized that I couldn’t figure out the effects. Once I have the effects working I will most definitely switch back to light.turn_on

different lights have different effect’s, they aren’t defined by HAss but by the manufacture (but HAss needs to support them).

{{ state_attr ( 'light.hallway_light' , 'effect_list') }}

will give you the effect list for an entity.
But you can also get the effects from the Developers Tools > States

That’s why I turned to light templates. Unfortunately this integration’s (Pentair) light entities do not have any HASS effects. The only way to set the “effect” is by calling a service. Another user suggested that I should look into using a light template. The idea was to create a custom effect as part of the light template that was comprised of a script.

What sort of effect’s do you want to apply?

Doesn’t this work with the light.turn_on service call?

  - service: light.turn_on
    data:
      color_mode: color_swim

These lights are really wonky. The Pentair controller sets the color mode by toggling power on the lights with a set time interval (there is no data wire from the controller to the light, only hot and ground). I’m assuming this is the reason that the Pentair integration’s light entity in HASS doesn’t have selectable “effects”, but rather requires you to create automations that call a service to set the color mode. There’s a list of color modes that I can get by going to dev tools > services and pulling up the screenlogic.set_color_mode service and looking at the drop down under color_mode. There are a few dozen of them.

I could create separate scripts / automations and button entities, but I would really rather have it function as a traditional light entity with effect properties. I was hoping there was a way to do this with light templates.

The right way to fix this would be for the devs to update the Pentair entity to use light entity “effects” as opposed to using a service to program the light.

Doesn’t this work with the light.turn_on service call?

  - service: light.turn_on
    data:
      color_mode: color_swim

That doesn’t work. I have to call a custom service called screenlogic.set_color_mode

I would probably be doing it with a script & A input_select (dropdown helper). set the input_select with A list of pre defined effects you want (words), & have the one script look @ that & decide which part of the script to run for the different effects via a choose function.
I did something similar: Another Light Blueprint Script but it uses the light.turn_on so it won’t work for you, but do the same thing.