I’m gonna try to get the YAML for ESPHome compiled to work with two Encryption Keys. As it is the first time in my life where i touch a YAML file, if some experienced of you can check the code and help me to avoid the Error message.
Error:
INFO Reading configuration /config/esphome/slimmelezer.yaml...
Failed config
dsmr: [source /config/esphome/slimmelezer.yaml:84]
- id: dsmr_instance
[auth_key] is an invalid option for [0]. Please check the indentation.
auth_key: BC63E6ABE5AC731ABDE2190E419XXXXX
[unicast_key] is an invalid option for [0]. Please check the indentation.
unicast_key: 5A7B2641E7C4031A43FD0F0BBA1XXXXX
This is the current YAML:
---
substitutions:
device_name: slimmelezer
device_description: "Austria Smartmeter P1 module to read your smart meter"
esphome:
name: ${device_name}
comment: "${device_description}"
platform: ESP8266
esp8266_restore_from_flash: true
board: d1_mini
name_add_mac_suffix: false
project:
name: zuidwijk.slimmelezer
version: "1.0"
on_boot:
then:
- if:
condition:
lambda: return id(has_key);
then:
- lambda: |-
std::string auth_key(id(""stored_decryption_auth_key""), 32);
std::string unicast_key(id(stored_decryption_unicast_key), 32);
id(dsmr_instance).set_decryption_key(auth_key, unicast_key);
else:
- logger.log:
level: info
format: "Not using decryption key. If you need to set a key use Home Assistant service 'ESPHome: ${device_name}_set_dsmr_key'"
wifi:
networks:
- ssid: "SSID here"
password: "PW here"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: ${device_name}
ap_timeout: 15s
captive_portal:
# Enable logging
logger:
baud_rate: 0
# Enable Home Assistant API
api:
services:
service: set_dsmr_key
variables:
private_key: string
then:
- logger.log:
format: Setting private key %s. Set to empty string to disable
args: [private_key.c_str()]
- globals.set:
id: has_key
value: lambda "return private_key.length() == 32;"
- lambda: |-
if (private_key.length() == 32)
private_key.copy(id(stored_decryption_key), 32);
id(dsmr_instance).set_decryption_key(private_key);
ota:
web_server:
port: 80
uart:
baud_rate: 115200
rx_pin: D7
globals:
- id: has_key
type: bool
restore_value: yes
initial_value: "false"
- id: stored_decryption_key
type: char[32]
restore_value: yes
dsmr:
- id: dsmr_instance
auth_key: BC63E6ABE5AC731ABDE2190E419XXXXX
unicast_key: 5A7B2641E7C4031A43FD0F0BBA1XXXXX
sensor:
- platform: dsmr
energy_delivered_lux:
name: "Energy Consumed Austria"
state_class: total_increasing
energy_delivered_tariff1:
name: "Energy Consumed Tariff 1"
state_class: total_increasing
energy_delivered_tariff2:
name: "Energy Consumed Tariff 2"
state_class: total_increasing
energy_returned_lux:
name: "Energy Produced Austria"
state_class: total_increasing
energy_returned_tariff1:
name: "Energy Produced Tariff 1"
state_class: total_increasing
energy_returned_tariff2:
name: "Energy Produced Tariff 2"
state_class: total_increasing
power_delivered:
name: "Power Consumed"
accuracy_decimals: 3
power_returned:
name: "Power Produced"
accuracy_decimals: 3
electricity_failures:
name: "Electricity Failures"
icon: mdi:alert
electricity_long_failures:
name: "Long Electricity Failures"
icon: mdi:alert
voltage_l1:
name: "Voltage Phase 1"
voltage_l2:
name: "Voltage Phase 2"
voltage_l3:
name: "Voltage Phase 3"
current_l1:
name: "Current Phase 1"
current_l2:
name: "Current Phase 2"
current_l3:
name: "Current Phase 3"
power_delivered_l1:
name: "Power Consumed Phase 1"
accuracy_decimals: 3
power_delivered_l2:
name: "Power Consumed Phase 2"
accuracy_decimals: 3
power_delivered_l3:
name: "Power Consumed Phase 3"
accuracy_decimals: 3
power_returned_l1:
name: "Power Produced Phase 1"
accuracy_decimals: 3
power_returned_l2:
name: "Power Produced Phase 2"
accuracy_decimals: 3
power_returned_l3:
name: "Power Produced Phase 3"
accuracy_decimals: 3
gas_delivered:
name: "Gas Consumed"
state_class: total_increasing
gas_delivered_be:
name: "Gas Consumed Austria"
state_class: total_increasing
- platform: uptime
name: "SlimmeLezer Uptime"
- platform: wifi_signal
name: "SlimmeLezer Wi-Fi Signal"
update_interval: 60s
text_sensor:
- platform: dsmr
identification:
name: "DSMR Identification"
p1_version:
name: "DSMR Version"
p1_version_be:
name: "DSMR Version Austria"
- platform: wifi_info
ip_address:
name: "SlimmeLezer IP Address"
ssid:
name: "SlimmeLezer Wi-Fi SSID"
bssid:
name: "SlimmeLezer Wi-Fi BSSID"
- platform: version
name: "ESPHome Version"
hide_timestamp: true
Any help would be great! I’ve no more idea what to change.