SlimmeLezer+, Aidon 6534, HA as docker container on a Synology NAS, how to get it rolling?

Alright.

TLDR; Integrate a SlimmeLezer+ through the ESPHome integration into a HA in a docker container on a Synology NAS. the SL+ connected to a Aidon 6534. No add-ons. TLDR;

I have a synology NAS onto which I have installed HA as a docker container, i.e. not as a supervised installation, i.e. I cannot have add-ons.
I also got a SlimmeLezer+ to connect to my Aidon 6534 that uses Swedish protocol and HDLC (Tekniska Verken, Linköping).
The SlimmeLezer+ works as advertised out of the box and supplies the AP with the captive portal etc. Everything works fine, apart from that the reported data into HA from the SlimmeLezer+ are all “unknown”.

Some googling later and I have realised that the SL+ initial conf etc does not support the communication from the Aidon 6534. However there are threads explaining how to get this to work, for example: this.

However, Since I cannot add add-ons it fails.

I have tried to fire up an instance of ESPHome on my local machine where I can find, adopt and fiddle with the SL+. However, when I compile a new version with a YAML with the needed changes it only results in a successful compilation that does not connect to my network, does not produce a fallback AP and I cannot see that it communicates with the Aidon in the logs.

So, any ideas how to get this to work?
The target being: Integrate a SlimmeLezer+ through the ESPHome integration into a HA in a docker container on a Synology NAS. the SL+ connected to a Aidon 6534. No add-ons.

SlimmeLezer+ in Sweden with Aidon 6534

Alright. The steps I needed to perform to get the SL+ to work in Sweden with an Aidon 6534 electricity meter.

  1. Download and make available ESPHome. It is a Python package, and therefore I would recommend that you install it in a virtual env. I personally use miniconda and it works great.
  2. Clone the Forsberg fork of the esphome-p1reader repository. The main repo of the esphome-p1reader says that it works with Aidon 6534 and there is also a merge that supports this claim. However, when inspecting the code there is no resemblance between the main repo and the Forsberg fork, and I cant make the main repo work. It flashes OK but the SL+ never starts afterwards.
  3. Update the p1reader.yaml such that it is line with your needs.
    1. The readme of the main repo says that you should change the row auto meter_sensor = new P1Reader(id(uart_bus)); to auto meter_sensor = new P1ReaderHDLC(id(uart_bus));. DONT! Since this class does not exist in the Forsberg repo (the base P1Reader supports HDLC).
    2. I didn’t use the secrets.yaml trick. I guess that you can if you like.
  4. Start a terminal of choice. Navigate to the root where you cloned the Forsberg repo. Plug the SL+ into the computer with a cable. Run the command esphome p1reader.yaml run
    1. Note that this is a deprecated command and a warning will be issued, but it is expected as the Forsberg fork seems to be a non-maintained fork.
  5. Wait and issue the flash over cable when the choice is presented to you.
  6. The software will end with “INFO UART logging is disabled (baud_rate=0). Not starting UART logs.”.
  7. Unplug the SL+ and plug it into the Aidon 6534. It should now show up in your Home Assistant with numbers.

My p1reader.yaml
Change the to reflect your passwords and ssids. The passwords for the AP and the OTA can be chosen freely.

substitutions:
  device_name: slimmelezer
  device_description: "P1 module to read smart meter"
     
esphome:
  name: ${device_name}
  comment: "${device_description}"
  platform: ESP8266
  esp8266_restore_from_flash: true
  board: d1_mini
  name_add_mac_suffix: false
  includes:
    - p1reader.h

wifi:
  ssid: <your_SSID>
  password: <your_wifi_password>

  fast_connect: True

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: slimmelezer
    ap_timeout: 15s
    password: <ap_password>
  
  reboot_timeout: 5min
  domain: .local

captive_portal:

# Enable logging
logger:
  level: DEBUG
  baud_rate: 0 # disable logging over uart
  
# Enable Home Assistant API
api:

ota:
  password: <ota_password>

web_server:
  port: 80

uart:
  id: uart_bus
  tx_pin: D8
  rx_pin: D7
  rx_buffer_size: 1700
  baud_rate: 115200
  
sensor:
- platform: uptime
  name: "SlimmeLezer Uptime"
- platform: wifi_signal
  name: "SlimmeLezer Wi-Fi Signal"
  update_interval: 60s
