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

3 Likes

I’ve got the same problem as well, three places in my configuration.yaml.

Here are the first two:

*String does not match the pattern of “DEPRECATED^” appears at the end of each of the two lines in the code snippet below which are “- service: input_text.set_value”.

(I have an api call updating “input_text.weewx_last_array_data” from a different device on the same network as HA - which makes the rest of the changes take place in said sensor below.)

template:
  - trigger:
      - platform: state
        entity_id: input_text.weewx_last_array_data
    action:
      - service: input_text.set_value
        data:
          value: "{{ states('input_text.latest_weewx_receipt') }}"
        target:
          entity_id: input_text.previous_weewx_receipt
      - service: input_text.set_value
        data:
          value: >
            {% set ts = trigger.to_state.state %}
            {% set ts = ts[:15:] + " " + "{}".format(now().year) %}
            {% set time = strptime(ts, "%b %d %H:%M:%S %Y") %}
            {% set str = time.strftime('%a %-m/%-d %-I:%M:%S%p') %}
            {% set indx = str.find("M") %}
            {% set oldstr = str[indx-1:indx+1] %}
            {{ str.replace(oldstr,oldstr.lower()) }}
        target:
          entity_id: input_text.latest_weewx_receipt
    sensor:
      - name: "Weewx last array data formatted"
        state: "{{ states('input_text.latest_weewx_receipt') }}"
        unique_id: weewx_last_array_data_formatted

and here is the third, same *String does not match the pattern of “DEPRECATED^” appears after the base_url line:

http:
# This is needed for IFTTT
  base_url: https://(external url for my HA instance is here, but removed for this post)

base_url was deprecated a long time ago

that’s most likely the wrong error, it’s saying service is no longer the standard, you can use service or action but apparently VSCode only likes action now.

1 Like

Thank you @petro , all cleaned up on my end thanks to you!

Thank you!