GithubHelp home page GithubHelp logo

skortela / esp8266_p1meter_sv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from udok/esp8266_p1meter_sv

0.0 0.0 0.0 529 KB

Swedish HAN Port H1 version to mqtt using esp8266

License: GNU General Public License v3.0

C++ 96.60% C 3.40%

esp8266_p1meter_sv's Introduction

esp8266_p1meter

Software for the ESP8266 that sends P1 smart meter data to an mqtt broker (with OTA firmware updates)

about this fork

This fork adds support for the Landys and Gyr E360 smartmeter in Sweden. The P1 Port is called in nordic countries HAN-Port H1 which provides different values compared to the Dutch standard ESMR 5.0

The original source has issues with DSMR5.0 meters who like to send telegrams every 1 second at a high 115200 baud rate. This causes the used SoftwareSerial to struggle to keep up and thus only receives corrupted messages. This fork switches to using the main Hardware serial port (RX) for communication with the meter.

Getting started

This setup requires:

  • An esp8266 (nodeMcu and Wemos d1 mini have been tested)
  • A 10k ohm resistor
  • A 4 pin RJ11 or 6 pin RJ12 cable Both cables work great, but a 6 pin cable can also power the esp8266 on most DSMR5+ meters.

Compiling up using Arduino IDE:

  • Ensure you have selected the right board
  • Using the Tools->Manage Libraries... install PubSubClient and WifiManager
  • In the file Settings.h change OTA_PASSWORD to a safe secret value
  • Flash the software

Compiling up using PlatformIO:

  • Ensure the correct board type is selected in project configuration
  • In the file Settings.h change OTA_PASSWORD to a safe secret value
  • Upload the software.

Finishing off:

  • You should now see a new wifi network ESP****** connect to this wifi network, a popup should appear, else manually navigate to 192.168.4.1
  • Configure your wifi and Mqtt settings
  • To check if everything is up and running you can listen to the MQTT topic hass/status, on startup a single message is sent.

Connecting to the P1 meter

Connect the esp8266 to an RJ11 cable/connector following the diagram.

P1 pin ESP8266 Pin
2 - RTS 3.3v
3 - GND GND
4 -
5 - RXD (data) RX (gpio3)

On most Landys and Gyr models a 10K resistor should be used between the ESP's 3.3v and the p1's DATA (RXD) pin. Many howto's mention RTS requires 5V (VIN) to activate the P1 port, but for me 3V3 suffices.

Wiring

Optional: Powering the esp8266 using your DSMR5+ meter

Expand to see wiring description

When using a 6 pin cable you can use the power source provided by the meter.

P1 pin ESP8266 Pin
1 - 5v out 5v or Vin
2 - RTS 3.3v
3 - GND GND
4 -
5 - RXD (data) RX (gpio3)
6 - GND GND

Wiring powered by meter

Data Sent

All metrics are send to their own MQTT topic. The software sends out to the following MQTT topics:

sensors/power/p1meter/consumption

Home Assistant Configuration

Use the p1_sensors_sv.yaml for Home Assistant integration

The automatons are yours to create. And always remember that sending alerts in case of a power outtage only make sense when you own a UPS battery :)

Thanks to

This sketch is mostly copied and pasted from several other projects. Standing on the heads of giants, big thanks and great respect to the writers and/or creators of:

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.