String does not match the pattern of "DEPRECATED

I get this error from Visual Studio code for this row:

          service_template: switch.turn_'{{ "off" if brightness == 0 else "on" }}'

String does not match the pattern of “DEPRECATED^”.yaml-schema: http://schemas.home-assistant.io/configuration

  - platform: template
    lights:
      Smart_plug_1:
        friendly_name: 'Smart Plug 1'
        value_template: '{{ states.switch.525736102462ab171e7c.state }}'
        turn_on:
          service: switch.turn_on
          entity_id: switch.525736102462ab171e7c
        turn_off:
          service: switch.turn_off
          entity_id: switch.525736102462ab171e7c
        set_level:
          service_template: switch.turn_'{{ "off" if brightness == 0 else "on" }}'
          entity_id: switch.525736102462ab171e7c

service_template is no longer needed. Also, remove the single quote in front of the template and place it before switch.

          service: 'switch.turn_{{ "off" if brightness == 0 else "on" }}'
1 Like

thanks! :+1: :+1: :+1:

Hi guys.

Same error for me. Can you help me please ?

sensor:
  - platform: template
    sensors:
      cover_auto_open:
        friendly_name: "Ouverture des volets à"
        value_template: '{{ (as_timestamp(states.sun.sun.attributes.next_rising) + (states("input_number.cover_day_offset") | int)  * 60)  | timestamp_custom("%H:%M") }}'
        entity_id: [sun.sun, input_number.cover_day_offset]
        icon_template: mdi:clock
      cover_auto_close:
        friendly_name: "Fermeture des volets à"
        value_template: '{{ (as_timestamp(states.sun.sun.attributes.next_setting) + (states("input_number.cover_night_offset") | int)  * 60)  | timestamp_custom("%H:%M") }}'
        entity_id: [sun.sun, input_number.cover_night_offset]
        icon_template: mdi:clock

The error is for the line with entity_id

Thanks :slight_smile:

Just delete the entity id line

Thanks petro.

If i delete those lines will this continue to work ?

@Flo35 yes

It works thanks :wink:

I have the same issue but on other lines; can you please help me as well?

- platform: template
  sensors:
    energy_total:
      friendly_name: 'Total Energy'
      entity_id:
        - sensor.shelly_bv1_power
        - sensor.shelly_bv2_power
        - sensor.shelly_bv3_power
      value_template: "{{ (states('sensor.shelly_bv1_power')|float + states('sensor.shelly_bv2_power')|float + states('sensor.shelly_bv3_power')|float)|round(3) }}"
      unit_of_measurement: "W"

Solved!
The entity_id is no longer needed.

https://community.home-assistant.io/t/the-entity-id-option-is-deprecated-please-remove-it-from-your-configuration/227764/3?u=thelordvader

I get the same error in vscode with my mqtt sensors but can’t find a solution. The MQTT server works, the topics contain values.


sensor.yaml:

MQTT platform is being deprecated in 2022.9.

Check out the breaking change here: 2022.6: Gaining new insights! - Home Assistant

2 Likes