Comments (2)
Interesting, could be a parse problem. I will take a look 👍
from esphome-p1reader.
Ok, so checking the obis codes, this looks like a simple fix by just updating the code that parses the codes.
For example, you have two cumulative import / export values, one pair for rate 1 (1.8.1 / 2.8.1) and one for rate 2 (1.8.2 / 2.8.2) while the Swedish specification only have one rate (1.8.0 / 2.8.0).
The empty values such as '': Sending state 0.00000 with 0 decimals of accuracy
are for the second and third phases that your meter doesn't have.
So what you can do is to define a couple of new sensors for rate 1 / rate 2 like this to the ParsedMessage
class:
class ParsedMessage {
public:
double cumulativeActiveImportRate1;
double cumulativeActiveImportRate2;
double cumulativeActiveExportRate1;
double cumulativeActiveExportRate2;
...
and to the P1Reader class:
public:
Sensor *cumulativeActiveImportRate1 = new Sensor();
Sensor *cumulativeActiveImportRate2 = new Sensor();
Sensor *cumulativeActiveExportRate1 = new Sensor();
Sensor *cumulativeActiveExportRate2 = new Sensor();
update the parse logic:
void parseRow(ParsedMessage* parsed, char* obisCode, char* value) {
if (strncmp(obisCode, "1.8.1", 5) == 0) {
parsed->cumulativeActiveImportRate1 = atof(value);
} else if (strncmp(obisCode, "1.8.2", 5) == 0) {
parsed->cumulativeActiveImportRate2 = atof(value);
} else if (strncmp(obisCode, "2.8.1", 5) == 0) {
parsed->cumulativeActiveExportRate1 = atof(value);
} else if (strncmp(obisCode, "2.8.2", 5) == 0) {
parsed->cumulativeActiveExportRate2 = atof(value);
....
and finally add them to the yaml so that they are exposed as sensors:
sensor:
- platform: custom
lambda: |-
auto meter_sensor = new P1Reader(id(uart_bus));
App.register_component(meter_sensor);
return {
meter_sensor->cumulativeActiveImportRate1,
meter_sensor->cumulativeActiveExportRate2,
meter_sensor->cumulativeActiveImportRate1,
meter_sensor->cumulativeActiveExportRate2,
...
You could also remove all sensors and parse logic for the 2nd and 3rd phases as you don't have those: momentaryActiveImportL2
, momentaryActiveImportL3
etc.
from esphome-p1reader.
Related Issues (20)
- Extend the esp to act as active repeater to connect additional P1 device HOT 2
- HDLC support missing (is AIDON meters really supported?)
- Instability Frequent Drop out HOT 3
- Compile Error with esp-idf Framework HOT 2
- Add XIAO ESP32C3 to hardware section of readme.md
- Aidon meter and slimmelezer-wt32-eth01 HOT 5
- Landis Gyr e360 lte HOT 1
- SlimmeLezer+ with HDLC stops working HOT 1
- dual tariff HOT 2
- CRC Pass=no after a while HOT 3
- Update interval HOT 3
- Strange readings HSP Meter HAN port
- Problem error
- Custom components are deprecated HOT 3
- Slimmelezer not response after HAN plugged HOT 1
- CRC error, start block occasionally corrupted
- Data error on SlimmeLezer+
- InvalidJSONFile
- Unsigned negative current HOT 2
- ESP-12 p1reader.yaml HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esphome-p1reader.