Giter Site home page Giter Site logo

vooon / elehant-to-mqtt Goto Github PK

View Code? Open in Web Editor NEW
23.0 5.0 7.0 1.51 MB

Collect and publish to MQTT data from Elehant SVD-15 water counters

License: GNU General Public License v3.0

C++ 30.40% Shell 0.11% Python 1.70% C 67.79%
esp32 platformio elehant svd-15 water-counter mqtt homeassistant-sensor bluetooth-low-energy water-meter home-automation

elehant-to-mqtt's Introduction

logo: device to mqtt and influx

Прошивка для ESP32 для сбора данных со счетчиков Элехант СВД-15

Так как эти счетчики выдают показания сразу через Bluetooth LE, их довольно удобно использовать в системе умного дома. Однако производитель не предоставляет ни какой информации об протоколе, и единственная возможность получить показания - воспользоваться официальным приложением или выносным дисплеем.

Так как сообщения идут в широковещательном режиме, то без какого-либо вмешательства в ПО прибора учета, можно получить те-же данные, что и в оригинальном приложении.

И тут очень кстати ESP32, который позволяет сделать MQTT сенсор на одном чипе.

Лицензия

Лицензировано на условиях GPL v3.

Железо

Принципиально прошивка может работать на любой плате с ESP32, т.к. все необходимое уже встроено в чип. Желательно иметь экран SSD1603, который есть на плате Wemos ESP32 OLED. Но все будет работать и без него, просто без какой-либо индикации.

photo of device running firmware

TODO

  • BLE sniffer
  • mfg data decoder
  • config
  • WiFi
  • MQTT client
  • InfluxDB client (UDP)
  • Watch dog (soft wdt on WiFi connection)
  • NTP date
  • LED indicate pkt sent (maybe)
  • OLED display (maybe)
  • Home Assistant auto discovery (maybe)
  • OTA

elehant-to-mqtt's People

Contributors

vooon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

elehant-to-mqtt's Issues

ESPHome, СВТ-15

А будет ли доработка для ESPHome для двухтарифных счетчиков?
Есть 4 счетчика, 3 однотарифных, и один двух тарифный

  1. Серийный номер на двухтарифном счетчике 0004706 (как прописывать? 5 цифр или 4)
  2. С двухтарифного не собирает вообще никакой инфы (В приложении отображается, температура, счетчик холодной воды пока не нагрелась и счетчик горячей воды, после того как нагрелась до 40 градусов)

Очень хотелось бы чтобы оно именно на ESPHome заработало...

Внешний дисплей SSD1306 не работает

Ввиду отсутствия у меня платы ESP32 с приклееным дисплеем, решил подключить внешний дисплей SSD1306 128x32.
Однако, он не работает. От слова "совсем". Просто черный экран.
Дисплей имеет адрес 0x3C.
Подключал так (слева дисплей, справа ESP32)
GND -> GND
VCC -> 3V3
SCL -> D22
SDA -> D21
Проверял на двух платах ESP32 - результат одинаковый
Сам дисплей проверялся на работоспособность, будучи подключенным к Arduino Uno с тестовым скетчем от Adafruit - дисплей рабочий.

WiFi unstable when InfluxDB enabled

Don't sure why, but WiFi become very unstable.
MultiWiFi drops connection after 5-10 min.
I saw incorrect payload in MQTT (part of influx line).
So i suggesting that problem somewhere in operations with memory.
Need to investigate how AsyncUDP works.

Cannot compile project

Hi! Great stuff you did there. But i have some troubles with compiling the code.
I am newbie, so it could be my misunderstanding.

Versions
Updating tool-unity @ 1.20403.0 [Up-to-date]
Updating contrib-pysite @ 2.36.191017 [Up-to-date]
Updating contrib-piohome @ 3.0.1 [Up-to-date]
Updating tool-scons @ 2.20501.190826 [Up-to-date]

Platform Espressif 32 (Stage)
Updating espressif32 @ cff56ff [Up-to-date]
Updating tool-esptoolpy @ 1.20600.0 [Up-to-date]
Updating toolchain-xtensa32 @ 2.50200.80 [Up-to-date]
Updating framework-arduinoespressif32 @ cec3fca [Up-to-date]
Updating framework-espidf @ 3.30300.190916 [Up-to-date]
Updating tool-mkspiffs @ 2.230.0 [Up-to-date]

$ pio upgrade
You're up-to-date!
PlatformIO 4.1.0 is currently the newest version available.

Output
Processing elehant (platform: https://github.com/platformio/platform-espressif32.git#feature/stage; board: esp32dev; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (Stage) 1.11.0-beta.1 #cff56ff > Espressif ESP32 Dev Module
HARDWARE: ESP32 160MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: toolchain-xtensa32 2.50200.80 (5.2.0), framework-arduinoespressif32 cec3fca, tool-esptoolpy 1.20600.0 (2.6.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 36 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SPI> 1.0
|-- <Wire> 1.0.1
|-- <FS> 1.0
|-- <SPIFFS> 1.0
|   |-- <FS> 1.0
|-- <HTTPUpdate> 1.3
|   |-- <HTTPClient> 1.2
|   |   |-- <WiFi> 1.0
|   |   |-- <WiFiClientSecure> 1.0
|   |   |   |-- <WiFi> 1.0
|   |-- <WiFi> 1.0
|   |-- <Update> 1.0
|-- <NTPClient> 3.1.0
|-- <ArduinoJson> 6.12.0 #8721ac8
|-- <AsyncTCP> 1.1.1
|-- <AsyncMqttClient> 0.8.2
|   |-- <AsyncTCP> 1.1.1
|-- <ESP Async WebServer> 1.2.3
|   |-- <AsyncTCP> 1.1.1
|   |-- <FS> 1.0
|   |-- <WiFi> 1.0
|   |-- <ArduinoJson> 6.12.0 #8721ac8
|-- <ESP8266_SSD1306> 4.1.0 #f751540
|   |-- <Wire> 1.0.1
|   |-- <SPI> 1.0
|-- <ESP32 BLE Arduino> 1.0.1
|-- <fonts>
|-- <soft_wdt>
|-- <ESP32 Async UDP> 1.0.0
|-- <DNSServer> 1.1.0
|   |-- <WiFi> 1.0
|-- <influxdb>
|-- <WiFi> 1.0
|-- <Preferences> 1.0
|-- <uptime>
Building in release mode
Compiling .pio/build/elehant/src/ble.cpp.o
Compiling .pio/build/elehant/src/config.cpp.o
Compiling .pio/build/elehant/src/die.cpp.o
Compiling .pio/build/elehant/src/display.cpp.o
In file included from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Document/JsonDocument.hpp:9:0,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Document/BasicJsonDocument.hpp:7,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Document/DynamicJsonDocument.hpp:7,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.hpp:21,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.h:9,
               from src/mqtt_commander.h:9,
               from src/ble.cpp:4:
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp: In instantiation of 'typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>::operator=(const TValue&) [with TValue = std::__cxx11::basic_string<char>; TObject = ArduinoJson6120_000001::ObjectRef;
TStringRef = const char*; typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type = ArduinoJson6120_000001::Mem
berProxy<ArduinoJson6120_000001::ObjectRef, const char*>&]':
src/ble.cpp:104:18:   required from here
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp:39:5: error: no matching function for call to 'ArduinoJson6120_000001::VariantRef::set(const std::__cxx11::basic_string<char>&)'
   getOrAddUpstreamMember().set(src);
   ^
In file included from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Array/ArrayIterator.hpp:8:0,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Array/ArrayRef.hpp:8,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.hpp:17,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.h:9,
               from src/mqtt_commander.h:9,
               from src/ble.cpp:4:
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:146:21: note: candidate: bool ArduinoJson6120_000001::VariantRef::set(bool) const
 FORCE_INLINE bool set(bool value) const {
                   ^
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:146:21: note:   no known conversion for argument 1 from 'const std::__cxx11::basic_string<char>' to 'bool'
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:153:21: note: candidate: template<class T> bool ArduinoJson6120_000001::VariantRef::set(T, typename ArduinoJson6120_000001::enable_if<ArduinoJson6120_000001::is_floating_point<T>::value>::type*) const
 FORCE_INLINE bool set(
                   ^
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:153:21: note:   template argument deduction/substitution failed:
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp: In substitution of 'template<class T> bool ArduinoJson6120_000001::VariantRef::set(T, typename ArduinoJson6120_000001::enable_if<ArduinoJson6120_000001::is_floating_point<T>::value>::type*) const [with T = std::__cxx11::basic_string<char>]':
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp:39:5:   required from 'typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>::operator=(const TValue&) [with TValue = std::__cxx11::basic_string<char>; TObject = ArduinoJson6120_000001::ObjectRef; TStringRef = const char*; typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type = ArduinoJson6120_000001::MemberProxy<ArduinoJson6120_000001::ObjectRef, const char*>&]'
src/ble.cpp:104:18:   required from here
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:153:21: error: no type named 'type' in 'struct ArduinoJson6120_000001::enable_if<false, void>'
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp: In instantiation of 'typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>::operator=(const TValue&) [with TValue = std::__cxx11::basic_string<char>; TObject = ArduinoJson6120_000001::ObjectRef; TStringRef = const char*; typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type = ArduinoJson6120_000001::MemberProxy<ArduinoJson6120_000001::ObjectRef, const char*>&]':
src/ble.cpp:104:18:   required from here
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:165:21: note: candidate: template<class T> bool ArduinoJson6120_000001::VariantRef::set(T, typename ArduinoJson6120_000001::enable_if<(ArduinoJson6120_000001::is_integral<T>::value && ArduinoJson6120_000001::is_signed< <template-parameter-1-1> >::value)>::type*) const
 FORCE_INLINE bool set(
                   ^
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:165:21: note:   template argument deduction/substitution failed:
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp: In substitution of 'template<class T> bool ArduinoJson6120_000001::VariantRef::set(T, typename ArduinoJson6120_000001::enable_if<(ArduinoJson6120_000001::is_integral<T>::value && ArduinoJson6120_000001::is_signed< <template-parameter-1-1> >::value)>::type*) const [with T = std::__cxx11::basic_string<char>]':
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp:39:5:   required from 'typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>::operator=(const TValue&) [with TValue = std::__cxx11::basic_string<char>; TObject = ArduinoJson6120_000001::ObjectRef; TStringRef = const char*; typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type = ArduinoJson6120_000001::MemberProxy<ArduinoJson6120_000001::ObjectRef, const char*>&]'
src/ble.cpp:104:18:   required from here
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:165:21: error: no type named 'type' in 'struct ArduinoJson6120_000001::enable_if<false, void>'
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp: In instantiation of 'typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>::operator=(const TValue&) [with TValue = std::__cxx11::basic_string<char>; TObject = ArduinoJson6120_000001::ObjectRef; TStringRef = const char*; typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type = ArduinoJson6120_000001::MemberProxy<ArduinoJson6120_000001::ObjectRef, const char*>&]':
src/ble.cpp:104:18:   required from here
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:176:21: note: candidate: template<class T> bool ArduinoJson6120_000001::VariantRef::set(T, typename ArduinoJson6120_000001::enable_if<(ArduinoJson6120_000001::is_integral<T>::value && ArduinoJson6120_000001::is_unsigned<T>::value)>::type*) const
 FORCE_INLINE bool set(
                   ^
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:176:21: note:   template argument deduction/substitution failed:
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp: In substitution of 'template<class T> bool ArduinoJson6120_000001::VariantRef::set(T, typename ArduinoJson6120_000001::enable_if<(ArduinoJson6120_000001::is_integral<T>::value && ArduinoJson6120_000001::is_unsigned<T>::value)>::type*) const [with T = std::__cxx11::basic_string<char>]':
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp:39:5:   required from 'typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>::operator=(const TValue&) [with TValue = std::__cxx11::basic_string<char>; TObject = ArduinoJson6120_000001::ObjectRef;
TStringRef = const char*; typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type = ArduinoJson6120_000001::Me
mberProxy<ArduinoJson6120_000001::ObjectRef, const char*>&]'
src/ble.cpp:104:18:   required from here
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:176:21: error: no type named 'type' in 'struct ArduinoJson6120_000001::enable_if<false, void>'
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp: In instantiation of 'typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::Me
mberProxy<TParent, TStringRef>&>::type ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>::operator=(const TValue&) [with TValue = std::__cxx11::basic_string<char>; TObject = ArduinoJson6120_000001::ObjectRef;
TStringRef = const char*; typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type = ArduinoJson6120_000001::MemberProxy<ArduinoJson6120_000001::ObjectRef, const char*>&]':
Compiling .pio/build/elehant/src/influx.cpp.o
src/ble.cpp:104:18:   required from here
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:183:21: note: candidate: bool ArduinoJson6120_000001::VariantRef::set(ArduinoJson6120_000001::SerializedValue<const char*>) const
 FORCE_INLINE bool set(SerializedValue<const char *> value) const {
                   ^
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:183:21: note:   no known conversion for argument 1 from 'const std::__cxx11::basic_string<char>' to 'ArduinoJson6120_000001::SerializedValue<con
st char*>'
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:191:21: note: candidate: template<class T> bool ArduinoJson6120_000001::VariantRef::set(ArduinoJson6120_000001::SerializedValue<T>, typename Ard
uinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_same<const char*, T>::value)>::type*) const
 FORCE_INLINE bool set(
                   ^
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:191:21: note:   template argument deduction/substitution failed:
In file included from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Document/JsonDocument.hpp:9:0,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Document/BasicJsonDocument.hpp:7,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Document/DynamicJsonDocument.hpp:7,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.hpp:21,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.h:9,
               from src/mqtt_commander.h:9,
               from src/ble.cpp:4:
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp:39:5: note:   'std::__cxx11::basic_string<char>' is not derived from 'ArduinoJson6120_000001::SerializedValue<T>'
   getOrAddUpstreamMember().set(src);
   ^
In file included from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Array/ArrayIterator.hpp:8:0,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Array/ArrayRef.hpp:8,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.hpp:17,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.h:9,
               from src/mqtt_commander.h:9,
               from src/ble.cpp:4:
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:200:21: note: candidate: template<class T> bool ArduinoJson6120_000001::VariantRef::set(const T&, typename ArduinoJson6120_000001::enable_if<Ard
uinoJson6120_000001::IsString< <template-parameter-1-1> >::value>::type*) const
 FORCE_INLINE bool set(
                   ^
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:200:21: note:   template argument deduction/substitution failed:
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp: In substitution of 'template<class T> bool ArduinoJson6120_000001::VariantRef::set(const T&, typename ArduinoJson6120_000001::enable_if<Arduino
Json6120_000001::IsString< <template-parameter-1-1> >::value>::type*) const [with T = std::__cxx11::basic_string<char>]':
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp:39:5:   required from 'typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::M
emberProxy<TParent, TStringRef>&>::type ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>::operator=(const TValue&) [with TValue = std::__cxx11::basic_string<char>; TObject = ArduinoJson6120_000001::ObjectRef;
TStringRef = const char*; typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type = ArduinoJson6120_000001::Me
mberProxy<ArduinoJson6120_000001::ObjectRef, const char*>&]'
src/ble.cpp:104:18:   required from here
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:200:21: error: no type named 'type' in 'struct ArduinoJson6120_000001::enable_if<false, void>'
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp: In instantiation of 'typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::Me
mberProxy<TParent, TStringRef>&>::type ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>::operator=(const TValue&) [with TValue = std::__cxx11::basic_string<char>; TObject = ArduinoJson6120_000001::ObjectRef;
TStringRef = const char*; typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type = ArduinoJson6120_000001::Mem
berProxy<ArduinoJson6120_000001::ObjectRef, const char*>&]':
src/ble.cpp:104:18:   required from here
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:209:21: note: candidate: template<class T> bool ArduinoJson6120_000001::VariantRef::set(T*, typename ArduinoJson6120_000001::enable_if<ArduinoJs
on6120_000001::IsString<TChar*>::value>::type*) const
 FORCE_INLINE bool set(
                   ^
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:209:21: note:   template argument deduction/substitution failed:
In file included from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Document/JsonDocument.hpp:9:0,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Document/BasicJsonDocument.hpp:7,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Document/DynamicJsonDocument.hpp:7,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.hpp:21,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.h:9,
               from src/mqtt_commander.h:9,
               from src/ble.cpp:4:
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp:39:5: note:   mismatched types 'T*' and 'std::__cxx11::basic_string<char>'
   getOrAddUpstreamMember().set(src);
   ^
In file included from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Array/ArrayIterator.hpp:8:0,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Array/ArrayRef.hpp:8,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.hpp:17,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.h:9,
               from src/mqtt_commander.h:9,
               from src/ble.cpp:4:
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:215:21: note: candidate: bool ArduinoJson6120_000001::VariantRef::set(const char*) const
 FORCE_INLINE bool set(const char *value) const {
                   ^
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantRef.hpp:215:21: note:   no known conversion for argument 1 from 'const std::__cxx11::basic_string<char>' to 'const char*'
In file included from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.hpp:31:0,
               from .pio/libdeps/elehant/ArduinoJson/src/ArduinoJson.h:9,
               from src/mqtt_commander.h:9,
               from src/ble.cpp:4:
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantImpl.hpp:80:62: note: candidate: template<class TVariant> typename ArduinoJson6120_000001::enable_if<ArduinoJson6120_000001::IsVisitable<T>::value, bool
>::type ArduinoJson6120_000001::VariantRef::set(const TVariant&) const
typename enable_if<IsVisitable<TVariant>::value, bool>::type VariantRef::set(
                                                            ^
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantImpl.hpp:80:62: note:   template argument deduction/substitution failed:
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantImpl.hpp: In substitution of 'template<class TVariant> typename ArduinoJson6120_000001::enable_if<ArduinoJson6120_000001::IsVisitable<T>::value, bool>::
type ArduinoJson6120_000001::VariantRef::set(const TVariant&) const [with TVariant = std::__cxx11::basic_string<char>]':
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp:39:5:   required from 'typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::M
emberProxy<TParent, TStringRef>&>::type ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>::operator=(const TValue&) [with TValue = std::__cxx11::basic_string<char>; TObject = ArduinoJson6120_000001::ObjectRef;
TStringRef = const char*; typename ArduinoJson6120_000001::enable_if<(! ArduinoJson6120_000001::is_array<TValue>::value), ArduinoJson6120_000001::MemberProxy<TParent, TStringRef>&>::type = ArduinoJson6120_000001::Me
mberProxy<ArduinoJson6120_000001::ObjectRef, const char*>&]'
src/ble.cpp:104:18:   required from here
.pio/libdeps/elehant/ArduinoJson/src/ArduinoJson/Variant/VariantImpl.hpp:80:62: error: no type named 'type' in 'struct ArduinoJson6120_000001::enable_if<false, bool>'
*** [.pio/build/elehant/src/ble.cpp.o] Error 1

Не компилируется проект

Добрый день.
Очень заинтересовала эта прошивка для ESP, но никак не могу ее скомпилировать.
К сожалению, ранее с Platformio не имел опыта работы.
Прошу подсказать что я делаю не так, думаю новичкам тоже будет полезно.
Запускаю файл make_flags.py через F5, получаю следующую ошибку:
image
При билде файла platformio.ini следующее:

> Executing task: C:\Users\max\.platformio\penv\Scripts\platformio.exe run <

legacy Click
Processing elehant (platform: espressif32; board: esp32dev; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.3.2) > Espressif ESP32 Dev Module
HARDWARE: ESP32 160MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)        
PACKAGES:
 - framework-arduinoespressif32 3.10006.210326 (1.0.6)
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
"." ­Ґ пў«пҐвбп ў­гв७­Ґ© Ё«Ё ў­Ґи­Ґ©
Є®¬ ­¤®©, ЁбЇ®«­пҐ¬®© Їа®Ја ¬¬®© Ё«Ё Ї ЄҐв­л¬ д ©«®¬.
OSError: './make_flags.py' exited 1:
  File "C:\Users\max\.platformio\penv\Lib\site-packages\platformio\builder\main.py", line 180:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Script\SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\max\.platformio\platforms\espressif32\builder\main.py", line 218:
    target_elf = env.BuildProgram()
  File "C:\Users\max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Util.py", line 748:
    return self.method(*nargs, **kwargs)
  File "C:\Users\max\.platformio\penv\Lib\site-packages\platformio\builder\tools\platformio.py", line 61:
    env.ProcessProgramDeps()
  File "C:\Users\max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Util.py", line 748:
    return self.method(*nargs, **kwargs)
  File "C:\Users\max\.platformio\penv\Lib\site-packages\platformio\builder\tools\platformio.py", line 125:
    env.ProcessFlags(env.get("BUILD_FLAGS"))
  File "C:\Users\max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Util.py", line 748:
    return self.method(*nargs, **kwargs)
  File "C:\Users\max\.platformio\penv\Lib\site-packages\platformio\builder\tools\platformio.py", line 223:
    env.Append(**env.ParseFlagsExtended(flags))
  File "C:\Users\max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Util.py", line 748:
    return self.method(*nargs, **kwargs)
  File "C:\Users\max\.platformio\penv\Lib\site-packages\platformio\builder\tools\platformio.py", line 186:
    for key, value in env.ParseFlags(str(raw)).items():
  File "C:\Users\max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Environment.py", line 815:
    do_parse(arg)
  File "C:\Users\max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Environment.py", line 667:
    arg = self.backtick(arg[1:])
  File "C:\Users\max\.platformio\packages\tool-scons\scons-local-4.2.0\SCons\Environment.py", line 579:
    raise OSError("'%s' exited %d" % (command, status))
========================================================================== [FAILED] Took 1.44 seconds ==========================================================================Процесс терминала "C:\Users\max\.platformio\penv\Scripts\platformio.exe 'run'" был завершен с кодом выхода 1.

Терминал будет повторно использоваться задачами. Чтобы закрыть его, нажмите любую клавишу.

Перепробовал уже многое, что советовали в гугле, но к сожалению так и не нашел решение.
Спасибо.

Project not compiling

Hello there!
I was very interested in your project, I was just trying to tame the Elehant counter
When compiling in Platformio, it returns an error, something related to make_flags.py

My meager knowledge is not enough to understand the reason.
Can you give me a hint on which way to look?

"." ­Ґ пў«пҐвбп ў­гв७­Ґ© Ё«Ё ў­Ґи­Ґ©
Є®¬ ­¤®©, ЁбЇ®«­пҐ¬®© Їа®Ја ¬¬®© Ё«Ё Ї ЄҐв­л¬ д ©«®¬.
OSError: './make_flags.py' exited 1:
  File "C:\users\sawa_nettop\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 169:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\Sawa_nettop\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Sawa_nettop\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\users\sawa_nettop\.platformio\platforms\espressif32\builder\main.py", line 223:
    target_elf = env.BuildProgram()
  File "C:\Users\Sawa_nettop\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\users\sawa_nettop\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 61:
    env.ProcessProgramDeps()
  File "C:\Users\Sawa_nettop\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\users\sawa_nettop\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 124:
    env.ProcessFlags(env.get("BUILD_FLAGS"))
  File "C:\Users\Sawa_nettop\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\users\sawa_nettop\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 222:
    env.Append(**env.ParseFlagsExtended(flags))
  File "C:\Users\Sawa_nettop\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\users\sawa_nettop\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 185:
    for key, value in env.ParseFlags(str(raw)).items():
  File "C:\Users\Sawa_nettop\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 815:
    do_parse(arg)
  File "C:\Users\Sawa_nettop\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 681:
    arg = self.backtick(arg[1:])
  File "C:\Users\Sawa_nettop\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 599:
    raise OSError("'%s' exited %d" % (command, status))

Esphome... error.... HELP!)

Error when try to compile

HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
Dependency Graph
|-- 1.1.1
|-- 1.0
| |-- 1.0
|-- 1.0
|-- 1.2.6
| |-- 1.1.1
| |-- 1.0
| |-- 1.0
| |-- 5.13.3
|-- 5.13.3
|-- 1.1.0
| |-- 1.0
|-- 1.0
|-- 1.0
Compiling /data/esp_ble_gateway/.pioenvs/esp_ble_gateway/src/main.cpp.o
Compiling /data/esp_ble_gateway/.pioenvs/esp_ble_gateway/libb15/ESPAsyncWebServer-esphome/WebResponses.cpp.o
Compiling /data/esp_ble_gateway/.pioenvs/esp_ble_gateway/libb15/ESPAsyncWebServer-esphome/WebServer.cpp.o
Compiling /data/esp_ble_gateway/.pioenvs/esp_ble_gateway/lib43b/DNSServer/DNSServer.cpp.o
In file included from src/main.cpp:22:0:
src/elehant_ble.h: In member function 'virtual bool ElehantBLE::parse_device(const esphome::esp32_ble_tracker::ESPBTDevice&)':
src/elehant_ble.h:35:28: error: 'const class esphome::esp32_ble_tracker::ESPBTDevice' has no member named 'get_manufacturer_datas'
auto mfg_datas = device.get_manufacturer_datas();
^
*** [/data/esp_ble_gateway/.pioenvs/esp_ble_gateway/src/main.cpp.o] Error 1
========================= [FAILED] Took 11.14 seconds =========================

Счётчик газа

У Элехант есть ещё счётчик газа
https://elehant.ru/cntr_gaz_dist.php

Данные думаю передаются так же, как и на воду.
По идее интеграция должна его тоже увидеть.
Какие на выходе данные через mqtt отдаются? только цифры показаний?

Вот думаю, можно ли использовать для газа или интеграция только под воду заточена?

Если плата уже прошита

А если плата уже прошита, можно ли просто добавить счетчик в виде сенсора?

esp32_ble_tracker:

sensor:

  • platform: ble_rssi
    mac_address: AC:37:43:77:5F:4C
    name: "BLE Home"

esphome

Добрый день, спасибо за отличный проект.

Хотелось бы понять, как добавить больше одного счетчика в ESPHOME ?

Коррекция показаний

Собственно говоря, не проблема, а просьба расширения функционала.
Сначала поясню. На практике бывает так, что счетчик "Элехант" (это относится и к водяным, и к газовым в равной мере) устанавливается в дополнение к официальному - просто для удобства пользования (например, официальный счетчик механический бнз возможности удаленного снятия показаний и/или расположен в неудобном месте).
При этом естественно возникает ситуация, при которой показания "Элеханта" не совпадают с показаниями официального счетчика (т.к. там уже накопился расход за предыдущее время), а передавать в службы ЖКХ нужно именно "официальные" показания.
Поэтому предложение №1: сделать возможность коррекции показаний, прибавляя (или отнимая - что маловероятно, но тем не менее) к истинным показаниям "Элеханта" некую фиксированную величину, определенную разницей между показаниями официального счетчика и "Элеханта" на момент его ввода в эксплуатацию. Эту величину можно задать например, через соответствующий новый параметр config.json.
Но это еще не всё. Как показывает опыт, счётчики считают по-разному, и показания "Элеханта" могут со временем сильно разойтись с официальными. Например, я в течение 10 дней мониторил у себя это дело и выяснил, что мой СГБД "отстает" от официального счётчика на 0,105 м³ в час - это двольно много. Выяснять, какой из счётчиков - механический или СГБД - считает "правильно", а какой "неправильно", нет смысла, потому что передавать показания в газовую компанию всё равно придется по официальному счетчику.
Отсюда предложение №2: реализовать (опять же - через новый параметр в config.json) поправочный коэффициент для показаний "Элеханта".

OTA don't work

Don't know why, but OTA fails somewhere in the middle of the process.

ESPHome, будь он неладен), не работает

Взял чистую ESP 32. Расположил её в метре от счетчика.

Взял части кода с этого проекта, отвечающие непосредственно за съем данных с счетчика воды.

МАК адреса у счетчика:
B0:02:02:00:41:50
B1:02:02:00:41:50

Номер:
16720

Прописал его номер в строке:
meter1->set_serial_no(16720);

Скомпилировал, сканер видит маки счетчика, но никакой информации не извлекает((( в веб пусто, в ха соответственно тоже.

Прошивка компилируется без ошибок, сам код прикладываю. Не пойму, где я сделал не так. Удалил только блоки с вайфай и апи, чтобы не усложнять тут чтение.

esphome:
  name: esp32_1
  platform: ESP32
  board: esp-wrover-kit
  includes:
  - /config/esp32_1/elehant_ble.h



esp32_ble_tracker:
  id: ble_tracker
  scan_parameters:
    # interval: 100ms
    # window: 99ms
    duration: 5min
    active: false
    
text_sensor:
  - platform: version
    name: "ESPHome version"

binary_sensor:
  - platform: status
    name: Meter 1 Converter Connected

sensor:
  - platform: uptime
    name: "Meter 1 Uptime"

  - platform: custom
    lambda: |-
      auto meter1 = new ElehantBLE();

      // Set serial number of the device! Like a mac_address for other BLE sensors.
      meter1->set_serial_no(16720);

      // Register
      App.register_component(meter1);
      id(ble_tracker)->register_listener(meter1);
      return {meter1->total_m3_, meter1->total_l_, meter1->rssi_};

    sensors:
      - name: Water1 Total
        unit_of_measurement: m3
        accuracy_decimals: 4
        icon: mdi:water-pump
        id: water1_total_m3
      - name: Water1 Total (liters)
        unit_of_measurement: L
        accuracy_decimals: 1
        icon: mdi:water-pump
        id: water1_total_l
      - name: Water1 Meter RSSI
        unit_of_measurement: dB
        accuracy_decimals: 0
        icon: mdi:signal
        id: water1_rssi

  # - platform: total_daily_energy
  #   name: Water1 Total Liters daily
  #   power_id: water1_total_l

switch:
  - platform: restart
    name: Meter 1 reboot

Ещё один тип счётчика - Соник G4

Приобрел ранее неведомый мне счётчик "Соник G4" (как я понимаю, бывают еще G6 и еще какие-то).
Сущность та же самая.
MAC-адрес начинается на B0:22:01, и далее серийник в хексе.
Вот пример данных (здесь обсуждалось - #8):
0x14FFFFFF800900010122ZzYyXx8A05000070BA0717 (XxYyZz - серийный номер, жирный текст - показания)
LEN: 20
TYPE: 0xFF
VALUE: 0xFFFF800900010122ZzYyXx8A05000070BA0717
Текущие показания счетчика в приложении: 0,1418 м3. Показания в выдаче - 8A050000, если читать байты справа налево, то получится 1418.

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.