Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bringing slimmelezer-be.yaml up to date #34

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 62 additions & 8 deletions slimmelezer-be.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,69 @@ substitutions:

esphome:
name: ${device_name}
platform: ESP8266
esp8266_restore_from_flash: true
board: d1_mini
name_add_mac_suffix: false
project:
name: zuidwijk.slimmelezer
version: "1.2"
version: "2.0"
on_boot:
then:
- if:
condition:
lambda: return id(has_key);
then:
- lambda: |-
std::string key(id(stored_decryption_key), 32);
id(dsmr_instance).set_decryption_key(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'"

esp8266:
restore_from_flash: true
board: d1_mini

wifi:
# remove leading '#' and fill in your wifi details
# remove leading '#' and fill in your wifi details !!
# ssid: !secret wifi_ssid
# password: !secret wifi_password

# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: ${device_name}

# Powersaving for brownout due to 250mA restriction P1
output_power: 14dB

captive_portal:

# Enable logging
logger:
baud_rate: 0
# logs:
# component: ERROR

# 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);

# Enable Over-the-Air updates
ota:
platform: esphome

dashboard_import:
package_import_url: github://zuidwijk/dsmr/slimmelezer-be.yaml@main
Expand All @@ -44,10 +80,21 @@ uart:
rx_pin: D7
rx_buffer_size: 1700

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
max_telegram_length: 1700

# For Luxembourg users set here your decryption key
#decryption_key: !secret decryption_key // enable this when using decryption for Luxembourg; key like '00112233445566778899AABBCCDDEEFF'

sensor:
- platform: dsmr
energy_delivered_tariff1:
Expand Down Expand Up @@ -105,18 +152,25 @@ sensor:
active_energy_import_maximum_demand_last_13_months:
name: "Peak 13 Month Maximum Quarterly Demand"
icon: mdi:chart-sankey
water_delivered:
name: Water delivered
icon: mdi:water
- platform: uptime
name: "${device_name} Uptime"
name: "SlimmeLezer Uptime"
- platform: wifi_signal
name: "${device_name} Wi-Fi 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 Belgium"
# timestamp:
# name: "Timestamp"
electricity_tariff:
name: "DSMR Tariff"
message_long:
Expand Down