Hi,
I’m trying to add a new sensor in my configuration.yaml But I get the [duplicate key] error all the time. Can’t find the correct config. Does somebody has an idea? Below a screenshot, I want to add the “mqtt” sensor.
thanks, Ronald
Hi,
I’m trying to add a new sensor in my configuration.yaml But I get the [duplicate key] error all the time. Can’t find the correct config. Does somebody has an idea? Below a screenshot, I want to add the “mqtt” sensor.
thanks, Ronald
Your indentation looks wrong, please post the code formated instead of a screenshot. Use the </> button.
I can’t format the code (don’t know how to). But where can I test to put the “/”?
If you read the link.above it will tell you how to format your code.
Below the existing part:
/sensor:
/ platform: template
/ sensors:
/ solaredge_this_month_template:
/ value_template: “{{ (states(‘sensor.solaredge_energy_this_month’) | float / 1000) | round(0) }}”
/ unit_of_measurement: ‘kWh’
and the part I intend to add:
/mqtt:
/sensor:
/– state_topic: entsoe/day-ahead
/name: ‘Day-ahead-price’
/unit_of_measurement: ‘€’
/value_template: ‘{{ value_json.day_ahead_price }}’
/json_attributes_topic: entsoe/day-ahead
You are misunderstanding - you use the button in the forum, on you post before you publish it (or edit) marked </>, dont put / in your code. Please read the link I gave you.
Looks like they moved it to the settings (cog). I had been on the icon line I thought.
Does this for you.
And, it looks like this for us.
Or, you can just do the three back quotes on the line above and below yourself.
mqtt:
sensor:
– state_topic: entsoe/day-ahead
name: ‘Day-ahead-price’
unit_of_measurement: '€'
value_template: ‘{{ value_json.day_ahead_price }}’
json_attributes_topic: entsoe/day-ahead
sensor:
platform: template
sensors:
solaredge_this_month_template:
value_template: "{{ (states('sensor.solaredge_energy_this_month') | float / 1000) | round(0) }}"
unit_of_measurement: 'kWh'
Try this:
mqtt:
sensor:
- state_topic: entsoe/day-ahead
name: 'Day-ahead-price'
unit_of_measurement: '€'
value_template: '{{ value_json.day_ahead_price }}'
json_attributes_topic: entsoe/day-ahead
sensor:
- platform: template
sensors:
solaredge_this_month_template:
value_template: "{{ (states('sensor.solaredge_energy_this_month') | float / 1000) | round(0) }}"
unit_of_measurement: 'kWh'
yes, that’s it. no errors. thank you very much!
Gr, Ronald