Hi, I have this code in configuration.yaml and it works.
mqtt:
sensor:
- name: "Potencia"
state_topic: "inversor/max"
unit_of_measurement: "W"
json_attributes_topic: "inversor/max"
value_template: "{{ value_json.potenciaactivasalida }}"
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
mqtt: !include sensor.yaml
but if I put this code inside sensor.yaml it gives me an error
the code
sensor:
- platform: mqtt
unique_id: Potencia
name: "Potencia"
state_topic: "inversor/max"
unit_of_measurement: "W"
json_attributes_topic: "inversor/max"
value_template: "{{ value_json.potenciaactivasalida }}"
and the error
Advertencias de configuración
Invalid config for 'sensor' at configuration.yaml, line 13: required key 'platform' not provided
I need help,my head is broken