Coder Social home page Coder Social logo

lrswss / esp32-sml-multi-reader Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 27 KB

ESP32 reads SML messages from multiple smart electricity meters using an IR reading head and publishes decoded data via MQTT

License: Apache License 2.0

C 49.56% C++ 50.44%
esp32 mqtt obis sml-reader tls-support smart-meter

esp32-sml-multi-reader's Introduction

Read and publish data from multiple smart meters with an ESP32 microcontroller

Motivation

As part of a small project, data from several smart meters in a large meter cabinet (all equipped with a SML IR interface) had to be read more or less simultaneously and published via MQTT. To avoid installing an ESP8266 with Tasmota and IR reading head for each electricity meter, this firmware was developed for an ESP32 microcontroller that can read SML messages from up to eight smart meters simultaneously using RTOS tasks.

Features

  • based on sml_parser library
  • read data from up to 6 smart meters simultaneously
  • publish readings with timestamp to MQTT broker
  • optional MQTT authentication
  • TLS support

Hardware components

Upload firmware

To compile the firmware for the ESP32 controller just download Visual Studio Code and install the PlatformIO add-on. Open the project directory and adjust the settings in include/config.h to your needs.

Since the software was developed on a MacBook you might need to adjust the upload port settings in the section [common] in platformio.ini. For further firmware updates use the OTA option in the web interface.

Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

License

Copyright (c) 2023 Lars Wessels
This software was published under the Apache License 2.0.
Please check the license file.

esp32-sml-multi-reader's People

Contributors

lrswss avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

esp32-sml-multi-reader's Issues

Core 0 panic during Tool execution

Hi,

got Core 0 panic during execution. Nothing special configured.

In case of testdata i´ve got some strange messages:

23630: SML buffer exceeded (400 bytes)
23954: SML buffer exceeded (400 bytes)

if i extend >512 program breakes, seems 512 is max?

Br,
Robert

LISTSTART on level 5 with 6 nodes
Data 6 (length = 4, octet string): 05 B0 1B 76
Data 5 (length = 1, unsigned int): 00
Data 4 (length = 1, unsigned int): 00
LISTSTART on level 6 with 2 nodes
Data 2 (length = 2, unsigned int): 07 01
LISTSTART on level 7 with 7 nodes
Data 7 (length = 6, octet string): FF FF FF FF FF FF
Data 6 (length = 10, octet string): 0A 01 45 46 52 20 02 DC EA 91
Data 5 (length = 6, octet string): 01 00 62 0A FF FF
LISTSTART on level 8 with 2 nodes
Data 2 (length = 1, unsigned int): 01
Data 1 (length = 4, unsigned int): 01 E5 5E 67
LISTEND on level 8
back to previous list
Extended List with Size=22
LISTSTART on level 8 with 22 nodes
LISTSTART on level 9 with 7 nodes
Data 7 (length = 6, octet string): 01 00 60 32 01 01
Data 6 (empty)
Data 5 (empty)
Data 4 (empty)
Data 3 (empty)
Data 2 (length = 3, octet string): 45 46 52
Data 1 (empty)
LISTEND
back to previous list
LISTSTART on level 9 with 7 nodes
Data 7 (length = 6, octet string): 01 00 60 01 00 FF
Data 6 (empty)
Data 5 (empty)
Data 4 (empty)
Data 3 (empty)
Data 2 (length = 10, octet string): 0A 01 45 46 52 20 02 DC EA 91
Data 1 (empty)
LISTEND
back to previous list
LISTSTART on level 9 with 7 nodes
Data 7 (length = 6, octet string): 01 00 01 08 01 FF
Data 6 (length = 3, unsigned int): 1C 00 04
LISTSTART on level 10 with 2 nodes
Data 4 (length = 1, unsigned int): 01
Data 9 (length = 4, unsigned int): 01 E5 5E 67
Data 9 (length = 1, unsigned int): 1E
Data 9 (length = 1, signed int): 19583: Received and parsed SML message on pin 4 (574 bytes)
[DEBUG] smlreader_task: StackHighWaterMark: 440
20879: SMLReader (Pin 4)
Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception).
Debug exception reason: Stack canary watchpoint triggered (SMLReader print)
Core 0 register dump:
PC : 0x400909e3 PS : 0x00060a36 A0 : 0x800901ff A1 : 0x3ffdd030
A2 : 0x3ffbf618 A3 : 0xb33fffff A4 : 0x0000abab A5 : 0x00060a23
A6 : 0x00060a23 A7 : 0x0000cdcd A8 : 0xb33fffff A9 : 0xffffffff
A10 : 0x3ffddcac A11 : 0x3ffc7478 A12 : 0x3ffc742c A13 : 0x00000000
A14 : 0x007bf618 A15 : 0x003fffff SAR : 0x0000000c EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000 LBEG : 0x40084a45 LEND : 0x40084a4d LCOUNT : 0x00000027

