mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-22 18:51:25 +00:00
Trying to fix HA accumulated
This commit is contained in:
parent
e6a02f34ab
commit
d12613b91a
29
src/entsoe/PricesFromHubStream.cpp
Normal file
29
src/entsoe/PricesFromHubStream.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include "PricesFromHubStream.h"
|
||||
|
||||
int PricesFromHubStream::available() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PricesFromHubStream::read() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PricesFromHubStream::peek() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PricesFromHubStream::flush() {
|
||||
|
||||
}
|
||||
|
||||
size_t PricesFromHubStream::write(const uint8_t *buffer, size_t size) {
|
||||
for(int i = 0; i < size; i++) {
|
||||
write(buffer[i]);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
size_t PricesFromHubStream::write(uint8_t b) {
|
||||
buf[pos++] = b;
|
||||
return 1;
|
||||
}
|
||||
19
src/entsoe/PricesFromHubStream.h
Normal file
19
src/entsoe/PricesFromHubStream.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef _PRICESFROMHUBSTREAM_H
|
||||
#define _PRICESFROMHUBSTREAM_H
|
||||
|
||||
#include "Stream.h"
|
||||
|
||||
class PricesFromHubStream: public Stream {
|
||||
public:
|
||||
int available();
|
||||
int read();
|
||||
int peek();
|
||||
void flush();
|
||||
size_t write(const uint8_t *buffer, size_t size);
|
||||
size_t write(uint8_t);
|
||||
|
||||
int pos = 0;
|
||||
uint8_t buf[512];
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -24,6 +24,7 @@ bool HomeAssistantMqttHandler::publish(AmsData* data, AmsData* previousState, En
|
||||
data->getMeterTimestamp()
|
||||
);
|
||||
mqtt->publish(topic + "/energy", json);
|
||||
mqtt->loop();
|
||||
}
|
||||
String meterModel = data->getMeterModel();
|
||||
meterModel.replace("\\", "\\\\");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user