- platform: custom
  lambda: |-
    auto meter_sensor = new P1Reader(id(uart_bus));
    App.register_component(meter_sensor);
    return {
      meter_sensor->cumulativeActiveImport,
      meter_sensor->cumulativeActiveExport,
      meter_sensor->cumulativeReactiveImport,
      meter_sensor->cumulativeReactiveExport,
      meter_sensor->momentaryActiveImport,
      meter_sensor->momentaryActiveExport,
      meter_sensor->momentaryReactiveImport,
      meter_sensor->momentaryReactiveExport,
      meter_sensor->momentaryActiveImportL1,
      meter_sensor->momentaryActiveExportL1,
      meter_sensor->momentaryActiveImportL2,
      meter_sensor->momentaryActiveExportL2,
      meter_sensor->momentaryActiveImportL3,
      meter_sensor->momentaryActiveExportL3,
      meter_sensor->momentaryReactiveImportL1,
      meter_sensor->momentaryReactiveExportL1,
      meter_sensor->momentaryReactiveImportL2,
      meter_sensor->momentaryReactiveExportL2,
      meter_sensor->momentaryReactiveImportL3,
      meter_sensor->momentaryReactiveExportL3,
      meter_sensor->voltageL1,
      meter_sensor->voltageL2,
      meter_sensor->voltageL3,
      meter_sensor->currentL1,
      meter_sensor->currentL2,
      meter_sensor->currentL3
    };
  sensors:
  - name: "Cumulative Active Import"
    unit_of_measurement: kWh
    accuracy_decimals: 3
    state_class: "total_increasing"
    device_class: "energy"
  - name: "Cumulative Active Export"
    unit_of_measurement: kWh
    accuracy_decimals: 3
    state_class: "total_increasing"
    device_class: "energy"
  - name: "Cumulative Reactive Import"
    unit_of_measurement: kvarh
    accuracy_decimals: 3
  - name: "Cumulative Reactive Export"
    unit_of_measurement: kvarh
    accuracy_decimals: 3
  - name: "Momentary Active Import"
    unit_of_measurement: kW
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "power"
  - name: "Momentary Active Export"
    unit_of_measurement: kW
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "power"
  - name: "Momentary Reactive Import"
    unit_of_measurement: kvar
    accuracy_decimals: 3
  - name: "Momentary Reactive Export"
    unit_of_measurement: kvar
    accuracy_decimals: 3
  - name: "Momentary Active Import Phase 1"
    unit_of_measurement: kW
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "power"
  - name: "Momentary Active Export Phase 1"
    unit_of_measurement: kW
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "power"
  - name: "Momentary Active Import Phase 2"
    unit_of_measurement: kW
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "power"
  - name: "Momentary Active Export Phase 2"
    unit_of_measurement: kW
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "power"
  - name: "Momentary Active Import Phase 3"
    unit_of_measurement: kW
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "power"
  - name: "Momentary Active Export Phase 3"
    unit_of_measurement: kW
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "power"
  - name: "Momentary Reactive Import Phase 1"
    unit_of_measurement: kvar
    accuracy_decimals: 3
  - name: "Momentary Reactive Export Phase 1"
    unit_of_measurement: kvar
    accuracy_decimals: 3
  - name: "Momentary Reactive Import Phase 2"
    unit_of_measurement: kvar
    accuracy_decimals: 3
  - name: "Momentary Reactive Export Phase 2"
    unit_of_measurement: kvar
    accuracy_decimals: 3
  - name: "Momentary Reactive Import Phase 3"
    unit_of_measurement: kvar
    accuracy_decimals: 3
  - name: "Momentary Reactive Export Phase 3"
    unit_of_measurement: kvar
    accuracy_decimals: 3
  - name: "Voltage Phase 1"
    unit_of_measurement: V
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "voltage"
  - name: "Voltage Phase 2"
    unit_of_measurement: V
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "voltage"
  - name: "Voltage Phase 3"
    unit_of_measurement: V
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "voltage"
  - name: "Current Phase 1"
    unit_of_measurement: A
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "current"
  - name: "Current Phase 2"
    unit_of_measurement: A
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "current"
  - name: "Current Phase 3"
    unit_of_measurement: A
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "current"

text_sensor:
  - 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: false
1 Like