#Error when using empty optional entity in Blueprint

1 messages · Page 1 of 1 (latest)

uneven crest
#

Hi,

I have an error and I've been searching for a long time. I subscribed to a service from my electricity provider that ask to reduce our power consumption during certain time periods for money. They call the entire power reduction a challenge. There is a HA integration that creates a sensor to determine the status of the process (pre-heat, reduction, completed, etc.). I have a working blueprint that check the status of the sensor and change the thermostat temperature based on it. I wanted to expand my blueprint to be able to turn off some switches, light and/or fans. Since I want it to be universal and not everyone want to turn off switch, light or fan, I want those selectors to be optional (using Default []).

Here is the input section:

input:
    thermostats_defi:
      name: Thermostats Défi
      description: Thermostats
      selector:
        target:
          entity:
            domain: climate
    switchs_defi:
      name: Switchs Défi
      description: Switchs
      selector:
        target:
          entity:
            domain: switch
      default: []
   

My action sequence code:

 - conditions:
          - condition: trigger
            id: defi_reduction
        sequence:
          - action: climate.set_temperature
            data:
              temperature: "{{ temperature_reduction_state }}"
            target: !input thermostats_defi
          - choose:
            - conditions: "{{ switch_list | count > 0 }}"
              sequence:
                - action: switch.turn_off
                  target: !input switchs_defi          

If there is no light, I have the following error: Message malformed: expected a dictionary for dictionary value @ data['actions'][0]['choose'][3]['sequence'][1]['choose'][1]['sequence'][0]['target']
That points to the !input that is left empty.

Can you help me solve this?

spiral radish
#

I think you need to use default: {} not []

uneven crest
#

I'll try that.