Backtrace: 0x400909e0:0x3ffdd030 0x400901fc:0x3ffdd070 0x4008e880:0x3ffdd090 0x4008e928:0x3ffdd0d0 0x400851e5:0x3ffdd0f0 0x400852f1:0x3ffdd120 0x4008538d:0x3ffdd140 0x40088d72:0x3ffdd170 0x400895d9:0x3ffdd190 0x40089651:0x3ffdd1c0 0x4008b6fe:0x3ffdd1f0 0x4008b6d6:0x3ffdd250 0x4008991f:0x3ffdd270 0x400d4524:0x3ffdd290 0x400d494d:0x3ffdd330 0x400d49cc:0x3ffddb90 0x400d49e1:0x3ffddbb0

#0 0x400909e0:0x3ffdd030 in compare_and_set_native at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_hw_support/include/soc/compare_set.h:25
(inlined by) spinlock_acquire at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_hw_support/include/soc/spinlock.h:103
(inlined by) xPortEnterCriticalTimeout at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/port/xtensa/port.c:301
#1 0x400901fc:0x3ffdd070 in vPortEnterCritical at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/port/xtensa/include/freertos/portmacro.h:578
(inlined by) pvTaskIncrementMutexHeldCount at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/tasks.c:5338
#2 0x4008e880:0x3ffdd090 in xQueueSemaphoreTake at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/queue.c:1585
#3 0x4008e928:0x3ffdd0d0 in xQueueTakeMutexRecursive at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/queue.c:731
#4 0x400851e5:0x3ffdd0f0 in lock_acquire_generic at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/locks.c:153
#5 0x400852f1:0x3ffdd120 in _lock_acquire_recursive at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/locks.c:167
#6 0x4008538d:0x3ffdd140 in __retarget_lock_acquire_recursive at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/locks.c:323
#7 0x40088d72:0x3ffdd170 in __env_lock at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdlib/envlock.c:43
#8 0x400895d9:0x3ffdd190 in _findenv_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdlib/getenv_r.c:85
#9 0x40089651:0x3ffdd1c0 in _getenv_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdlib/getenv_r.c:126
#10 0x4008b6fe:0x3ffdd1f0 in _tzset_unlocked_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/time/tzset_r.c:28
#11 0x4008b6d6:0x3ffdd250 in _tzset_unlocked at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/time/tzset.c:115
#12 0x4008991f:0x3ffdd270 in localtime_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/time/lcltime_r.c:34 (discriminator 8)
#13 0x400d4524:0x3ffdd290 in printSMLReadings(SMLDeviceReadings const&) at src/smlparser.cpp:151
#14 0x400d494d:0x3ffdd330 in SMLReader::printReadings() at src/smlreader.cpp:104
#15 0x400d49cc:0x3ffddb90 in SMLReader::printerTask() at src/smlreader.cpp:127
#16 0x400d49e1:0x3ffddbb0 in SMLReader::printerTaskWrapper(void*) at src/smlreader.cpp:135

ELF file SHA256: ff2a92771c2aa199

Rebooting...

Setting WIFI Credentials fails

Hello,

is there a problem to set the wifi settings? Wenn I try to connect to 192.168.4.1 in station mode I get the following error:

ESP32-SML-Multi-Reader (v100)
WiFi: AutoConnect
WiFi: No wifi saved, skipping
WiFi: AutoConnect: FAILED for 155 ms
WiFi: StartAP with SSID: SML-Multi-Reader-C36724
WiFi: AP IP address: 192.168.4.1
WiFi: Starting Web Portal
[ 3262][E][WiFiServer.cpp:91] begin(): ---------------- IPv6
[107861][E][WebServer.cpp:649] _handleRequest(): request handler not found

There is no web page at 192.168.4.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.