nilsreiter / home-assistant-scenes

Nice, Hue-inspired scenes for Home Assistant
29 stars 3 forks source link

Errors when running script #14

Closed dmfrey closed 14 hours ago

dmfrey commented 1 week ago

I've setup the blueprint and I'm seeing these errors in the logs:

home-assistant 2024-11-04 20:13:23.790 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'repeat_delay' is undefined when rendering '{{ iif(repeat_delay, repeat_delay, iif(default_repeat_delay, default_repeat_delay, {})) }}'                              
home-assistant 2024-11-04 20:13:23.798 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'use_scene_brightness' is undefined when rendering '{% if use_scene_brightness %}                                                                                    
home-assistant   {{ (scene_name.b*100)|round(0, 'ceil') }}                                                                                                                                                                                                                                   
home-assistant {% elif brightness %}                                                                                                                                                                                                                                                         
home-assistant   {{ brightness }}                                                                                                                                                                                                                                                            
home-assistant {% else %}                                                                                                                                                                                                                                                                    
home-assistant   x                                                                                                                                                                                                                                                                           
home-assistant {% endif %}'                                                                                                                                                                                                                                                                  
home-assistant 2024-11-04 20:13:23.799 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'brightness' is undefined when rendering '{% if use_scene_brightness %}                                                                                              
home-assistant   {{ (scene_name.b*100)|round(0, 'ceil') }}                                                                                                                                                                                                                                   
home-assistant {% elif brightness %}                                                                                                                                                                                                                                                         
home-assistant   {{ brightness }}                                                                                                                                                                                                                                                            
home-assistant {% else %}                                                                                                                                                                                                                                                                    
home-assistant   x                                                                                                                                                                                                                                                                           
home-assistant {% endif %}'                                                                                                                                                                                                                                                                  

My HA is runnign in kubernetes and my HA configuration is stored in a github repo.

My script is configured like:

front_yard_custom_light_scene:
  alias: Front Yard Custom Light Scenes
  description: 'Hue-like scenes blueprint for Front Yard Lights'
  use_blueprint:
    path: nilsreiter/ha-scenes.yaml
    input:
      default_scene: 'Pure: Autumn gold'
      default_onlyonlights: true
      default_use_scene_brightness: true
      default_repeat_delay:
        hours: 0
        minutes: 0
        seconds: 45
      include_mode_color_temp: true
      skipgroups: false
      debug: true
      target:
        entity_id:
        - light.front_yard_bollard_1
        - light.front_yard_bollard_2
        - light.front_yard_bollard_3
        - light.front_yard_bollard_4
        - light.front_yard_spot_1
        - light.front_yard_spot_2

And it's called from an automation:

            sequence:
              - action: script.turn_on
                metadata: {}
                target:
                  entity_id: script.front_yard_custom_light_scene
                data:
                  variables:
                    scene: 'Pure: Autumn gold'

The lights do change. But that's it. They never rotate or anything else.

nilsreiter commented 4 days ago

As far as I know, the warnings come from the fact that there is no silent way of testing if a variable has been defined for the script. Since you're supplying only the scene argument when calling the script, other variables (like repeat_delay) are undefined, and the warning is given every time (you can test this with a snippet like {% if bla %}x{% else %}y{% endif %} in the template editor).

Thus, I'd ignore the warnings. The bigger problem seems to be that the lights are not changing: Could you please

dmfrey commented 4 days ago

as a test, i setup a dashboard that will just let me change the different scenes. It seems to be working fine. Those messages do appear in the logs, but don't seem to affect the operation.

I'll see if I still notice the issue of the color not changing from my automation. But I'm gonna try a different one than the Autumn Gold.

dmfrey commented 14 hours ago

I believe I'm all good now. Thanks for your help

closes #14