-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to compile with esphome version: 2022.9.4 - [Not Solved] diff in comment that compiles, but does not run stable #11
Comments
Solution:
|
I tried your fix, it compiles but temperatures, Mode: HEAT, Action: HEATING is wrong |
Same problem here. Compiles, but read values are wrong. |
For me too, I think the problem is copy_address(this->parent()->get_address(), this->parent()->get_remote_bda()); Which will of course not work as intended after the change indicated above... (dooh) Now, how to obtain the same thing... There is no set_remote_bda in /site-packages/esphome/components/esp32_ble_client/ble_client_base.h |
It seems the answer might be in using bool BLEClientBase::parse_device(const espbt::ESPBTDevice &device) { ESP_LOGD(TAG, "Found device at MAC address [%s]", device.address_str().c_str()); auto addr = device.address_uint64(); |
Are you suggesting there is a bug in /src/esphome/components/esp32_ble_client/ble_client_base.cpp ad if so how do we get on from here? |
No, I'm suggesting that perhaps danfoss_eco is doing a shortcut (in Device::setup() Copying the address to remote_bda ) that is now no loger possible because ble_client_base has moved members into protected(->remote_bda_) that were public before(->remote_bda), note that ->remote_bda_ seems to need initialization along with remote_addr_type_ which makes it sensible to fill in the two with a method instead of via direct access... |
@ryssel I've made a new solution, but i think I was on a wrong lead... Perhaps the function above does actually work... and the messed up results came from somewhere else... ...but mine tilts whenever I touch the schedule function in Home-Assistant (the calendar in the Thermiostat gizmo)... ...and the Mode function too (the flame). I can change setpoint OK, no problems, that seems to work. When the thermostat tilts I need to go back in with the Danfoss app to get the settings fixed up again... ...and while doing that I need to kill my esphome, or it will try to connect all the time... @ryssel Does yours run OK if you dont touch the Calendar and Flame ? It has been running well for 8h now.... I'll try the calendar and flame later on... |
This works better, but still get's hung up sometimes...
|
OK, sometimes the above does not get to disconnect the ble... |
Anything new on this topic? |
Hi! I was able to solve this as was suggested by previous users The members in class BLEClient are only availble through get/set functions, see documentation: https://esphome.io/api/classesphome_1_1esp32__ble__client_1_1_b_l_e_client_base.html I replaced the failing members with the corresponding get function ad it worked. |
Hi @davidtornquist! Can you share the modified files or link to GitHub if you forked the project?. I have similar issues but are no expert in C++ and need a bit of guidance! Thanks a lot! |
Yes @torbensp, certainly! I did not create a fork but downloaded files to run a local component in esphome, see documentation on local folder here: https://esphome.io/components/external_components.html Attached you have a zip file with the corrected files to replace the existing ones in the "danfoss_eco" folder once you unpacked and copied all the files of the lib to a folder of your choice. Best Reagards |
@davidtornquist I made your amendment to my esp. If I use one valve everything works fine, but if I use 2 or 3, the system goes crazy. The readings from the thermostats are incorrect and the connection freezes and the thermostats glow red. Do you have any idea? |
@davidtornquist , Best regards, Torben |
@marcin7d That sounds strange. Unfortunately I don't have any deeper knowledge about the logic of this library, I only did some troubleshooting on the compilation errors. I am only using one thermostat so it works for me. I suggest that you contact the author of te library. Thanks. |
@davidtornquist Thank you for your response. Do all the functions work for you? Schedule switch? |
@marcin7d I am using home assistant automation to change target temperature and it works fine. What do you mean by schedule switch, scheduling i danfoss eco app? |
@davidtornquist I mean setting the schedule mode or heating in manual mode |
Working now |
@marcin7d I also had the situation where the temperatures of two of my thermostats gave wrong very strange results. After much experimenting I found that I had switched the secret keys of those two devices. It turns out that you can communicate with the wrong keys, but of course you do not get the results you expect. @davidtornquist Thanks for your changes. Works OK. Only now need to set the reference to never refresh, so the changes are not undone when I recompile. |
@FransOv I'm planning to hook up my two Danfoss Eco valve's to my ESP32 running ESPHome. Before I do that, could you please confirm if esphome-danfoss-eco is not working correctly? |
@dmitry-cherkas could you please comment on the current state of esphome-danfoss-eco? Is it considered working/broken with the latest ESPHome version? |
@reinisb I have 5 Danfoss eco valves connected to two esp32's with this software. You need the changes suggested by @davidtornquist to compile with the latest version of esphome. |
@FransOv Thanks a lot for the detailed response! Unfortunately, it seems that this will not work for me. My only requirement is to be able to shut down the valve (i.e. set to vacation mode) and turn on the valve (i.e. set to regular schedule mode). I would shut it down when leaving home or when opening window. |
I gave this a shot (forked @davidtornquist change), but compiling fails. Log
Config
|
Alright, needed to add one more line to config since I'm running HA on Rpi3 https://esphome.io/changelog/2022.11.0.html#running-esphome-on-lower-powered-machines |
@FransOv I'm failing to get the secret key. When I plug my esp32 into power and watch the ESPHome logs it never asks me to press the button on the Eco. Instead, it just connects to Eco and reads its values every 5 minutes as configured. I tried resetting Eco 5 times as well as unplugging/plugging my esp32 into power 100 more times, but I never see the line in the real-time log asking me to press the button. Any ideas?
|
@reinisb I had some trouble too not seeing the press button message. Eventually I connected the esp to my pc and checked the log in the output of the serial port of the esp32. The message shows very soon after startup, before the log showed in the browser. I presume it will try again after the update interval has expired, but as you have set this at 30 minutes, that will take a while. Problem is, you have tot take the esp and the valve to your pc or your pc to the valve. |
That worked - thank you! That being said - this really messes up the Eco - it is not possible to set temperature on the physical Eco thermostat any longer, and frequently it would suddenly start heating to 60 C degrees. |
That is not my experience. You can set the temperature either manually or via Home Assistant, only not while the esp is communicating with the valve. Via HA it is a bit tedious as you have to increase the temp by half a degree, wait until the valve is updated and the updated value is returned and only then increase the temp by half a degree again. Manually adjusting the temp is no problem. If the problem persists it might help to reset the eco back to factory settings (keep the button pressed while you insert the batteries). You of course then have to enter the day/week program again in the Danfoss app. Your problem could also be caused by poor bluetooth connectivity. |
Hey @FransOv, @reinisb, @davidtornquist, as pointed out in #12, it seem the
Seems like there is a bug with the component, intermittently it looses the internal state and writes garbage to the Eco, resulting in the behavior you've described. Unfortunately I no longer hold the device, so won't be able to investigate/troubleshoot. Contributions are welcome! |
hm.. let me take it back, I was actually able to fetch it from PlatformIO, once I've updated to the latest version. |
I've incorporated your changes into a |
I tested the new version. Compiles without errors and first impression is that it works OK. Thanks. |
Same here - the new version compiled without any errors and seems to work fine. Thank you @dmitry-cherkas |
thanks for the feedback! looks like we can consider this one closed |
Hello Dimitry
I am getting the following when compiling in esphome 2022.9.4. I'm guessing changes has been made in the ble_client :-)
Perhaps I'm doing something wrong? Any input will be received with thanks :-)
Do you have anywhere it is possible to donate coffe or beer? :-)
HC
Compiling with
#esphome version
Version: 2022.9.4
gives me the folowing:
(esphome_py) [esphome@HomeAssistant esphome_py]# esphome version
Version: 2022.9.4
(esphome_py) [esphome@HomeAssistant esphome_py]# esphome compile esp32-eco2-01.yaml
INFO Reading configuration esp32-eco2-01.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esp32-eco2-01 (board: esp32-poe-iso; framework: arduino; platform: platformio/espressif32 @ 3.5.0)
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- xxtea-iot-crypt @ 2.0.1
|-- WiFi @ 1.0
|-- ESPmDNS @ 1.0
|-- Update @ 1.0
Compiling .pioenvs/esp32-eco2-01/src/esphome/components/danfoss_eco/device.cpp.o
Compiling .pioenvs/esp32-eco2-01/src/esphome/components/danfoss_eco/properties.cpp.o
Compiling .pioenvs/esp32-eco2-01/src/esphome/components/esp32/core.cpp.o
Compiling .pioenvs/esp32-eco2-01/src/esphome/components/esp32/gpio_arduino.cpp.o
Compiling .pioenvs/esp32-eco2-01/src/esphome/components/esp32/gpio_idf.cpp.o
Compiling .pioenvs/esp32-eco2-01/src/esphome/components/esp32/preferences.cpp.o
Compiling .pioenvs/esp32-eco2-01/src/esphome/components/esp32_ble_client/ble_characteristic.cpp.o
src/esphome/components/danfoss_eco/properties.cpp: In member function 'bool esphome::danfoss_eco::DeviceProperty::read_request(esphome::ble_client::BLEClient*)':
src/esphome/components/danfoss_eco/properties.cpp:29:59: error: 'class esphome::ble_client::BLEClient' has no member named 'gattc_if'
auto status = esp_ble_gattc_read_char(client->gattc_if,
^
src/esphome/components/danfoss_eco/properties.cpp:30:59: error: 'class esphome::ble_client::BLEClient' has no member named 'conn_id'
client->conn_id,
^
In file included from src/esphome/components/climate/climate.h:7:0,
from src/esphome/components/danfoss_eco/properties.cpp:1:
src/esphome/components/danfoss_eco/properties.cpp: In member function 'bool esphome::danfoss_eco::WritableProperty::write_request(esphome::ble_client::BLEClient*, uint8_t*, uint16_t)':
src/esphome/components/danfoss_eco/properties.cpp:41:148: warning: 'std::cxx11::string esphome::hexencode(const uint8_t*, uint32_t)' is deprecated: hexencode() is deprecated, use format_hex_pretty() instead. [-Wdeprecated-declarations]
ESP_LOGD(TAG, "[%s] write_request: handle=%#04x, data=%s", this->component->get_name().c_str(), this->handle, hexencode(data, data_len).c_str());
^
src/esphome/core/log.h:92:89: note: in definition of macro 'esph_log_d'
esp_log_printf(ESPHOME_LOG_LEVEL_DEBUG, tag, LINE, ESPHOME_LOG_FORMAT(format), ##VA_ARGS)
^
src/esphome/components/danfoss_eco/properties.cpp:41:13: note: in expansion of macro 'ESP_LOGD'
ESP_LOGD(TAG, "[%s] write_request: handle=%#04x, data=%s", this->component_->get_name().c_str(), this->handle, hexencode(data, data_len).c_str());
^
In file included from src/esphome/components/climate/climate.h:5:0,
from src/esphome/components/danfoss_eco/properties.cpp:1:
src/esphome/core/helpers.h:654:20: note: declared here
inline std::string hexencode(const uint8_t data, uint32_t len) { return format_hex_pretty(data, len); }
^
src/esphome/components/danfoss_eco/properties.cpp:43:60: error: 'class esphome::ble_client::BLEClient' has no member named 'gattc_if'
auto status = esp_ble_gattc_write_char(client->gattc_if,
^
src/esphome/components/danfoss_eco/properties.cpp:44:60: error: 'class esphome::ble_client::BLEClient' has no member named 'conn_id'
client->conn_id,
^
src/esphome/components/danfoss_eco/device.cpp: In member function 'virtual void esphome::danfoss_eco::Device::setup()':
src/esphome/components/danfoss_eco/device.cpp:22:36: error: 'class esphome::ble_client::BLEClient' has no member named 'address'
copy_address(this->parent()->address, this->parent()->remote_bda);
^
src/esphome/components/danfoss_eco/device.cpp:22:61: error: 'class esphome::ble_client::BLEClient' has no member named 'remote_bda'
copy_address(this->parent()->address, this->parent()->remote_bda);
^
src/esphome/components/danfoss_eco/device.cpp: In member function 'virtual void esphome::danfoss_eco::Device::gattc_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t)':
src/esphome/components/danfoss_eco/device.cpp:99:63: error: 'class esphome::ble_client::BLEClient' has no member named 'remote_bda'
if (memcmp(param->connect.remote_bda, this->parent()->remote_bda, 6) != 0)
^
In file included from src/esphome/components/climate/climate.h:7:0,
from src/esphome/components/danfoss_eco/device.h:4,
from src/esphome/components/danfoss_eco/device.cpp:1:
src/esphome/components/danfoss_eco/device.cpp: In member function 'virtual void esphome::danfoss_eco::Device::set_secret_key(uint8_t*, bool)':
src/esphome/components/danfoss_eco/device.cpp:268:108: warning: 'std::_cxx11::string esphome::hexencode(const uint8_t*, uint32_t)' is deprecated: hexencode() is deprecated, use format_hex_pretty() instead. [-Wdeprecated-declarations]
ESP_LOGD(TAG, "[%s] secret_key bytes: %s", this->get_name().c_str(), hexencode(key, SECRET_KEY_LENGTH).c_str());
^
src/esphome/core/log.h:92:89: note: in definition of macro 'esph_log_d'
esp_log_printf(ESPHOME_LOG_LEVEL_DEBUG, tag, LINE, ESPHOME_LOG_FORMAT(format), ##VA_ARGS)
^
src/esphome/components/danfoss_eco/device.cpp:268:7: note: in expansion of macro 'ESP_LOGD'
ESP_LOGD(TAG, "[%s] secret_key bytes: %s", this->get_name().c_str(), hexencode(key, SECRET_KEY_LENGTH).c_str());
^
In file included from src/esphome/core/automation.h:5:0,
from src/esphome/components/esp32_ble_tracker/esp32_ble_tracker.h:4,
from src/esphome/components/esp32_ble_client/ble_client_base.h:5,
from src/esphome/components/ble_client/ble_client.h:3,
from src/esphome/components/danfoss_eco/device.h:3,
from src/esphome/components/danfoss_eco/device.cpp:1:
src/esphome/core/helpers.h:654:20: note: declared here
inline std::string hexencode(const uint8_t *data, uint32_t len) { return format_hex_pretty(data, len); }
^
*** [.pioenvs/esp32-eco2-01/src/esphome/components/danfoss_eco/properties.cpp.o] Error 1
*** [.pioenvs/esp32-eco2-01/src/esphome/components/danfoss_eco/device.cpp.o] Error 1
====== [FAILED] Took 9.92 seconds ======
for the following conf (redacted):
esphome:
name: esp32-eco2-01
platform: ESP32
board: esp32-poe-iso
libraries:
- xxtea-iot-crypt@2.0.1
wifi:
ssid: "IoT"
password: "secretpassword"
logger:
ota:
password: "otasecret"
id: my_ota
api:
reboot_timeout: 1h
external_components:
esp32_ble_tracker:
sensor:
id: scanner
ble_client:
id: eco2_01_room
climate:
name: "01 Room eTRV"
ble_client_id: eco2_01_room
update_interval: 3min
battery_level:
name: "01 Room eTRV Battery Level"
temperature:
name: "01 Room eTRV Temperature"
It seems to be the danfoss_eco platform that bugs, danfoss_eco_scanner compiles perfectly.
The text was updated successfully, but these errors were encountered: