Git Product home page Git Product logo

esphome-components's Introduction

ESPHome components

License ESPHome release Open in Visual Studio Code PayPal.Me Support author Support author

A collection of my ESPHome components.

To use this repository you should confugure it inside your yaml-configuration:

external_components:
  - source: github://dentra/esphome-components

Turn additional measurements features in your energy meter.

Gather energy statistics.

Get support of tariffs right in your energy meter.

Uptime sensor based on timestamp.

Save your config back to firmware and download it.

Turn your ZMAi-90 on V9821 chip into ESPHome device.

The MIOT Platform is alternative implementation of ESPHome Xiaomi BLE protocol. At this moment there are list of supported device:

And growing...

Now with automatic bindkey extraction from Xiaomi Cloud.

MIOT Platform based component to explore new BLE devices from Xiaomi ecosystem.

Obtain beakonkey for Yeelight Remote (YLYK01YL), Dimmer (YLKG07YL/YLKG08YL), Bathroom Heater Remote (YLYB01YL-BHFRC), Fan Remote (YLYK01YL-VENFAN) and Ventilator Fan Remote (YLYK01YL-FANCL).

Control Electrolux/Ballu/Zanussi Water Heater using uart protocol.

Control Tion Breezers Lite, 4S and 3S via BLE and UART protocol.

An ESP8266 remote crash detector.

Control partitions table from your yaml-configuration.

Configure storage and downloading ESP-IDF core dump.

Supports all BLE Qingping devices.

Your thanks

If this project was useful to you, you can buy me a Cup of coffee via PayPal, Card2Card, Boosty subscripion or or just star the project :)

esphome-components's People

Contributors

dentra avatar latonita avatar tmayad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar

esphome-components's Issues

Could not compiling the node with miot_mccgq02hl

Could not compiling the node with miot_mccgq02hl component

In file included from src/esphome/components/miot/miot_object.cpp:4:0:
src/esphome/components/miot/miot_object.h:24:19: warning: large integer implicitly truncated to unsigned type [-Woverflow]
uint8_t index = 0xFFFF;
^
In file included from src/esphome/components/miot/miot_object.cpp:3:0:
src/esphome/components/miot/miot_object.cpp: In member function 'esphome::optional esphome::miot::BLEObject::get_button_event() const':
src/esphome/core/log.h:95:100: warning: too many arguments for format [-Wformat-extra-args]
esp_log_printf_(ESPHOME_LOG_LEVEL_DEBUG, tag, LINE, ESPHOME_LOG_FORMAT(format), ##VA_ARGS)
^
src/esphome/core/log.h:155:28: note: in expansion of macro 'esph_log_d'
#define ESP_LOGD(tag, ...) esph_log_d(tag, VA_ARGS)
^
src/esphome/components/miot/miot_object.cpp:158:9: note: in expansion of macro 'ESP_LOGD'
ESP_LOGD(TAG, "Button rotate %s (pressed) knob, dimmer: %" PRIi8 ", value: " PRIi8,
^
In file included from src/esphome/core/component.h:7:0,
from src/esphome/components/miot/miot_object.h:5,
from src/esphome/components/miot/miot_object.cpp:4:
src/esphome/core/optional.h: In instantiation of 'esphome::optional::optional() [with T = const esphome::miot::ButtonEvent]':
src/esphome/components/miot/miot_object.cpp:125:3: required from here
src/esphome/core/optional.h:43:3: error: uninitialized const member in 'using value_type = const struct esphome::miot::ButtonEvent {aka const struct esphome::miot::ButtonEvent}' [-fpermissive]
optional() {}
^
src/esphome/core/optional.h:109:14: note: 'esphome::optional::value_type esphome::optional::value_' should be initialized
value_type value_; // NOLINT
^
*** [/data/ble_hub/.pioenvs/ble_hub/src/esphome/components/miot/miot_object.cpp.o] Error 1
========================== [FAILED] Took 1.98 seconds ==========================

add weekday to energy tariffs

Hi
It is possible to add "weekday" and "holiday" to tariffs component ?? :)

I mean, actually in Spain PVPC has 3 tariff , like P1 for peak (expensive), P2 for mid and P3 for valley (cheap)
but they are separated in weekday too
I mean, P1, P2 and P3 are used for working days (mon-fri), buy (sat-sun) are 24h all same P3 tariff
and to complicate this situation it adds national holidays that always are P3 (12 days over the year)
ThankU

Changing the mode and scene on a EraClean CW-BS01 doesn't seem to work

Hi @dentra,

I'm trying to control my EraClean CW-BS01. Whichever commands I send (setting the mode, the type of scene), be them from HA or directly from the ESP32 webserver don't actually change any settings on the device.
Is this caused by the fact that it is a work in progress? I can see from the logs that the command sent is still with the old settings (as exemplified in the first 3 lines of the below log).

Thanks in advance.

[10:11:01][D][select:062]: 'FRIDGE-AIR-PURIFIER Mode' - Setting
[10:11:01][D][select:115]: 'FRIDGE-AIR-PURIFIER Mode' - Set selected option to: Anion
[10:11:01][D][select:015]: 'FRIDGE-AIR-PURIFIER Mode': Sending state Keep - Freshing (index 1)
[10:11:08][D][ble_client:047]: Found device at MAC address [EC:4D:3E:BE:A7:6D]
[10:11:08][D][iBeacon:101]: UUID: 50765CB7-D9EA-4E21-99A4-FA879613A492
[10:11:08][I][ble_client:085]: Attempting BLE connection to ec:4d:3e:be:a7:6d
[10:11:10][I][ble_client:170]: Service UUID: 0x1801
[10:11:10][I][ble_client:171]:   start_handle: 0x1  end_handle: 0x4
[10:11:10][I][ble_client:383]:  characteristic 0x2A05, handle 0x3, properties 0x20
[10:11:10][I][ble_client:170]: Service UUID: 0x1800
[10:11:10][I][ble_client:171]:   start_handle: 0x5  end_handle: 0xd
[10:11:10][I][ble_client:383]:  characteristic 0x2A00, handle 0x7, properties 0x2
[10:11:10][I][ble_client:383]:  characteristic 0x2A01, handle 0x9, properties 0x2
[10:11:10][I][ble_client:383]:  characteristic 0x2A04, handle 0xb, properties 0x2
[10:11:10][I][ble_client:383]:  characteristic 0x2AA6, handle 0xd, properties 0x2
[10:11:10][I][ble_client:170]: Service UUID: 0xFE95
[10:11:10][I][ble_client:171]:   start_handle: 0xe  end_handle: 0x1c
[10:11:10][I][ble_client:383]:  characteristic 0x0004, handle 0x10, properties 0x2
[10:11:10][I][ble_client:383]:  characteristic 0x0010, handle 0x12, properties 0x14
[10:11:10][I][ble_client:383]:  characteristic 0x0019, handle 0x15, properties 0x14
[10:11:10][I][ble_client:383]:  characteristic 0x0017, handle 0x18, properties 0x18
[10:11:10][I][ble_client:383]:  characteristic 0x0018, handle 0x1b, properties 0x14
[10:11:10][I][ble_client:170]: Service UUID: 00000100-0065-6C62-2E74-6F696D2E696D
[10:11:10][I][ble_client:171]:   start_handle: 0x1d  end_handle: 0xffff
[10:11:10][I][ble_client:383]:  characteristic 00000101-0065-6C62-2E74-6F696D2E696D, handle 0x1f, properties 0x4
[10:11:10][I][ble_client:383]:  characteristic 00000102-0065-6C62-2E74-6F696D2E696D, handle 0x21, properties 0x10
[10:11:10][D][miot_standard_auth_client:090]: state=0xB (11)
[10:11:10][D][miot_standard_auth_client:090]: state=0xB (11)
[10:11:10][D][miot_standard_auth_client:090]: state=0x0 (0)
[10:11:10][D][miot_standard_auth_client:090]: state=0xD (13)
[10:11:10][D][miot_standard_auth_client:090]: state=0x0 (0)
[10:11:10][D][miot_standard_auth_client:090]: state=0xC (12)
[10:11:10][D][miot_standard_auth_client:090]: state=0xC (12)
[10:11:10][D][miot_standard_auth_client:090]: state=0xA (10)
[10:11:10][D][miot_standard_auth_client:090]: state=0xA (10)
[10:11:10][I][miot_standard_auth_client:062]: Login Success
[10:11:10][D][miot_cwbs01.api:156]: Request state
[10:11:10][D][miot_cwbs01.api:206]: Set mode 1
[10:11:10][D][text_sensor:067]: 'FRIDGE-AIR-PURIFIER Version': Sending state '1.1.1_0008'
[10:11:10][D][miot_cwbs01.api:073]: Got state: 5B.F5.FF.3F
[10:11:10][D][select:015]: 'FRIDGE-AIR-PURIFIER Mode': Sending state Keep - Freshing (index 1)
[10:11:10][D][select:015]: 'FRIDGE-AIR-PURIFIER Scene': Sending state Middle refrigerator (150L - 300L) (index 1)
[10:11:10][D][sensor:125]: 'FRIDGE-AIR-PURIFIER Battery Level': Sending state 90.00000 % with 0 decimals of accuracy
[10:11:10][I][ble_client:075]: [ec:4d:3e:be:a7:6d] Disabling BLE client.

How can i get a MAC Address from miot_ylyk01yl?

Good afternoon!

I have studied your repository and found two ways to interact and find the binding key for the ylyk01yl remote control.

However, after trying your examples, I still don't understand where to get the BLE MAC address from? At the moment I have 4 remote controls and 3 more at a friend's house. Each remote control has its own MAC address. I want to connect to ESP 32, but I need to specify a specific address. How do I find and then automatically pass this address to the "mac_address: <device-mac address"> function automatically?

Perhaps it is possible, but I do not know enough information for this, since I have not encountered YAML and ESP HOME before.

Can't compile the code with new esphome versions

Compile errors with esphome: 2022.5.1

src/esphome/components/energy_tariffs/energy_tariffs.cpp: In member function 'virtual void esphome::energy_tariffs::EnergyTariffs::setup()':
src/esphome/components/energy_tariffs/energy_tariffs.cpp:37:27: error: 'class esphome::number::Number' has no member named 'set'
37 | this->time_offset_->set(loaded);
| ^~~
Compiling /data/xxxxx/.pioenvs/xxxxx/src/esphome/components/number/automation.cpp.o
*** [/data/xxxxx/.pioenvs/xxxxx/src/esphome/components/energy_tariffs/energy_tariffs.cpp.o] Error 1

Manual EraClean Intelligent Deodorizer Max

Thanks for this component. EraClean Intelligent Deodorizer Max is perfectly controlled and the sensors work. I want to add for reference, so that there is an understanding if someone also receives the Failed login: 0x0023 error. I ran into a problem and here I did not find an answer. Then I realized the reason why the Failed login error occurred: 0x0023. EraClean Intelligent Deodorizer Max does not support multiple connections and if the phone where MiHome is installed and bluetooth is enabled, then EraClean Intelligent Deodorizer Max will connect to the phone by default and esp32 will lose contact with EraClean Intelligent Deodorizer Max. In the logs, ESPHome will receive the Failed login error: 0x0023

Enable logging

logger:
  level: DEBUG

Log with connection error, where we see Failed login: 0x0023

[12:15:20][D][esp32_ble_client:048]: [0] [XX:XX:XX:XX:XX:XX] Found device
[12:15:20][D][esp32_ble_tracker:213]: Pausing scan to make connection...
[12:15:20][I][esp32_ble_client:064]: [0] [XX:XX:XX:XX:XX:XX] 0x00 Attempting BLE connection
[12:15:23][I][esp32_ble_client:196]: [0] [XX:XX:XX:XX:XX:XX] Connected
[12:15:23][D][esp32_ble_tracker:245]: Starting scan...
[12:15:23][D][miot_standard_auth_client:090]: state=0xB (11)
[12:15:24][D][miot_standard_auth_client:090]: state=0xB (11)
[12:15:24][D][miot_standard_auth_client:090]: state=0x0 (0)
[12:15:24][D][miot_standard_auth_client:090]: state=0xD (13)
[12:15:24][D][miot_standard_auth_client:090]: state=0x0 (0)
[12:15:24][D][miot_standard_auth_client:090]: state=0xC (12)
[12:15:24][D][miot_standard_auth_client:090]: state=0xC (12)
[12:15:24][W][miot_standard_auth_client:212]: Fail compare
[12:15:24][D][miot_standard_auth_client:090]: state=0xA (10)
[12:15:24][D][miot_standard_auth_client:090]: state=0xA (10)
[12:15:24][W][miot_standard_auth_client:069]: Failed login: 0x0023
[12:20:07][I][ota:113]: Boot seems successful, resetting boot loop counter.

Whatever happens, there is Bluetooth support on the phone with the MiHome connected, and the esp 32 can easily establish a connection with the EraClean Max intelligent deodorant.

14:24:12	[D]	[esp32_ble_client:048]	
[0] [XX:XX:XX:XX:XX:XX] Found device
14:24:12	[D]	[esp32_ble_tracker:213]	
Pausing scan to make connection...
14:24:12	[I]	[esp32_ble_client:064]	
[0] [XX:XX:XX:XX:XX:XX] 0x00 Attempting BLE connection
14:24:14	[I]	[esp32_ble_client:196]	
[0] [XX:XX:XX:XX:XX:XX] Connected
14:24:14	[D]	[esp32_ble_tracker:245]	
Starting scan...
14:24:14	[D]	[miot_standard_auth_client:090]	
state=0xB (11)
14:24:14	[D]	[miot_standard_auth_client:090]	
state=0xB (11)
14:24:14	[D]	[miot_standard_auth_client:090]	
state=0x0 (0)
14:24:14	[D]	[miot_standard_auth_client:090]	
state=0x0 (0)
14:24:14	[D]	[miot_standard_auth_client:090]	
state=0xD (13)
14:24:14	[D]	[miot_standard_auth_client:090]	
state=0x0 (0)
14:24:14	[D]	[miot_standard_auth_client:090]	
state=0xC (12)
14:24:14	[D]	[miot_standard_auth_client:090]	
state=0xC (12)
14:24:15	[D]	[miot_standard_auth_client:090]	
state=0xA (10)
14:24:15	[D]	[miot_standard_auth_client:090]	
state=0xA (10)
14:24:15	[I]	[miot_standard_auth_client:062]	
Login Success

format_hex_pretty not declared

EDIT: It compiled fine using the dev release of ESPHome. (find solution on esphome/feature-requests#1469)

i have this error when compiling.
the code previously worked, nothing has been changed.

src/esphome/components/miot/miot.cpp:54:76: error: 'format_hex_pretty' was not declared in this scope ESP_LOGW(TAG, "Invalid MiBeacon data length: %s", format_hex_pretty(raw).c_str());

image

error.txt

miot_ylai003

Hello, I installed your component (mipt_ylai003), everything works fine, everything is displayed in the esp home logs. But I can't figure out how to use it in the home assistant, since my button is not displayed there.

platform: miot_mccgq02hl

 Hi, i am using "ESPHome Current version: 2022.11.5". I just updated and i was looking to integrate one of Xiaomi mccgq02hl sensors in my ESP32 bluetooth tracker.
 I am not sure if i am doying it wrong or is some incompatibility issue. With this ESP32 i have succesfully integrated "platform: atc_mithermometer" sensors, yet i have these door sensors that i never managed to integrate.

The error i got is: "Failed config

binary_sensor.miot_mccgq02hl: [source /config/esphome/bt-scanner.yaml:90]"
[opening] is an invalid option for [binary_sensor.miot_mccgq02hl]. Please check the indentation.
opening:
name: Door sensor open

This is my ESP configuration:

  • platform: miot_mccgq02hl
    name: mccgq02hl
    mac_address: E4:AA:EC:36:D9:3A
    bindkey: "####"
    battery_level:
    name: "Door sensor battery level"
    light:
    name: "Door sensor light"
    opening:
    name: "Door sensor open"

mi rubiks cube

Add support for mi rubik's cube. I'm not sure if this will be useful, but it's a cool joke if someone spins my dice =). It is activated if you repeat 4 identical turns

Buliding error on ESPHOME 2022.3

ERROR Unable to load component miot_mccgq02hl.binary_sensor:
Traceback (most recent call last):
  File "/esphome/esphome/loader.py", line 162, in _lookup_module
    module = importlib.import_module(f"esphome.components.{domain}")
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/esphome/.esphome/external_components/2f2a5be3/components/miot_mccgq02hl/binary_sensor.py", line 27, in <module>
    ): binary_sensor.device_class,
AttributeError: module 'esphome.components.binary_sensor' has no attribute 'device_class'
ERROR Unable to load component miot_mccgq02hl.binary_sensor:
Traceback (most recent call last):
  File "/esphome/esphome/loader.py", line 162, in _lookup_module
    module = importlib.import_module(f"esphome.components.{domain}")
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/esphome/.esphome/external_components/2f2a5be3/components/miot_mccgq02hl/binary_sensor.py", line 27, in <module>
    ): binary_sensor.device_class,
AttributeError: module 'esphome.components.binary_sensor' has no attribute 'device_class'

RTCGQ02LM Timeout and Idle Time

Hi there,

Got it working now thanks but I had a question about the timeout and idle_time. What are these used for and are they configurable? I know this sensor doesn't send a motion cleared event so there needs to be a way to tell HA the sensor has reset just wondering how these two entities function.

Error does not accept sensor name

Error does not accept sensor name

  - platform: miot_explorer
    # String (Required), device MAC-address.
    mac_address: "A4:*******:51"
    # String, (Optional), device bind key
    bindkey: "****************"
    # String, (Required), the name of sensor
    name: "name1"
![7e168fcc81](https://github.com/dentra/esphome-components/assets/30213708/56098953-7fd1-4611-b5f3-f8d08969c009)

src/esphome/components/miot_explorer/miot_explorer.cpp: In member function 'void esphome::miot_explorer::MiotExplorer::process_string_(esphome::miot::MIID, const string&, const string&)':
src/esphome/components/miot_explorer/miot_explorer.cpp:87:49: error: no matching function for call to 'esphome::text_sensor::TextSensor::set_name(std::__cxx11::basic_string<char>)'

Problem with ESPHome firmware on ZMAi-90 WB3S V3

Hi!
Can you help me with the ZMAi-90 counter firmware? I bought several pieces with a WB3S chip, replaced the chip with an ESP-12F and used your firmware for version 2, but it does not work on this counter modification.

Compiling error for energy statistics - std::isnan

Hey,

Thanks for publishing this. I'm trying to use this with a Sonoff S31. Your example assumes the device provides a total energy sensor but this device does not. I'm hoping I can just use the integral sensor of the power to accomplish this. But when I try to compile on the latest dev version of esphome, it fails with the following error:

Processing esphome_garage_controls_s31 (board: esp01_1m; framework: arduino; platform: platformio/espressif8266 @ 2.6.2)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 3.20704.0 (2.7.4) 
 - tool-esptool 1.413.0 (4.13) 
 - tool-esptoolpy 1.20800.0 (2.8.0) 
 - toolchain-xtensa 2.40802.200502 (4.8.2)
Library Manager: Installing Update
Library Manager: Already installed, built-in library
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.3
|   |-- <ESP8266WiFi> 1.0
|-- <ESPAsyncWebServer-esphome> 1.3.0
|   |-- <ESPAsyncTCP-esphome> 1.2.3
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <ArduinoJson-esphomelib> 5.13.3
|-- <ESP8266WiFi> 1.0
|-- <ArduinoJson-esphomelib> 5.13.3
|-- <ESP8266mDNS> 1.2
|   |-- <ESP8266WiFi> 1.0
|-- <noise-c> 0.1.3
|   |-- <libsodium> 1.10018.1
|-- <DNSServer> 1.1.1
|   |-- <ESP8266WiFi> 1.0
Compiling .pioenvs/esphome_garage_controls_s31/src/esphome/components/energy_statistics/energy_statistics.cpp.o
src/esphome/components/energy_statistics/energy_statistics.cpp: In member function 'virtual void esphome::energy_statistics::EnergyStatistics::loop()':
src/esphome/components/energy_statistics/energy_statistics.cpp:51:18: error: 'isnan' was not declared in this scope
   if (isnan(total)) {
                  ^
src/esphome/components/energy_statistics/energy_statistics.cpp:51:18: note: suggested alternative:
In file included from src/esphome/core/component.h:5:0,
                 from src/esphome/components/energy_statistics/energy_statistics.h:3,
                 from src/esphome/components/energy_statistics/energy_statistics.cpp:2:
/config/.esphome/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/cmath:632:5: note:   'std::isnan'
     isnan(_Tp __x)
     ^
src/esphome/components/energy_statistics/energy_statistics.cpp: In member function 'void esphome::energy_statistics::EnergyStatistics::process_(float)':
src/esphome/components/energy_statistics/energy_statistics.cpp:78:62: error: 'isnan' was not declared in this scope
   if (this->energy_today_ && !isnan(this->energy_.start_today)) {
                                                              ^
src/esphome/components/energy_statistics/energy_statistics.cpp:78:62: note: suggested alternative:
In file included from src/esphome/core/component.h:5:0,
                 from src/esphome/components/energy_statistics/energy_statistics.h:3,
                 from src/esphome/components/energy_statistics/energy_statistics.cpp:2:
/config/.esphome/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/cmath:632:5: note:   'std::isnan'
     isnan(_Tp __x)
     ^
src/esphome/components/energy_statistics/energy_statistics.cpp:82:70: error: 'isnan' was not declared in this scope
   if (this->energy_yesterday_ && !isnan(this->energy_.start_yesterday)) {
                                                                      ^
src/esphome/components/energy_statistics/energy_statistics.cpp:82:70: note: suggested alternative:
In file included from src/esphome/core/component.h:5:0,
                 from src/esphome/components/energy_statistics/energy_statistics.h:3,
                 from src/esphome/components/energy_statistics/energy_statistics.cpp:2:
/config/.esphome/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/cmath:632:5: note:   'std::isnan'
     isnan(_Tp __x)
     ^
src/esphome/components/energy_statistics/energy_statistics.cpp:86:60: error: 'isnan' was not declared in this scope
   if (this->energy_week_ && !isnan(this->energy_.start_week)) {
                                                            ^
src/esphome/components/energy_statistics/energy_statistics.cpp:86:60: note: suggested alternative:
In file included from src/esphome/core/component.h:5:0,
                 from src/esphome/components/energy_statistics/energy_statistics.h:3,
                 from src/esphome/components/energy_statistics/energy_statistics.cpp:2:
/config/.esphome/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/cmath:632:5: note:   'std::isnan'
     isnan(_Tp __x)
     ^
src/esphome/components/energy_statistics/energy_statistics.cpp:90:62: error: 'isnan' was not declared in this scope
   if (this->energy_month_ && !isnan(this->energy_.start_month)) {
                                                              ^
src/esphome/components/energy_statistics/energy_statistics.cpp:90:62: note: suggested alternative:
In file included from src/esphome/core/component.h:5:0,
                 from src/esphome/components/energy_statistics/energy_statistics.h:3,
                 from src/esphome/components/energy_statistics/energy_statistics.cpp:2:
/config/.esphome/platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include/c++/4.8.2/cmath:632:5: note:   'std::isnan'
     isnan(_Tp __x)
     ^
*** [.pioenvs/esphome_garage_controls_s31/src/esphome/components/energy_statistics/energy_statistics.cpp.o] Error 1
========================== [FAILED] Took 4.35 seconds ==========================

Relevant config:

external_components:
### https://github.com/dentra/esphome-components/
  - source:
      type: git
      url: https://github.com/dentra/esphome-components
    components: 
    - energy_statistics


sensor:
- platform: integration
  name: "${friendly_name} Total Energy"
  id: total_energy_by_integration
  sensor: s31_power
  time_unit: h
  unit_of_measurement: "kWh"
  filters:
    - multiply: 0.001
  accuracy_decimals: 3
  restore: true
  state_class: total_increasing


- platform: "energy_statistics"
  total: total_energy_by_integration
  energy_today:
    name: "${friendly_name} Energy Today"
  energy_yesterday:
    name: "${friendly_name} Energy Yesterday"
  energy_week:
    name: "${friendly_name} Energy Week"
  energy_month:
    name: "${friendly_name} Energy Month"


- platform: cse7766
  update_interval: 10s
  current:
    name: "${friendly_name} Current"
  voltage:
    name: "${friendly_name} Voltage"
  power:
    name: "${friendly_name} Power"
    id: s31_power
    unit_of_measurement: W
    filters:
      - delta: 3.0
    on_value:
      then:
        - sensor.template.publish:
            id: s31_power_kw
            state: !lambda '{ return x; }'
- platform: template
  name: "${friendly_name} in kW"
  id: s31_power_kw
  internal: true
  filters:
    - delta: 5
    - debounce: 5s
    - multiply: 0.001
  unit_of_measurement: "kW"
  accuracy_decimals: 3

Accuracy of Energy Statistics component?

Hey,
I've added your component to my Sonoff S31 and see the data is pretty different from the native component. Have you done a similar check? Wondering if it's my config, device, or one of the components? The data from your component averages being 55% of the native component.

Comparison of daily max for garage_controls_s31_energy_today vs garage_controls_s31_total_daily_energy_native_esphome_component.
image

date dentra native delta
9/7/23 0.67 1.3 52%
9/8/23 0.4 0.705 57%
9/9/23 0.37 0.72 51%
9/10/23 0.29 0.547 53%
9/11/23 0.66 1.21 55%
9/12/23 0.46 0.875 53%
9/13/23 0.36 0.688 52%
9/14/23 0.75 1.43 52%
9/15/23 0.29 0.406 71%
9/16/23 0.37 0.648 57%
9/17/23 0.11 0.211 52%
55%

My code:

external_components:
- source: github://dentra/esphome-components

sensor:
- platform: cse7766
  update_interval: 10s
  current:
    name: "${friendly_name} Current"
  voltage:
    name: "${friendly_name} Voltage"
  power:
    name: "${friendly_name} Power"
    id: s31_power
    unit_of_measurement: "W"
    filters:
      - delta: 3.0
    on_value:
      then:
        - sensor.template.publish:
            id: s31_power_kw
            state: !lambda '{ return x; }'
- platform: template
  name: "${friendly_name} in kW"
  id: s31_power_kw
  internal: true
  filters:
    - delta: 5
    - multiply: 0.001
  unit_of_measurement: "kW"
  accuracy_decimals: 3

- platform: total_daily_energy
  name: "${friendly_name} Total Daily Energy (Native ESPHome Component)"
  power_id: s31_power_kw

- platform: integration
  name: "${friendly_name} Total Energy"
  id: total_energy_by_integration
  sensor: s31_power
  time_unit: h
  unit_of_measurement: "kWh"
  filters:
    - multiply: 0.001
  accuracy_decimals: 3
  restore: true
  state_class: total_increasing


- platform: "energy_statistics"
  total: total_energy_by_integration
  energy_today:
    name: "${friendly_name} Energy Today"
  energy_yesterday:
    name: "${friendly_name} Energy Yesterday"
  energy_week:
    name: "${friendly_name} Energy Week"
  energy_month:
    name: "${friendly_name} Energy Month"

Issue with miot_mccgq02hl

I got issue with integrating binary sensor miot_mccgq02hl:

 File ".esphome\external_components\d5822579\components\miot_mccgq02hl\binary_sensor.py", line 10, in <module>
    from .. import miot  # pylint: disable=relative-beyond-top-level
  File ".esphome\external_components\d5822579\components\miot\__init__.py", line 23, in <module>
    from .. import xiaomi_account  # pylint: disable=relative-beyond-top-level
  File ".esphome\external_components\d5822579\components\xiaomi_account\__init__.py", line 13, in <module>
    from .xiaomi_account import XiaomiAccount
  File ".esphome\external_components\d5822579\components\xiaomi_account\xiaomi_account.py", line 12, in <module>
    class XiaomiAccount:
  File ".esphome\external_components\d5822579\components\xiaomi_account\xiaomi_account.py", line 17, in XiaomiAccount
    servers: list[str],
TypeError: 'type' object is not subscriptable←[0m

(esphome 2022.8.3)

ZMAi-90 V3 solution?

Hi, I read that you have solution for V3 of ZMAi-90 energy meter/switch. I replaced WB3S MCU by ESP8266 12E.
I have connection to unit, but the switch does not work and is off. The device has V9821S mcu for the measuring part.
If you could give me a hint, it would be great!

LYWSD02MMC is not working

Despite providing the bindkey packets from LYWSD02MMC cannot be decoded:

[19:04:51][W][miot:193]: A4C138693D61 [16E4] Unhandled object attribute: 4C02, value: 43
[19:04:51][D][miot:146]: Got MiBeacon: 58.58.E4.16.7E.64.3D.89.38.C1.A4.23.B3.43.C1.7F.84.00.F1.63.64.07 (22)
[19:04:51][D][miot:149]:    [16E4] (encrypted) A4:C1:38:69:3D:61 RSSI=-62 ▂▄▆█
[19:04:55][W][miot:193]: A4C138693D61 [16E4] Unhandled object attribute: 4C02, value: 43
[19:04:55][D][miot:146]: Got MiBeacon: 58.58.E4.16.82.64.3D.89.38.C1.A4.F5.FF.24.A0.7F.84.00.9C.89.82.DB (22)
[19:04:55][D][miot:149]:    [16E4] (encrypted) A4:C1:38:69:3D:61 RSSI=-75 ▂▄▆█
[19:05:00][W][miot:193]: A4C138693D61 [16E4] Unhandled object attribute: 4C02, value: 43
[19:05:00][D][miot:146]: Got MiBeacon: 58.58.E4.16.86.64.3D.89.38.C1.A4.18.44.1B.76.7F.84.00.3C.42.41.43 (22)
[19:05:00][D][miot:149]:    [16E4] (encrypted) A4:C1:38:69:3D:61 RSSI=-61 ▂▄▆█
[19:05:02][W][miot:193]: A4C138693D61 [16E4] Unhandled object attribute: 4C02, value: 43
[19:05:02][D][miot:146]: Got MiBeacon: 58.58.E4.16.88.64.3D.89.38.C1.A4.6C.F9.AD.06.7F.84.00.D8.A5.8A.7D (22)
[19:05:03][D][miot:149]:    [16E4] (encrypted) A4:C1:38:69:3D:61 RSSI=-74 ▂▄▆█
[19:05:05][W][miot:193]: A4C138693D61 [16E4] Unhandled object attribute: 4C02, value: 43
[19:05:05][D][miot:146]: Got MiBeacon: 58.58.E4.16.8A.64.3D.89.38.C1.A4.28.A9.1E.81.7F.84.00.C9.2E.3D.EC (22)
[19:05:05][D][miot:149]:    [16E4] (encrypted) A4:C1:38:69:3D:61 RSSI=-62 ▂▄▆█

Can you please help with that? Thanks!

missing file while compiling esphome-components/components/crash_info/

Hi,
i am using ESPHome in Home Assistant OS
while compiling i get this message:
crash_info.cpp:1:28: fatal error: user_interface.h: No such file or directory

here is the part of the ESPHome device yaml:

####
# Crash Info
#  An ESP8266 remote crash detector. With enabled indicator you can monitor crashes right from your Home Assistant.
# https://github.com/dentra/esphome-components/tree/master/components/crash_info
####
external_components:
  - source:
      type: local
      path: my_custom_components/crash_info

crash_info:
  id: crash_info_obj
  # Optional, uint32. The number of stack frames to be saved.
  max_stack_frames_size: 10
  # Optional, uint32. Minimum address of stack frame to be saved. Default: 0x40000000.
  min_stack_frames_addr: 0x40000000
  # Optional, uint32. Maximum address of stack frame to be saved. Default: 0x50000000.
  max_stack_frames_addr: 0x50000000
  # Optional, binary_sensor. Crash indicator.
  indicator:
    name: $friendly_devicename Crash state
  # Optional, boolean. Store backtrace in FLASH or RTC. Default: false.
  store_in_flash: false

# Add button to reset state of crash.
button:
  - platform: template
    name: $friendly_devicename Reset crash state
    on_press:
      lambda: id(crash_info_obj).reset();

# Add sntp or homeassistant time platform to enable saving crash time.
time:
  - platform: homeassistant
    id: homeassistant_time

where can i find the user_interface.h file which is included in line 1 of crash_info.cpp file?

Could not compiling the node with miot_mccgq02hl component, after update ESPHome to 2021.10.0 version

Could not compiling the node with miot_mccgq02hl component, after update ESPHome to 2021.10.0 version

ERROR Unable to import component miot_mccgq02hl.binary_sensor:
Traceback (most recent call last):
  File "/esphome/esphome/loader.py", line 162, in _lookup_module
    module = importlib.import_module(f"esphome.components.{domain}")
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/esphome/.esphome/external_components/2f2a5be3/components/miot_mccgq02hl/binary_sensor.py", line 3, in <module>
    from esphome.components import miot, binary_sensor
  File "/config/esphome/.esphome/external_components/2f2a5be3/components/miot/__init__.py", line 8, in <module>
    from esphome.const import (
ImportError: cannot import name 'ESP_PLATFORM_ESP32' from 'esphome.const' (/esphome/esphome/const.py)
...
...

Can't get Mi Smart Kettle Pro working

Hey there, I've tried to integrate the Mi Smart Kettle Pro using this documentation with my esphome, but the state of the sensors are still unknown

Here is my configuration:

external_components:
  - source: github://dentra/esphome-components

binary_sensor:
  - platform: miot_kettle
    # String (Required), device MAC-address.
    mac_address: A4:C1:38:8B:72:7F
    # String, (Optional), device bind key. Will use "xiaomi_account" from "miot" if absent to automaticaly get the bindkey.
    bindkey: "5F3*************"
    # String, (Optional), the name of binary sensor
    name: "Kettle Water Boil Power"
    # Sensor (Optional), Temperature, °C
    temperature:
      name: "Kettle Water Boil Temperature"

Here is the log output:

[00:46:20][C][miot_kettle:243]: Xiaomi universal kettle
[00:46:20][C][miot_kettle:245]:   MAC: a4:c1:38:8b:72:7f
[00:46:20][C][miot_kettle:247]:   Bindkey: 5F.**.**.**.**.**.**.**.**.**.**.**.**.**.**.** (16)
[00:46:20][C][miot_kettle:011]:   Water Boil Power 'Kettle Water Boil Power'
[00:46:20][C][miot_kettle:011]:     Device Class: 'power'
[00:46:20][C][miot_kettle:012]:  Water Boil Temperature 'Kettle Water Boil Temperature'
[00:46:20][C][miot_kettle:012]:    Device Class: 'temperature'
[00:46:20][C][miot_kettle:012]:    Accuracy Decimals: 1
....
[00:46:20][D][miot.automation:009]:   Product ID: 09E0
[00:46:20][D][miot.automation:010]:   Frame Control:
[00:46:20][D][miot.automation:011]:     is_encrypted      : NO
[00:46:20][D][miot.automation:012]:     mac_include       : YES
[00:46:20][D][miot.automation:013]:     capability_include: YES
[00:46:20][D][miot.automation:014]:     object_include    : NO
[00:46:20][D][miot.automation:015]:     mesh              : NO
[00:46:20][D][miot.automation:016]:     registered        : NO
[00:46:20][D][miot.automation:017]:     solicited         : NO
[00:46:20][D][miot.automation:018]:     auth_mode         : 2
[00:46:20][D][miot.automation:019]:     version           : 5
[00:46:20][D][miot.automation:020]:   Frame Counter: 1
[00:46:20][D][miot.automation:023]:   MAC address: a4:c1:38:8b:72:7f
[00:46:20][D][miot.automation:026]:   Capability:
[00:46:20][D][miot.automation:027]:     connectable : NO
[00:46:20][D][miot.automation:028]:     centralable : NO
[00:46:20][D][miot.automation:029]:     encryptable : NO
[00:46:20][D][miot.automation:030]:     bond_ability: 1
[00:46:20][D][miot.automation:031]:     io          : YES
[00:46:20][D][miot.automation:035]:     can_enter_digits     : YES
[00:46:20][D][miot.automation:036]:     can_enter_letters    : NO
[00:46:20][D][miot.automation:037]:     can_read_nfc_tags    : NO
[00:46:20][D][miot.automation:038]:     can_recognize_qr_code: NO
[00:46:20][D][miot.automation:039]:     can_output_digits    : NO
[00:46:20][D][miot.automation:040]:     can_output_letters   : NO
[00:46:20][D][miot.automation:041]:     can_generate_nfc_tag : NO
[00:46:20][D][miot.automation:042]:     can_generate_qr_code : NO

And here are screenshots of the sensors states:
image
image

What am I missing here?

Many compile errors

Hi, thank you for this component!

I am running ESPhome 2022.1.2 on Supervised HAS (Debian) 2021.12.10.

My yaml file:

esp32_ble_tracker:

external_components:
  - source: github://dentra/esphome-components
  
binary_sensor:
  - platform: miot_mccgq02hl
    mac_address: ${MCCGQ02HL_1_mac}
    bindkey: ${MCCGQ02HL_1_bindkey}
    name: ${MCCGQ02HL_1_name}
    light:
      name: ${MCCGQ02HL_1_name} Light
    alert:
      name: ${MCCGQ02HL_1_name} Alert
    battery_level:
      name: ${MCCGQ02HL_1_name} Bat
    battery_voltage:
      name: ${MCCGQ02HL_1_name} Bat Volt.

sensor:
- platform: ble_rssi
  mac_address: ${MCCGQ02HL_1_mac}
  name: ${MCCGQ02HL_1_name} BLE RSSI
  entity_category: "diagnostic"

and in the parent file:

substitutions:
  MCCGQ02HL_1_mac: "E4:AA:EC:45:10:B4"
  MCCGQ02HL_1_bindkey: "edded93604df960caed5d47f"
  MCCGQ02HL_1_name: "MCCGQ02HL Door 1 "

The errors are many (20-30), I'll list the first few
src/esphome/components/miot/miot_decrypt.h:13:31: error: 'MiotListener' does not name a type bool decrypt_mibeacon45(const MiotListener *listener, MiBeacon &mib);

src/esphome/components/miot/miot_decrypt.h:13:55: error: 'MiBeacon' has not been declared bool decrypt_mibeacon45(const MiotListener *listener, MiBeacon &mib);

src/esphome/components/miot/miot_dump.cpp:8:40: error: 'MiBeacon' does not name a type void dump(const char *const TAG, const MiBeacon &mib) {

src/esphome/components/miot/miot_dump.cpp:9:43: error: request for member 'product_id' in 'mib', which is of non-class type 'const int' ESP_LOGD(TAG, " Product ID: %04X", mib.product_id);

src/esphome/components/miot/miot_dump.cpp:11:57: error: request for member 'frame_control' in 'mib', which is of non-class type 'const int' ESP_LOGD(TAG, " is_encrypted : %s", YESNO(mib.frame_control.is_encrypted));

src/esphome/components/miot/miot_dump.cpp:22:16: error: 'mac_reverse' was not declared in this scope auto mac = mac_reverse(mib.mac_address);

src/esphome/components/miot/miot_dump.cpp:23:37: error: expected ')' before 'ESP_BD_ADDR_STR' ESP_LOGD(TAG, " MAC address: " ESP_BD_ADDR_STR, mac[5], mac[4], mac[3], mac[2], mac[1], mac[0]);

I have cleaned all build files, but the errors persist.

Most likely I am doing something wrong, can you please help?

Device uptime sensor

is there is something wrong with uptime sensor?

image

the code
`external_components:

  • source: github://dentra/esphome-components

sensor:

  • platform: startup
    name: Device Uptime`

I can't compile the file, I don't have enough knowledge

help me install your plugin. I add the text from the example to the bluetooth_hub.yaml file, but I get an error when cospiling with the esphome run bluetooth_hub.yaml command

python version 3.10
esphome 2021.9.3
macOS 11.6 Big Sur

If possible, make a complete schedule of commands how to download or download missing data by command

`xrust@MacBook-Pro-Wadim documents % esphome run bluetooth_hub.yaml
INFO Reading configuration bluetooth_hub.yaml...
INFO Cloning https://github.com/dentra/esphome-components.git@None
Failed config

external_components: [source bluetooth_hub.yaml:11]

  • [source bluetooth_hub.yaml:11]

    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun.
    source: github://dentra/esphome-components [source bluetooth_hub.yaml:11]
    xrust@MacBook-Pro-Wadim documents %
    `

ZMAI-90 v1: ¿Status?

Hi, I have a couple of questions:

Is it possible to know the status of the switch?
Is it possible to act on it from HA or from webserver?

The supply has been cut and when the switch returns to the zmai it stays off, having to manually press the button to return the supply, so I wonder if you can see that information.

ZMAI90v1 error in update

When I try to upgrade to version 2021.10 or 2021.11 I get this error.

Do I have to make any changes?

image

miot_mccgq02hl error won't compile "collect2: error: ld returned 1 exit status"

Hi,

This is my yaml config:

esphome:
  name: esppoe-4
  friendly_name: esppoe-4
  name_add_mac_suffix: true
  project:
    name: esphome.bluetooth-proxy
    version: "1.0"


esp32:
  board: m5stack-core-esp32
  framework:
    type: esp-idf

# Enable logging
logger:

# Keep this for remote flashing capability
ota:

# Network interface for PoESP32
ethernet:
  type: IP101
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO0_IN
  phy_addr: 1
  power_pin: GPIO5

api:
  encryption:
    key: "kwgXOnw6i3lnKGVB+4AkA2YqmRSCrY3gi2SomEDE1lo="

external_components:
  - source: github://dentra/esphome-components


binary_sensor:
  - platform: gpio
    pin:
      number: 17
      inverted: true
    name: "BlueButton Door"
    id: "BlueButton"
    on_press:
      - logger.log: "Blue button door pressed"
  - platform: gpio
    pin: 
      number: 16
      inverted: true
    name: "RedButton Door"
    id: "RedButton"
    on_press:
      - logger.log: "Red button door pressed"



  - platform: miot_mccgq02hl
    # String (Required), device MAC-address.
    mac_address: "E4:AA:EC:71:D4:27"
    # String, (Optional), device bind key. Will use "xiaomi_account" from "miot" if absent to automaticaly get the bindkey.
    bindkey: "4bee582512114112c956f122f741da59"
     # String, (Optional), the name of binary sensor
    name: "$name Door/Window Sensor"
    # BinarySensor (Optional), Light intensivity: on - strong light, off - weak light
    light:
      name: "$name Light"
    # BinarySensor (Optional), Alert enabled when door/window has opened for a long (device configured) time
    alert:
      name: "$name Alert"
    # Sensor (Optional), Battey Level, %
    battery_level:
      name: "$name Battery Level"
    # Sensor (Optional), Battey Voltage, V
    battery_voltage:
      name: "$name Battery Voltage"

dashboard_import:
  package_import_url: github://esphome/bluetooth-proxies/m5stack-atom-lite.yaml@main

esp32_ble_tracker:
  scan_parameters:
    active: true

bluetooth_proxy:
  active: true

button:
  - platform: safe_mode
    name: Safe Mode Boot
    entity_category: diagnostic

I get this error when compiling: 

INFO ESPHome 2023.8.1
INFO Reading configuration /config/esphome/esppoe-4.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esppoe-4 (board: m5stack-core-esp32; framework: espidf; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf @ 3.40405.230623 (4.4.5) 
 - tool-cmake @ 3.16.4 
 - tool-ninja @ 1.7.1 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Reading CMake configuration...
Dependency Graph
|-- noise-c @ 0.1.4
Compiling /data/esppoe-4/.pioenvs/esppoe-4/src/main.o
Linking /data/esppoe-4/.pioenvs/esppoe-4/firmware.elf
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection17send_sensor_stateEPNS_6sensor6SensorEf+0x8): undefined reference to `esphome::sensor::Sensor::has_state() const'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection16send_sensor_infoEPNS_6sensor6SensorE+0x4): undefined reference to `esphome::sensor::Sensor::get_accuracy_decimals()'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/esphome/components/api/api_connection.o:(.literal._ZN7esphome3api13APIConnection16send_sensor_infoEPNS_6sensor6SensorE+0x8): undefined reference to `esphome::sensor::Sensor::get_state_class()'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/esphome/components/api/api_connection.o: in function `esphome::api::APIConnection::send_sensor_state(esphome::sensor::Sensor*, float)':
/config/esphome/.esphome/build/esppoe-4/src/esphome/components/api/api_connection.cpp:431: undefined reference to `esphome::sensor::Sensor::has_state() const'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/esphome/components/api/api_connection.o: in function `esphome::api::APIConnection::send_sensor_info(esphome::sensor::Sensor*)':
/config/esphome/.esphome/build/esppoe-4/src/esphome/components/api/api_connection.cpp:444: undefined reference to `esphome::sensor::Sensor::get_accuracy_decimals()'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /config/esphome/.esphome/build/esppoe-4/src/esphome/components/api/api_connection.cpp:446: undefined reference to `esphome::sensor::Sensor::get_state_class()'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o:(.literal._Z5setupv+0xb8): undefined reference to `vtable for esphome::miot_mccgq02hl::MiotMCCGQ02HL'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o:(.literal._Z5setupv+0xbc): undefined reference to `vtable for esphome::miot_mccgq02hl::MiotMCCGQ02HL'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o:(.literal._Z5setupv+0xc0): undefined reference to `vtable for esphome::miot_mccgq02hl::MiotMCCGQ02HL'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o:(.literal._Z5setupv+0x120): undefined reference to `vtable for esphome::miot::MiBeaconTracker'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o:(.literal._Z5setupv+0x124): undefined reference to `vtable for esphome::miot::MiBeaconTracker'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o:(.literal._Z5setupv+0x1d8): undefined reference to `esphome::sensor::Sensor::Sensor()'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o:(.literal._Z5setupv+0x1dc): undefined reference to `esphome::sensor::Sensor::set_state_class(esphome::sensor::StateClass)'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o:(.literal._Z5setupv+0x1e4): undefined reference to `esphome::sensor::Sensor::set_accuracy_decimals(signed char)'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o: in function `setup()':
/config/esphome/.esphome/build/esppoe-4/src/main.cpp:359: undefined reference to `esphome::sensor::Sensor::Sensor()'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o: in function `__gnu_cxx::new_allocator<esphome::esp32_ble::BLEEvent**>::allocate(unsigned int, void const*)':
/data/cache/platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/ext/new_allocator.h:111: undefined reference to `esphome::sensor::Sensor::set_state_class(esphome::sensor::StateClass)'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o: in function `std::_Deque_iterator<esphome::esp32_ble::BLEEvent*, esphome::esp32_ble::BLEEvent*&, esphome::esp32_ble::BLEEvent**>::_M_set_node(esphome::esp32_ble::BLEEvent***)':
/data/cache/platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/bits/stl_deque.h:259: undefined reference to `esphome::sensor::Sensor::set_accuracy_decimals(signed char)'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o: in function `esphome::esp32_ble::Queue<esphome::esp32_ble::BLEEvent>::Queue()':
/config/esphome/.esphome/build/esppoe-4/src/esphome/components/esp32_ble/queue.h:24: undefined reference to `esphome::sensor::Sensor::Sensor()'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o: in function `esphome::miot::MiotListener::set_address(unsigned long long)':
/config/esphome/.esphome/build/esppoe-4/src/esphome/components/miot/miot.h:67: undefined reference to `esphome::sensor::Sensor::set_state_class(esphome::sensor::StateClass)'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o: in function `setup()':
/config/esphome/.esphome/build/esppoe-4/src/main.cpp:373: undefined reference to `esphome::sensor::Sensor::set_accuracy_decimals(signed char)'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/main.o:(.rodata._ZTVN7esphome4miot13MiotComponentE[vtable for esphome::miot::MiotComponent]+0x40): undefined reference to `esphome::miot::MiotListener::process_mibeacon(esphome::miot::MiBeacon const&)'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/esphome/core/controller.o:(.literal._ZN7esphome10Controller16setup_controllerEb+0x10): undefined reference to `esphome::sensor::Sensor::add_on_state_callback(std::function<void (float)>&&)'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/esppoe-4/.pioenvs/esppoe-4/src/esphome/core/controller.o: in function `esphome::Controller::setup_controller(bool)':
/config/esphome/.esphome/build/esppoe-4/src/esphome/core/controller.cpp:29: undefined reference to `esphome::sensor::Sensor::add_on_state_callback(std::function<void (float)>&&)'
collect2: error: ld returned 1 exit status
*** [/data/esppoe-4/.pioenvs/esppoe-4/firmware.elf] Error 1
========================= [FAILED] Took 21.30 seconds =========================

Any ideas what I'm doing wrong?

Integrate Yeelight Remote Control 1S (YLAI003)

I ask you for a clarification on how to integrate this button in HA. I have configured everything correctly, in ESPHome log I see the single, double and long click. How do I use the event in HA? Only the battery status appears (yes work!). Thank you.

Video.mp4

Pass dimmer args to number - miot_ylkg0xyl

I created a number that will represent the value of rotations
How can I pass the value to the number?
I see the args "x" that printed in the logger
I tried to set the number
'
on_rotate_left:
then:

  • number.set:
    - id: my_number_id
    value: x
    '

I received an error float expected
Appreciate your help

Could not compile the node with miot_mccgq02hl component, after update ESPHome to 2022.2.4 version

Could not compile the node with miot_mccgq02hl component, after update ESPHome to 2022.2.4 version

logs_living-room-node_upload.txt
INFO Reading configuration /config/esphome/living-room-node.yaml...
ERROR Unable to load component miot_mccgq02hl.binary_sensor:
Traceback (most recent call last):
File "/esphome/esphome/loader.py", line 162, in _lookup_module
module = importlib.import_module(f"esphome.components.{domain}")
File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "/config/esphome/.esphome/external_components/2f2a5be3/components/miot_mccgq02hl/binary_sensor.py", line 23, in
binary_sensor.binary_sensor_schema(MiotMCCGQ02HL, device_class=DEVICE_CLASS_OPENING)
AttributeError: module 'esphome.components.binary_sensor' has no attribute 'binary_sensor_schema'
Failed config

binary_sensor.miot_mccgq02hl: [source /config/esphome/living-room-node.yaml:44]

Platform not found: 'binary_sensor.miot_mccgq02hl'.
platform: miot_mccgq02hl
mac_address: E4:AA:EC:35:0D:1A
name: Front Door Sensor
light:
name: Front Door Light Sensor
alert:
name: Front Door Alert
battery_level:
name: Front Door Battery Level
battery_voltage:
name: Front Door Battery Voltage

Backup error on ESP32 (esp-idf)

Compiling .pioenvs/ble-proxy/src/esphome/components/backup/backup.o
src/esphome/components/backup/backup.cpp:7:10: fatal error: StreamString.h: No such file or directory

**********************************************************************
* Looking for StreamString.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:StreamString.h"
* Web  > https://registry.platformio.org/search?q=header:StreamString.h
*
**********************************************************************

 #include "StreamString.h"
          ^~~~~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs/ble-erzekelok-proxy/src/esphome/components/backup/backup.o] Error 1
========================= [FAILED] Took 13.28 seconds =========================

On ESP8266 is fine.

Bluetooth Lock Aqara N100 support

Good day. Could you please add support for smart lock Aqara N100 ZNMS16LM. There are 2 versions of the Zigbee + Bluetooth lock that works with the AqaraHome application, and a simple Bluetooth version that works with the MiHome application. Both versions of the lock support homekit but only show the button to open the lock. The lock has a doorbell button and can be automated in MiHome - "if you press the bell, it plays a ringtone on the MiHub", but I want to transfer the bell button to the homekit to play the bell on my homepods. I am ready to do all the experiments with the lock to determine the parameters you need for this
IMG_5352
IMG_5353
IMG_5354
IMG_5355

Bakcup broken since ESPHome 2023.12

The contents of the backed up file is:

null
...

Also, the GPIO pin validation fails with this component added:

INFO ESPHome 2023.12.0b1
INFO Reading configuration /root/config/kazan-124.yaml...
INFO Generating C++ source...
INFO Reading configuration /root/config/kazan-124.yaml...
Failed config

binary_sensor.gpio: [source <unicode string>:157]
  
  Pin 5 is used in multiple places.
  platform: gpio
  pin: 
    number: 5
    inverted: True
    mode: 
      input: True
      pullup: True
      output: False
      open_drain: False
      pulldown: False
      analog: False
  name: Junkers betáp
  device_class: power
  id: power_active
  filters: 
    - delayed_on: 300ms
    - delayed_off: 300ms
  disabled_by_default: False
light.status_led: [source <unicode string>:183]
  
  Pin 2 is used in multiple places.
  platform: status_led
  id: onboard_led
  internal: True
  pin: 
    number: 2
    inverted: True
    mode: 
      output: True
      input: False
      open_drain: False
      pullup: False
      pulldown: False
      analog: False
  disabled_by_default: False
  restore_mode: ALWAYS_OFF
  name: onboard_led
output.esp8266_pwm: [source <unicode string>:240]
  
  Pin 15 is used in multiple places.
  platform: esp8266_pwm
  id: pwm_output_hw
  pin: 
    number: 15
    mode: 
      output: True
      input: False
      open_drain: False
      pullup: False
      pulldown: False
      analog: False
    inverted: False
  frequency: 1000.0
  zero_means_zero: False
Pin 5 is used in multiple places

Pin 2 is used in multiple places

Pin 15 is used in multiple places

INFO Backup config will take: 29 bytes
INFO Compiling app...

Reference Discord: https://discord.com/channels/429907082951524364/1184783083048812616

Could not compiling the node with startup component, after update ESPHome to 2021.10.2 version

|   |-- <ESP8266WiFi> 1.0
Compiling .pioenvs/entrance-air-curtain/src/esphome/components/startup/startup.cpp.o
Compiling .pioenvs/entrance-air-curtain/src/main.cpp.o
src/esphome/components/startup/startup.cpp: In constructor 'esphome::startup::StartupSensor::StartupSensor()':
src/esphome/components/startup/startup.cpp:11:48: error: 'millis' was not declared in this scope
 StartupSensor::StartupSensor() : start_(millis()){};
                                                ^
src/esphome/components/startup/startup.cpp: In member function 'virtual void esphome::startup::StartupSensor::loop()':
src/esphome/components/startup/startup.cpp:32:44: error: 'millis' was not declared in this scope
   this->startup_ = now.timestamp - (millis() - this->start_) / 1000;
                                            ^
*** [.pioenvs/entrance-air-curtain/src/esphome/components/startup/startup.cpp.o] Error 1
========================== [FAILED] Took 5.35 seconds ==========================

Unable to load component partitions

Hi,

I'm having trouble adding coredump and partitions to my project
Am I missing something?

ERROR Unable to load component partitions:
Traceback (most recent call last):
File "C:\Users\Peter\AppData\Local\Programs\Python\Python311\Lib\site-packages\esphome\loader.py", line 165, in lookup_module
module = importlib.import_module(f"esphome.components.{domain}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Peter\AppData\Local\Programs\Python\Python311\Lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "c:\Work\nspanel\test1.esphome\external_components\2f2a5be3\components\partitions_init
.py", line 8, in
from .const import *
File "c:\Work\nspanel\test1.esphome\external_components\2f2a5be3\components\partitions\const.py", line 3, in
DOMAIN = esp32.CONF_PARTITIONS
^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'esphome.components.esp32' has no attribute 'CONF_PARTITIONS'
WARNING GPIO4 is a Strapping PIN and should be avoided.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
Failed config

partitions: [source emeletgyerek2.yaml:9]

Component not found: partitions.
coredump:

validation error, platform: miot_thermogigro not found

Trying to use your external component I got red cross says platform miot_thermogigro can not be found

`external_components:

  • source: github://dentra/esphome-components

sensor:

  • platform: miot_thermogigro

    String (Required), device MAC-address.

    mac_address: "device-mac-address"

    String, (Optional), device bind key. Will use "xiaomi_account" from "miot" if absent to automaticaly get the bindkey.

    bindkey: "device-bin-key"

    String, (Optional), the name of sensor.

    name: "$name Temperature"

    Sensor (Optional), Humidity, %

    humidity:
    name: "$name Humidity"

    Sensor (Optional), Battey Level, %

    battery_level:
    name: "$name Battery Level"

    Sensor (Optional), Battey Voltage, V

    battery_voltage:
    name: "$name Battery Voltage"`

If I do validation, I got this
`INFO Reading configuration /config/esphome/esphome-5th-device.yaml...
ERROR Unable to import component miot_thermogigro.sensor:
Traceback (most recent call last):
File "/opt/esphome/esphome/loader.py", line 163, in _lookup_module
module = importlib.import_module(f"esphome.components.{domain}")
File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "/config/esphome/.esphome/external_components/2f2a5be3/components/miot_thermogigro/sensor.py", line 3, in
from esphome.components import sensor, miot
File "/config/esphome/.esphome/external_components/2f2a5be3/components/miot/init.py", line 8, in
from esphome.const import (
ImportError: cannot import name 'PLATFORM_ESP32' from 'esphome.const' (/opt/esphome/esphome/const.py)
Failed config

sensor.miot_thermogigro: [source /config/esphome/esphome-5th-device.yaml:37]

Platform not found: 'sensor.miot_thermogigro'.
platform: miot_thermogigro
mac_address: device-mac-address
bindkey: device-bin-key
name: $name Temperature
humidity:
name: $name Humidity
battery_level:
name: $name Battery Level
battery_voltage:
name: $name Battery Voltage`
Can you tell me what I did wrong? I assume this config is for esphome device yaml.

How install mccgq02hl...?

Hi
I would like to ask and ask for help on how to install the mccgq02hl add-on.
I already have a few esphome additions but I haven't installed any external components yet.
Here is my file, I did everything as described on github but unfortunately I cannot complete the compilation.

`esphome:
name: new-ble
platform: ESP32
board: nodemcu-32s

external_components:

  • source: github://dentra/esphome-components

Enable logging

logger:

Enable Home Assistant API

api:

ota:
password: "xxxxxx"

wifi:
ssid: "Hxxxxx"
password: "xxxxxx"
manual_ip:
static_ip: xxxxxxx
gateway: xxxxxx
subnet: xxxxxx

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: "New-Ble Fallback Hotspot"
password: "xxxxxxx"

captive_portal:

esp32_ble_tracker:

binary_sensor:

  • platform: miot_mccgq02hl
    mac_address: "xxxxxxxxxx"
    bindkey: "xxxxxxxxxxxx"
    name: "MCCGQ02HL Door/Window Sensor"
    light:
    name: "MCCGQ02HL Light"
    alert:
    name: "MCCGQ02HL Alert"
    battery_level:
    name: "MCCGQ02HL Battery Level"

In file included from src/esphome/components/miot/automation.h:6:0,
from src/esphome/components/miot/automation.cpp:5:
src/esphome/components/miot/miot.h:7:46: fatal error: esphome/components/sensor/sensor.h: No such file or directory
compilation terminated.
*** [/data/new-ble/.pioenvs/new-ble/src/esphome/components/miot/automation.cpp.o] Error 1
========================= [FAILED] Took 13.03 seconds =========================`

Add support for yunmi.kettle.v12 kettle

Hi! I tried your custom component with my Xiaomi Mi Smart Kettle Pro (sold in Europe), which looks a lot like the model specified as supported in the readme, but unfortunately it doesn't seem to work. I am not 100% sure i didn't just set it up wrong, but it doesn't look like I did.
Here's some info I figured could be useful.

My config section related to miot kettle platform:


external_components:
  - source: github://dentra/esphome-components

miot:
  xiaomi_account:
    username: !secret xiaomi_username
    password: !secret xiaomi_password
    servers: "ru"
    update_interval: 4h
  
binary_sensor:
  - platform: miot_kettle
    mac_address: "A4:C1:38:82:C9:35"
    name: "Kettle Water Boil Power"
    temperature:
      name: "Kettle Water Boil Temperature"

When I compile firmware, I see this in the beginning, so that part must be working.

INFO Got bindkey for A4:C1:38:82:C9:35 Kettle Water Boil Power

With verbose logging, I can see this about my kettle:

[14:07:45][VV][esp32_ble_tracker:500]: Parse Result:
[14:07:45][VV][esp32_ble_tracker:517]:   Address: A4:C1:38:82:C9:35 (PUBLIC)
[14:07:45][VV][esp32_ble_tracker:519]:   RSSI: -84
[14:07:45][VV][esp32_ble_tracker:520]:   Name: 'MiKetv12'
[14:07:45][VV][esp32_ble_tracker:528]:   Ad Flag: 6
[14:07:45][VV][esp32_ble_tracker:545]:   Service data:
[14:07:45][VV][esp32_ble_tracker:546]:     UUID: 0xFE95
[14:07:45][VV][esp32_ble_tracker:547]:     Data: 30.58.E0.09.03.35.C9.82.38.C1.A4.28.01.00 (14)
[14:07:45][VV][esp32_ble_tracker:550]: Adv data: 02.01.06.11.16.95.FE.30.58.E0.09.03.35.C9.82.38.C1.A4.28.01.00.09.09.4D.69.4B.65.74.76.31.32 (31)

I am pretty noob about all of this, so let me know if you need any info for me that would help you make this custom component compatible with this kettle.

Could not compiling ZMAi-90 v3 with esphome@tuya-raw-fix-standalone component after update ESPHome to 2021.10.2 version

Processing electricity-meter-2356bc (board: esp01_1m; framework: arduino; platform: platformio/espressif8266 @ 2.6.2)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.3
|   |-- <ESP8266WiFi> 1.0
|-- <ESPAsyncWebServer-esphome> 2.0.0
|   |-- <ESPAsyncTCP-esphome> 1.2.3
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <ArduinoJson-esphomelib> 5.13.3
|-- <ESP8266WiFi> 1.0
|-- <ArduinoJson-esphomelib> 5.13.3
|-- <ESP8266mDNS> 1.2
|   |-- <ESP8266WiFi> 1.0
Compiling .pioenvs/electricity-meter-2356bc/src/esphome/components/tuya/tuya.cpp.o
Compiling .pioenvs/electricity-meter-2356bc/src/main.cpp.o
Compiling .pioenvs/electricity-meter-2356bc/lib4d9/ESP8266WiFi/WiFiServerSecureAxTLS.cpp.o
Compiling .pioenvs/electricity-meter-2356bc/lib4d9/ESP8266WiFi/WiFiServerSecureBearSSL.cpp.o
Compiling .pioenvs/electricity-meter-2356bc/lib4d9/ESP8266WiFi/WiFiUdp.cpp.o
Compiling .pioenvs/electricity-meter-2356bc/libb6a/ESPAsyncTCP-esphome/AsyncPrinter.cpp.o
Compiling .pioenvs/electricity-meter-2356bc/libb6a/ESPAsyncTCP-esphome/ESPAsyncTCP.cpp.o
Compiling .pioenvs/electricity-meter-2356bc/libb6a/ESPAsyncTCP-esphome/ESPAsyncTCPbuffer.cpp.o
Compiling .pioenvs/electricity-meter-2356bc/libb6a/ESPAsyncTCP-esphome/SyncClient.cpp.o
Compiling .pioenvs/electricity-meter-2356bc/libb6a/ESPAsyncTCP-esphome/tcp_axtls.c.o
Compiling .pioenvs/electricity-meter-2356bc/lib6f5/Hash/Hash.cpp.o
Compiling .pioenvs/electricity-meter-2356bc/libf98/ESPAsyncWebServer-esphome/AsyncEventSource.cpp.o
Compiling .pioenvs/electricity-meter-2356bc/libf98/ESPAsyncWebServer-esphome/AsyncWebSocket.cpp.o
src/esphome/components/tuya/tuya.cpp: In member function 'void esphome::tuya::Tuya::send_wifi_status_()':
src/esphome/components/tuya/tuya.cpp:392:28: error: 'network_is_connected' was not declared in this scope
   if (network_is_connected()) {
                            ^
*** [.pioenvs/electricity-meter-2356bc/src/esphome/components/tuya/tuya.cpp.o] Error 1
========================== [FAILED] Took 6.00 seconds ==========================

XMWSDJ04MMC - No battery level

Hi there , I have added this device in my esp config:

  - platform: miot_thermogigro
    mac_address: AA:BB:CC:DD:EE:FF
    bindkey: "1234567...."
    name: "E-ink Test Temperatur"
    humidity:
      name: "E-ink Test Fugtighed"
    battery_level:
      name: "E-ink Test Batteri"

  - platform: ble_rssi
    mac_address: AA:BB:CC:DD:EE:FF
    name: "E-ink Test signalstyrke"
    id: test_rssi

Everything seems fine except the battery data:

image

How can that be ?

Support for k0918.toothbrush.t700 and k0918.toothbrush.t700i

Hi @dentra,

Please add support for: k0918.toothbrush.t700 k0918.toothbrush.t700i (battery level and score).
I've tried using miot_explorer, but it doesn't seem to detect the battery_level (ble event 0x100A), just appearing with the value Unknown.
The score, which is published as ble event 0x1013 (consumable) doesn't seem to be available as a sensor.
I'm using the esp-idf framework.
image

With the miot component I get the following data:
k0918.toothbrush.t700

[14:15:27][D][miot.automation:009]:   Product ID: 0806
[14:15:27][D][miot.automation:010]:   Frame Control:
[14:15:27][D][miot.automation:011]:     is_encrypted      : NO
[14:15:27][D][miot.automation:012]:     mac_include       : YES
[14:15:27][D][miot.automation:013]:     capability_include: YES
[14:15:27][D][miot.automation:014]:     object_include    : NO
[14:15:27][D][miot.automation:015]:     mesh              : NO
[14:15:27][D][miot.automation:016]:     registered        : NO
[14:15:27][D][miot.automation:017]:     solicited         : NO
[14:15:27][D][miot.automation:018]:     auth_mode         : 2
[14:15:27][D][miot.automation:019]:     version           : 5
[14:15:27][D][miot.automation:020]:   Frame Counter: 152
[14:15:27][D][miot.automation:023]:   MAC address: ed:de:34:3f:48:0c
[14:15:27][D][miot.automation:026]:   Capability:
[14:15:27][D][miot.automation:027]:     connectable : NO
[14:15:27][D][miot.automation:028]:     centralable : NO
[14:15:27][D][miot.automation:029]:     encryptable : NO
[14:15:27][D][miot.automation:030]:     bond_ability: 1
[14:15:27][D][miot.automation:031]:     io          : NO
[14:15:27][D][miot.automation:032]:     reserved    : 0
[14:15:27][D][text_sensor:064]: 'Mihai's Toothbrush': Sending state '0806'
[14:15:27][D][miot:138]: Got MiBeacon: 30.58.06.08.98.0C.48.3F.34.DE.ED.08 (12)
[14:15:27][D][miot:141]:   T700_54 [0806] ED:DE:34:3F:48:0C RSSI=-86 (poor)

k0918.toothbrush.t700i

[14:49:14][D][miot.automation:009]:   Product ID: 1790
[14:49:14][D][miot.automation:010]:   Frame Control:
[14:49:14][D][miot.automation:011]:     is_encrypted      : NO
[14:49:14][D][miot.automation:012]:     mac_include       : YES
[14:49:14][D][miot.automation:013]:     capability_include: YES
[14:49:14][D][miot.automation:014]:     object_include    : NO
[14:49:14][D][miot.automation:015]:     mesh              : NO
[14:49:14][D][miot.automation:016]:     registered        : NO
[14:49:14][D][miot.automation:017]:     solicited         : NO
[14:49:14][D][miot.automation:018]:     auth_mode         : 2
[14:49:14][D][miot.automation:019]:     version           : 5
[14:49:14][D][miot.automation:020]:   Frame Counter: 61
[14:49:14][D][miot.automation:023]:   MAC address: e2:d1:09:38:40:42
[14:49:14][D][miot.automation:026]:   Capability:
[14:49:14][D][miot.automation:027]:     connectable : NO
[14:49:14][D][miot.automation:028]:     centralable : NO
[14:49:14][D][miot.automation:029]:     encryptable : NO
[14:49:14][D][miot.automation:030]:     bond_ability: 1
[14:49:14][D][miot.automation:031]:     io          : NO
[14:49:14][D][miot.automation:032]:     reserved    : 0
[14:49:57][D][miot:138]: Got MiBeacon: 30.58.90.17.33.F2.6C.D4.01.C5.F1.08 (12)
[14:49:57][D][miot:141]:   T700i_0007 [1790] F1:C5:01:D4:6C:F2 RSSI=-79 (normal)

Thank you in advance.

Compile Error with miot_ylxx0xyl_pair

When compiling the miot_ylxx0xyl_pair component to obtain the beacon key for my YLYK01YL I get two errors:

First:
INFO Reading configuration /config/esphome/esphome-ble-test.yaml...

Failed config

text_sensor.miot_ylxx0xyl_pair: [source /config/esphome/esphome-ble-test.yaml:45]
  platform: miot_ylxx0xyl_pair
  name: miot_ylxx0xyl_pair Bindkey
  ble_client_id: remote_ble_client_id
  
  Icons must match the format "[icon pack]:[icon]", e.g. "mdi:home-assistant".
  version: 
    name: miot_ylxx0xyl_pair Version

This one is circumvented if you drop the

  version: 
    name: miot_ylxx0xyl_pair Version

part.

If I try to compile then I get following error:

Compiling /data/esphome-ble-test/.pioenvs/esphome-ble-test/src/main.cpp.o
src/main.cpp: In function 'void setup()':
src/main.cpp:241:69: error: 'class esphome::ble_client::BLEClient' has no member named 'address'; did you mean 'address_'?
   miot_ylxx0xyl_miotylxx0xylpair->set_address(remote_ble_client_id->address);
                                                                     ^~~~~~~
                                                                     address_
*** [/data/esphome-ble-test/.pioenvs/esphome-ble-test/src/main.cpp.o] Error 1
========================= [FAILED] Took 37.63 seconds =========================

RTCGQ02LM not showing any data

Hi there,

Thanks for the great integration. Like many I'm sure, I mistakenly purchased the bluetooth sensors instead of the Zigbee ones so I've been on a mission this weekend to get these connected. I've tried all the known methods to recover the bind key and the only one that worked was the hacked Mi Home app from the Russian site (version 6.1.701) which created a file on my Android device with the MAC, bind key and token.

I've added the following code below and amended my my MAC and extracted bind key but my ESP32 is not showing any data form the three entities. When adding your code verbatim, I'm also getting an error in ESPHome for the timeout and idle_time stating these are not valid options to I've removed those two lines so the code will compile.

How do I check to see if ESPHome is at least 'talking' to my motion sensor 2?

external_components:
  - source: github://dentra/esphome-components

binary_sensor:
  - platform: miot_mccgq02hl
    # String (Required), device MAC-address.
    mac_address: "discovered-mac"
    # String, (Optional), device bind key
    bindkey: "discovered-bindkey-32"
    # String, (Optional), the name of binary sensor
    name: "RTCGQ02LM Motion Sensor 2"
    # BinarySensor (Optional), Light intensivity: on - strong light, off - weak light
    light:
      name: "RTCGQ02LM Light"
    # Sensor (Optional), Battey Level, %
    battery_level:
      name: "RTCGQ02LM Battery Level"

HA version core-2021.9.6
ESPHome version 2021.9.0

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.