Git Product home page Git Product logo

esp32_mqtt_eq3's Introduction

EQ-3 Radiator valve control application for ESP-32

tested on ESP-WROOM-32

EQ-3 radiator valves work really well for a home-automation heating system. They are fully configurable vie BLE as well as their front-panel. There are more features on the valves than the calorBT app makes available.

The main problem with centrally controlling EQ-3 valves is the limited range of BLE. This makes it impossible to use a single central-controller to talk to all TRVs in a typical house. Therefore multiple 'hubs' are required at distributed locations.

Table of Contents

Description

This application acts as a hub and uses BLE to communicate with EQ-3 TRVs and makes configuration possible via MQTT over WiFi.

When using calorBT some very basic security is employed. This security however lives in the calorBT application and not in the valve. The EQ-3 valves do not require any authentication from the BLE client to obey commands.

Configuration

To quickly flash the application to a ESP32, download the latest release from https://github.com/softypit/esp32_mqtt_eq3/releases and flash it via esptool, using esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0xd000 ota_data_initial.bin 0x1000 bootloader.bin 0x10000 eq3_trv_control.bin 0x8000 partitions.bin in a Linux terminal with esptool installed.

On first use the ESP32 will start in access-point mode appearing as 'HeatingController'. Connect to this AP (password is 'password' or unset) and browse to the device IP address (192.168.4.1). The device configuration parameters can be set here:

Parameter Description Examples
ssid the AP to connect to for normal operation
password the password for the AP
mqtturl url to access the mqtt broker
allowed values:

- IP-Address, Hostname or Domainname only ("mqtt://" is used in this case)
- URL with scheme mqtt, ws, wss, tco, ssl (only mqtt is tested yet)
192.168.0.2
mqtt://192.168.0.2
ws://192.168.0.2
mqttuser mqtt broker username
mqttpass mqtt broker password
mqttid the unique id for this device to use with the mqtt broker (max 20 characters) livingroom
ntp enabled enable network time protocol support
ntp server1 url for ntp server pool.ntp.org
ntp server2 url for ntp server europe.pool.ntp.org
timezone timezone in TZ format GMT0BST,M3.5.0/2,M11.5.0/2
ip fixed IP for WiFi network (leave blank to DHCP)
gw gateway IP for WiFi network (leave blank for DHCP)
netmask netmask for WiFi network (leave blank for DHCP)
DNS server1 url for ntp server 8.8.8.8
DNS server2 url for ntp server 4.4.4.4

Once the ESP32 is running in client mode the configuration page can be accessed on the webserver at /config

Reset configuration

The application can be forced into config mode by pressing and holding the BOOT key AFTER the EN key has been released.

Determine EQ-3 addresses

Once connected in WiFi STA mode this application first scans for EQ-3 valves and publishes their addresses and rssi to the MQTT broker.
A scan can be initiated at any time by publishing to the /<mqttid>radin/scan topic.
Scan results are published to /<mqttid>radout/devlist in json format.

Control of valves is carried out by publishing to the /<mqttid>radin/trv topic with a payload consisting of: ab:cd:ef:gh:ij:kl <command> [parm] where the device is indicated by its bluetooth address (MAC)

Supported commands

Parameter Description Parameters Examples Stable since
settime sets the current time on the valve settime has an optional parameter of the hexadecimal encoded current time.
parm is 12 characters hexadecimal yymmddhhMMss (e.g. 13010c0c0a00 is 2019/Jan/12 12:00.00)
if no parameter is submitted and ntp is enabled the ntp time (with timezone offset) will be used
/<mqttid>radin/trv <eq-3-address> settemp 13010c0c0a00

/livingroomradin/trv ab:cd:ef:gh:ij:kl settemp 13010c0c0a00
v1.20
boost sets the boost mode -none - /<mqttid>radin/trv <eq-3-address> boost

/livingroomradin/trv ab:cd:ef:gh:ij:kl boost
v1.20
unboost reset to unboost mode -none - /<mqttid>radin/trv <eq-3-address> unboost

/livingroomradin/trv ab:cd:ef:gh:ij:kl unboost
v1.20
lock locks the front-panel controls -none - /<mqttid>radin/trv <eq-3-address> lock

/livingroomradin/trv ab:cd:ef:gh:ij:kl lock
v1.20
unlock release the lock for the front-panel controls -none - /<mqttid>radin/trv <eq-3-address> unlock

/livingroomradin/trv ab:cd:ef:gh:ij:kl unlock
v1.20
auto enables the internal temperature/time program -none - /<mqttid>radin/trv <eq-3-address> auto

/livingroomradin/trv ab:cd:ef:gh:ij:kl auto
v1.20
manual disables the internal temperature/time program -none - /<mqttid>radin/trv <eq-3-address> manual

/livingroomradin/trv ab:cd:ef:gh:ij:kl manual
v1.20
offset sets the room-temperature offset the temperature to set, this can be -3.5 - +3.5 in 0.5 degree increments /<mqttid>radin/trv <eq-3-address> offset 3.5

/livingroomradin/trv ab:cd:ef:gh:ij:kl offset 3.5
v1.20
settemp sets the required temperature for the valve to open/close at the temperature to set, this can be 5.0 to 29.5 in 0.5 degree increments /<mqttid>radin/trv <eq-3-address> settemp 20.0

/livingroomradin/trv ab:cd:ef:gh:ij:kl settemp 20.0
v1.20
on opens the valve fully (lcd display 'on') -none - /<mqttid>radin/trv <eq3-address> on

/livingroomradin/trv ab:cd:ef:gh:ij:kl on
v1.49
off closes the valve fully (lcd display 'off') -none - /<mqttid>radin/trv <eq3-address> off

/livingroomradin/trv ab:cd:ef:gh:ij:kl off
v1.49

In response to every successful command a status message is published to /<mqttid>radout/status containing json-encoded details of address, temperature set point, valve open percentage, mode, boost state, lock state and battery state.

This can be used as an acknowledgement of a successful command to remote mqtt clients.

JSON-Format of status topic

Key Description Exampls Since Version
trv Bluetooth-Address of the corresponding thermostat "trv":"ab:cd:ef:gh:ij:kl" 1.20
temp the current target room-temperature is set "temp":"20.0" 1.20
offsetTemp the current offset temperature is set "offsetTemp":"0.0" 1.30 (upstream merge in dev)
mode the current thermostate programm mode

"auto" = internal temperature/time program is used
"manual" = internal temperature/time program is disabled
"holiday" = holiday mode is used
"mode":"auto"
"mode":"manual"
"mode":"holiday"
1.20 1)
boost boost-mode is active / inactiv "boost":"active"
"boost":"inactive"
1.20
state front-panel controls are locked / unlocked "state":"locked"
"state":"unlocked"
1.20
battery battery state "battery":"GOOD"
"battery":"LOW"
1.20
window window-mode is active / inactive "window":"open"
"window":"closed"

Read current status

There is no specific command to poll the status of the valve but using any of the commands to re-set the current value will achieve the required result.

Note: It has been observed that using unboost to poll a valve can result in the valve opening as if in boost mode but without reporting boost mode active on the display or status. It is probably not advisable to poll the valve with the unboost command.

MQTT Topics

Key Description published subscriped
/<mqttid>radout/devlist list of available bluetooth devices X
/<mqttid>radout/status show a status message each time a trv is contacted X
/<mqttid>radin/trv <command> [param] sends a command to the trv X
/<mqttid>radin/scan scan for available bluetooth devices X

Web interface

When running in client mode the ESP32 presents a web interface that can be used to control TRVs and administer the EQ3-mqtt application. Software OTA feature can be used to apply new software binary files available in future without the need for usb/serial connection.

Usage Summary

On first boot this application uses Kolbans bootwifi code to create the wifi AP.
Once configuration is complete and on subsequent boots the configured details are used for connection. If connection fails the application reverts to AP mode where the web interface is used to reconfigure.

Developer notes

web server is part of Mongoose - https://github.com/cesanta/mongoose

Testing

# Connect to a mosquitto broker:

mosquitto_sub -h 127.0.0.1 -p 1883 -t "<mqttid>radout/devlist"  # Will display a list of discovered EQ-3 TRVs  
mosquitto_sub -h 127.0.0.1 -p 1883 -t "<mqttid>radout/status"  # will show a status message each time a trv is contacted  
mosquitto_pub -h 127.0.0.1 -p 1883 -t "<mqttid>radin/trv" -m "ab:cd:ef:gh:ij:kl settemp 20.0" # Sets trv temp to 20 degrees

Supported Models

possible incomplete list because of rebranding eq-3 thermostats

Name Model Name Factory Factory Model Number Remark Verified
Eqiva eQ-3 Bluetooth Smart 2) CC-RT-BLE-EQ EQIVA 141771E0 / 141771E0A X
Eqiva eQ-3 Bluetooth Smart (UK Version) 2) CC-RT-M-BLE EQIVA 142461D0 1)
Eqiva eQ-3 Bluetooth Smart 2) EQIVA 141771A1A in the sale 1)
Eqiva eQ-3 Bluetooth Smart 2) CC-RT-M-BLE EQIVA 142461A0 discontinued sales X
EHT CLASSIC MBLE (UK Version) CC-RT-M-BLE EQIVA 142461D0 1)
EHT CLASSIC MBLE (UK Version) CC-RT-M-BLE EQIVA 142461A0 discontinued sales 1)
SmartBlue Bluetooth 1)

1) Used the same calor BT-App, so this should work out of the box

2) Many aliases for "Eqiva eQ-3 Bluetooth Smart" devices exists. Most of all are characterized by a combination of "Eqiva", "eQ-3", "Bluetooth", "Smart".
    e.g. "eQ-3 AG Eqiva BLUETOOTH® Smart", "eqiva Bluetooth Smart Radiator Thermostat", "eQ-3 eqiva Heizkörperthermostat Typ N", "Eqiva Bluetooth Smart"

Don't buy Models without Bluetooth logo. They won't work with this "hub". e.g. "Eqiva Model N, 132231K0A"

Credits

  • Based on the amazing work of the ESP-IDF project
  • and the reverse engineering of @Heckie75

Source and continuative reverse engineering by

Notes

version 1.6 has been ported to use ESP IDF 4.3.1 and Mongoose Embedded Networking Library 7.4. Various tweaks and bugfixes have been applied including addition of two DNS servers for use in fixed-IP mode and a second NTP server. A timeout has been added to BLE operations to attempt to prevent the 'freeze-up' experienced occasionally on previous versions.

Compiling

menuconfig options allow setting of some parameters at compile time.

  • The boot-mode GPIO pin (normally a button on GPIO 0 on many ESP32 platforms) used to force the device into AP mode at boot.
  • Status LED GPIO which indicates if the device is in AP mode.
  • Password for AP mode (enables WPA2PSK) to prevent unwanted access should the device go into AP mode when it is unable to connect to its configured Access Point.

esp32_mqtt_eq3's People

Contributors

floyddotnet avatar softypit avatar stefsolar avatar ul-gh 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp32_mqtt_eq3's Issues

Version 1.2 memory addresses

I'm having some issues with v1.49. NTP gives dates in 1970 and scans saying devices found but nothing in the list.
I want to downgrade to the release version but the memory addresses in the readme are for the beta version (OTA for example). Using OTA to downgrade to 1.2 doesn't seem to work.
I also have one device which works fine connected to the PC but won't work from a USB PSU which is weird.
Great bit of software though. Managed to control radiators from openHAB which is what I wanted.

Compiling with Dallas 1820 sensor code

Has anyone tried to add a simple Dallas DS1820 temperature read into the app_main on eq3_main.c. I would like to report back to mqtt the current room temperature as I do on a PiZero version of this, but I cannot seem to compile the code. I am a novice with this kind of thing. Would anyone else be interested in such a feature?

Iget some Errors when i look at the serial connection

my Esp-wroom32 get only one EQ3 Thermostat and shows some failure:

E (756) BT: btc_gattc_call_handler()

E (30766) BT: btc_search_callback BLE observe complete. Num Resp 1

E (37916) BT: slave connection parameters update failed, the parameters are out of range

E (39156) BT: No pending command

E (68956) BT: btc_search_callback BLE observe complete. Num Resp 1

E (74466) BT: L2CA_CancelBleConnectReq - no connection pending

E (74466) BT: p_conn is NULL in bta_gattc_conn_cback

E (74466) EQ3_MAIN: open failed, status 133

E (37916) BT: slave connection parameters update failed, the parameters are out of range

E (39156) BT: No pending command

E (41956) BT: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0016

E (68956) BT: btc_search_callback BLE observe complete. Num Resp 1

E (74466) BT: L2CA_CancelBleConnectReq - no connection pending
E (74466) BT: p_conn is NULL in bta_gattc_conn_cback

E (74466) EQ3_MAIN: open failed, status 133

E (989876) BT: slave connection parameters update failed, the parameters are out of range

E (990896) BT: notification already registered

E (991106) BT: No pending command

E (996966) BT: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0016

E (1022296) BT: btc_search_callback BLE observe complete. Num Resp 1

E (1029476) BT: L2CA_CancelBleConnectReq - no connection pending

E (1029476) BT: p_conn is NULL in bta_gattc_conn_cback

E (1029476) EQ3_MAIN: open failed, status 133

E (1119326) BT: slave connection parameters update failed, the parameters are out of range

E (1120336) BT: notification already registered

E (1120566) BT: No pending command

E (1124476) BT: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0016

Sigi

Would a name instead of the device address be feasible?

Extremely great that you have created a working fork.
Thanks for that.
Could you create a way to give the individual EQ-3 thermostats their own names. With 10 thermostats it is difficult to remember which thermostat is behind the address 00:1A:22:08:XX:XX.

New Firmware Version introduces real pairing

Just today I installed a new version of the firmware: v1.46. It looks like the device now uses a new PIN with 6 digits instead of four and the pairing process has been implemented properly. At least I actually had to enter the code when pairing with a RaspberryPi, while devices with v1.20 paired without a code.

Will proper pairing be implemented or do we have to avoid updating the firmware on our devices?

Idea: Automatic continuous polling of Thermostat status

Hi, first of all thanks for all of your work and this code, it's working great over here! 🙏

If I am not mistaken in the current version the thermostat status is only being polled and the MQTT topic updated after a command is issued. I would like to add an automatic polling feature (every minute or every 30 seconds) that updates the MQTT topic. This would allow me to monitor certain things like valve state over time and also allow feedback if the valve is controlled in the automatic mode or manually via the dial.

I can do some work and get familiar with the code, but I wanted to ask the maintainers first if there is any obvious reason why this isn't currently implemented or might not work as I think it will. Any other pointers also highly appreciated.

All the best from Europe!

no BLE traffic after a few days working ok

I get no responses on /esp32radout/status when issuing commands to set temps, after a few days working without problems.
Can't seem to Rescan neither it just keeps on Scanning... forever. Reboot also doesn't seem to work.
Any ideas what might cause a BLE freeze on esp32 ( ESP32 DEVKIT V1 doit)?

MQTT doesn't want to work

Hello,

i've configured my esp32 and i'm able to control my eq3's over the web interface. Till this point everything works fine.
I've also configured my raspberry pi with mosquitto as a MQTT broker. The esp shows on the web interface that the status is connected. But no command shows any effect.
I've tried pub/sub between 2 raspberrys and that works fine. I've tried all commands you have listed in the README, but nothing happens.

Can you explain in more detail how to execute the commands or how to setup the broker on the raspberry side? I try it for 2 days now and do not get it to work -.-

Greetings from Germany
satrik

Flashing with esptool

Hi,
I just wanted to flash your binary file from the release to an ESP32, but I didn't get it right working.
Could you provide the right flashing command for the ESP32? I would like to do this the esptool.
Thank you!

Add information on how to flash to ESP32

Hey guys,

I'm trying to flash the code to my ESP since a while now, which is why I think it could be helpful to others to add this to the readme.
I started by installing Espressifs IDF and then trying to build the project, which didn't work ("CMakeLists.txt not found in project").

Next, I discovered the "Releases" and tried to flash the binaries using esptool.py, but then got stuck because I didn't know which ones to flash, and to which registers. I started with esptool.py --chip esp32 --port /dev/ttyUSB0 write_flash -z 0x1000 bootloader.bin and am now a bit unsure on how to continue.

Anyways, I'd really appreciate some comments, also, happy to add to the readme once I know how "end-users" are meant to use this seemingly very nice software :-)

Best, Stef

DHT22 implementation

Hi,

thank you for all your hard work with this application. Currently I´m using two Esp32 per room in my house.
One is running your software and the second one is running Micropython with a DHT22 temp/humidity sensor on the board.
With Micropython it wasn´t too hard to get the DHT22 to work, but I´m a beginner and have no idea how to extend/modify your sourcecode.

Would it be possible for you to extend your application to support the DHT22 sensor and publish the readings on two MQTT topics (for example .. /sensors/temp and /sensors/hum). If you don´t have an DHT22 for testing i would even provide for that.

Greetings
Kris

no 2.4G Connection with Sparkfun ESP32 Thing

Hey there, thanks for all your hard work!
I really want to get this project running in my home :)

I got the esp32-image transferred with esptool, but with none of my devices, I can find the Configuration-Wifi.
Since I've only worked with .ino- and .h-Files within the Arduino System, I don't even know where to start debugging...
Everything so far seems to be booting fine according to the Serial Output
(Serial and Commandline output added as log.txt)

Can somebody help me to get the WiFi up and running?
Thanks in advance!!

log.txt

Increase BLE range

Hi,

I want to control my EQ-3 valves (model 141771A1A) via MQTT, so I bought some Lolin32 ESP32 Lite Development boards and flashed them with your software.

However, I am having severe connection issues. I sometimes can't even connect to a valve that is just 1 metre away. I was hoping to cover my flat with two ESP32 boards (5 valves in 5 rooms, ~60m²).

I already tried to increase the BLE TX power as described here:
nkolban/esp32-snippets#674

I am not 100% sure, where to set the power, but a subsequent read back reports all three power levels at 7, which should be the highest. It didn't really change anything for the BLE range #though.

This are the two places, that I have tried to change BLE power:

index e1dd433..3835da8 100644
--- a/main/eq3_main.c
+++ b/main/eq3_main.c
@@ -1158,6 +1158,20 @@ void app_main(){
         ret = nvs_flash_init();
     }
     ESP_ERROR_CHECK( ret );
+
+    /* increase transmission power */
+    ret = esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_DEFAULT, ESP_PWR_LVL_P9);
+    if (ret) {
+        ESP_LOGE(GATTC_TAG, "%s ble set power failed, error code = %x\n", __func__, ret);
+    }
+
+    esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV, ESP_PWR_LVL_P9);
+    esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_SCAN, ESP_PWR_LVL_P9);
+
+    ESP_LOGI(GATTC_TAG, "ble power levels = (default %d, adv %d, scan %d)",
+        esp_ble_tx_power_get(ESP_BLE_PWR_TYPE_DEFAULT),
+        esp_ble_tx_power_get(ESP_BLE_PWR_TYPE_ADV),
+        esp_ble_tx_power_get(ESP_BLE_PWR_TYPE_SCAN));

     esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
     ret = esp_bt_controller_init(&bt_cfg);
@@ -1184,6 +1198,20 @@ void app_main(){
         return;
     }

+    /* increase transmission power */
+    ret = esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_DEFAULT, ESP_PWR_LVL_P9);
+    if (ret) {
+        ESP_LOGE(GATTC_TAG, "%s ble set power failed, error code = %x\n", __func__, ret);
+    }
+
+    esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV, ESP_PWR_LVL_P9);
+    esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_SCAN, ESP_PWR_LVL_P9);
+
+    ESP_LOGI(GATTC_TAG, "ble power levels = (default %d, adv %d, scan %d)",
+        esp_ble_tx_power_get(ESP_BLE_PWR_TYPE_DEFAULT),
+        esp_ble_tx_power_get(ESP_BLE_PWR_TYPE_ADV),
+        esp_ble_tx_power_get(ESP_BLE_PWR_TYPE_SCAN));
+
     //register the callback function to the gattc module
     ret = esp_ble_gattc_register_callback(esp_gattc_cb);
     if(ret){

Are there any other things, I could try to get a more stable connection? Do other ESP32 boards have better BLE coverage or should I switch to a Raspberry Pi Zero as a heating controller?

NTP not working

NTP doesn't appear to connect. I have 2 ESP32s. The first is like this
image
`

Mon Jul 19 13:18:16 1965 - {"trv":"00:1A:22:12:5F:88","temp":"17.0","offsetTemp":"0.0","valve":"100% open","mode":"manual","boost":"inactive","window":"closed","state":"unlocked","battery":"GOOD"}

Mon Jul 19 13:18:05 1965 - {"trv":"00:1A:22:12:65:8A","error":"Device unavailable"}
Mon Jul 19 13:17:29 1965 - {"trv":"00:1A:22:12:5F:88","error":"TRV not available"}
Mon Jul 19 13:17:19 1965 - 00:1A:22:12:5F:88 unlock
Mon Jul 19 13:16:59 1965 - 00:1A:22:12:65:8A unlock
Mon Jul 19 13:16:39 1965 - 00:1A:22:12:65:B2 unlock
Mon Jul 19 13:16:04 1965 - WiFi connected'

The second one I tried to put Timezone in
image

This gives
`
Thu Jan 1 05:24:09 1970 - {"trv":"00:1A:22:12:65:45","temp":"15.0","offsetTemp":"0.0","valve":"94% open","mode":"manual","boost":"inactive","window":"closed","state":"unlocked","battery":"GOOD"}

Thu Jan 1 05:23:57 1970 - 00:1A:22:12:65:45 unlock
Thu Jan 1 05:23:51 1970 - {"trv":"00:1A:22:12:65:E0","error":"Device unavailable"}
Thu Jan 1 05:23:37 1970 - 00:1A:22:12:65:E0 unlock
Thu Jan 1 05:21:24 1970 - WiFi connected

`
I'm not sure what's going on.

poll command corrupts internal clock/date setting, stops timers from working

Hi,

tested just now: issuing the poll commant e.g. via MQTT corrupts the eQ-3 internal clock and prevents timers from working afterwards. There is a description of the problem and solution at:

https://github.com/Heckie75/eQ-3-radiator-thermostat/blob/master/eq-3-radiator-thermostat-api.md#read-current-status-and-mode-sync-time.

Quote: "I have also dumped the bluetooth communication of the official app on Android devices. The app also sends date and time each time it requests the status. So we should do it as well."

Basically, an empty query (cmd byte value 0x03, see https://github.com/ul-gh/esp32_mqtt_eq3/blob/c9d807009072f1f4c10faab1cd723178af31933a/main/eq3_main.c#L879) is not sufficient, a date/time setting must be supplied simultaneously. There should be a note in the readme until this is implemented.

HTH, Ulrich

Undocumented Wifi and no HTML

Hi,

I just flashed these images on Windows 11 - via ESP32 download tool v3.9.2 and having the proper driver installed - onto an ESP32-WROOM-32 that I had lying around.

I get a Wifi called "ESP_CC1995" instead of the documented Wifi name. Also it doesn't require a password. When connected, I don't get any HTML page under "192.168.4.1".

What could be the problem?

Add more examples to the readme

Would it be possible to add more examples to the bottom of the page for all the possible instructions available especially the new setttime etc

DNS queries are failing with a fixed ip address schema

It seems to be that there is no defined DNS server when one is using a static ip (instead of DHCP).

So when I put a ntp server in (like nl.pool.ntp.org) the name doesn't get resolved and the timestamps are stuck in 1970's.

I've worked around this by putting in a fixed ip address but obviously that is more as a workaround, and now my timestamps are indeed working.

Suggestion: either put in a hardcoded, well known, DNS server like 8.8.8.8 or add an extra field for the DNS server.

Change hostname espressif

Hi,

Connected to my home wifi network, de esp32 is displayed as hostname espressif. It should be nice that it could be change in the webinterface or it should be called eq3-heatcontroller for example

regards Richard

OFF-Mode

Hi,
1st thanks for your great work. i'm currently using the thermostat with homebridge on two raspberry pis and planning to move to esp32, since i had some bluetooth connection issues. i can see, there's a off-mode in the homebridge-thermostat code by sending 0x41, 0x09 to the device. just wondering, why you didn't have it in your code.

best regards,
Joachim

Device unavailable

I used it the complete last winter and now i wanted to get it to work again and cant control my temps...
but now i cant get it to work somehow...

my issue:
image

devices found:
image
My setup in nodered (businesslogic)
image

controlled via lovelace in home assistant (user interface)
image

eq3 control by Blynk

Hi,
I want to ask if it is possible to control thermostats via Blynk application?
Blynk can work with RPi.

Maciej

Idea: Add white and black list of eq3 devices

Hi, first of all, thanks a lot for this project, it is really nice!

I have a set up with two esp32 devkit boards to control four eq3 valves.
One esp32 controls 3 that are on one side of the flat, and the other one controls the other one that is in the other side of the flat.

I have the two esp32 integrated with Home Assistant to control the valves, and for that I have some scripts and automations that are generic for any valve under the same "MQTT ID".

The problem is that, because the esp32's sometimes also detect the valves at the other side of the flat, I cannot use the same "MQTT ID" in both esp32 and therefore I need to duplicate the generic code I have in Home Assistant, one per esp32 board with different "MQTT ID".

I would like to have both esp32 boards with the same "MQTT ID" to reduce the automation code.

I think that one solution could be adding the option to white/black list devices within each esp32, then even if sometimes the esp32 sees the eq3 valve and receives a command, it won't do anything if is a black listed valve.

What do you think?
Or do you have another solution in mind?

Thanks a lot!

Compiling Issue /main/eq3_wifi

Sorry I can't compile and I don't understand what to do. It seams a code problem, with sprint %s
Can anybody help.

Thanks in advance
Brumby
.
.
.

AR build/lwip/liblwip.a
CC build/main/eq3_main.o
CC build/main/eq3_wifi.o
In file included from /home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_wifi.c:28:
/home/peter/Arduinosrc/eq3esp/esp-idf/components/esp_event/include/esp_event_loop.h:2:2: warning: #warning "esp_event_loop.h is deprecated, please include esp_event.h instead" [-Wcpp]
 #warning "esp_event_loop.h is deprecated, please include esp_event.h instead"
  ^~~~~~~
CC build/main/eq3_gap.o
CC build/main/eq3_bootwifi.o
In file included from /home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c:16:
/home/peter/Arduinosrc/eq3esp/esp-idf/components/esp_event/include/esp_event_loop.h:2:2: warning: #warning "esp_event_loop.h is deprecated, please include esp_event.h instead" [-Wcpp]
 #warning "esp_event_loop.h is deprecated, please include esp_event.h instead"
  ^~~~~~~
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c: In function 'mongoose_serve_config_page':
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c:238:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
             ibuf = inet_ntop(AF_INET, &connectionInfo.ipInfo.ip, ipbuf, sizeof(ipbuf));
                  ^
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c:240:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
             gbuf = inet_ntop(AF_INET, &connectionInfo.ipInfo.gw, gwbuf, sizeof(gwbuf));
                  ^
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c:242:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
             mbuf = inet_ntop(AF_INET, &connectionInfo.ipInfo.netmask, maskbuf, sizeof(maskbuf));
                  ^
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c: In function 'bootWiFi':
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c:975:5: warning: 'esp_event_loop_init' is deprecated [-Wdeprecated-declarations]
     ESP_ERROR_CHECK(esp_event_loop_init(esp32_wifi_eventHandler, NULL));
     ^~~~~~~~~~~~~~~
In file included from /home/peter/Arduinosrc/eq3esp/esp-idf/components/esp_event/include/esp_event.h:26,
                 from /home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c:15:
/home/peter/Arduinosrc/eq3esp/esp-idf/components/esp_event/include/esp_event_legacy.h:227:11: note: declared here
 esp_err_t esp_event_loop_init(system_event_cb_t cb, void *ctx) __attribute__ ((deprecated));
           ^~~~~~~~~~~~~~~~~~~
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c: In function 'mongoose_serve_status':
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c:354:26: error: '</td></tr> <tr><td>MQTT user...' directive writing 38 bytes into a region of size between 26 and 281 [-Werror=format-overflow=]
         sprintf(htmlstr, connectedstatus, connectionInfo.mqtturl, connectionInfo.mqttuser, connectionInfo.mqttpass, connectionInfo.mqttid, connected == true ? "connected" : "not connected");
                          ^~~~~~~~~~~~~~~
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c:354:9: note: 'sprintf' output between 330 and 746 bytes into a destination of size 430
         sprintf(htmlstr, connectedstatus, connectionInfo.mqtturl, connectionInfo.mqttuser, connectionInfo.mqttpass, connectionInfo.mqttid, connected == true ? "connected" : "not connected");
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c: In function 'mongoose_serve_config_page':
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c:244:22: error: '" /></td></tr> <tr><td>Gatew...' directive writing 124 bytes into a region of size between 36 and 656 [-Werror=format-overflow=]
     sprintf(htmlstr, selectap, sptr, pptr, murlptr, muserptr, mpassptr, midptr, connectionInfo.ntpenabled != 0 ? "checked=\"checked\"" : "", connectionInfo.ntpserver, connectionInfo.ntptimezone, ibuf == NULL ? nullstr : ibuf, gbuf == NULL ? nullstr : gbuf, mbuf == NULL ? nullstr : mbuf);
                      ^~~~~~~~
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c:244:5: note: 'sprintf' output 1872 or more bytes (assuming 2492) into a destination of size 1995
     sprintf(htmlstr, selectap, sptr, pptr, murlptr, muserptr, mpassptr, midptr, connectionInfo.ntpenabled != 0 ? "checked=\"checked\"" : "", connectionInfo.ntpserver, connectionInfo.ntptimezone, ibuf == NULL ? nullstr : ibuf, gbuf == NULL ? nullstr : gbuf, mbuf == NULL ? nullstr : mbuf);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c: In function 'mongoose_event_handler':
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c:489:41: error: '%s' directive writing up to 14 bytes into a region of size between 5 and 38 [-Werror=format-overflow=]
                 sprintf(request, "%s %s %s", devstr, cmdstr, valstr);
                                         ^~                   ~~~~~~
/home/peter/Arduinosrc/eq3esp/esp32_mqtt_eq3/main/eq3_bootwifi.c:489:17: note: 'sprintf' output between 3 and 50 bytes into a destination of size 40
                 sprintf(request, "%s %s %s", devstr, cmdstr, valstr);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
/home/peter/Arduinosrc/eq3esp/esp-idf/make/component_wrapper.mk:291: recipe for target 'eq3_bootwifi.o' failed
make[1]: *** [eq3_bootwifi.o] Error 1
/home/peter/Arduinosrc/eq3esp/esp-idf/make/project.mk:584: recipe for target 'component-main-build' failed
make: *** [component-main-build] Error 2

Missing mqtt.h

eq3_wifi.c:31:18: fatal error: mqtt.h: No such file or directory
compilation terminated.

Compiling with: MySys (minGW32) and ESP-IDF
Already tried mqtt_client.h from the espmqtt Repository with no luck

Best practice and expected behaviour when controlling eq3's

Not really an issue, more of a use case....

I have 9xEQ3s all controlled from HA, via this brilliant Wifi-BLE bridge code. (Mega thanks to Paul and the others!!!)

Q. What are people's suggestions in terms of the way you interact with them.
For instance - I currently have it all set up in NodeRed, where from a front end setting of a temperature on the Generic Thermostat in Home Assistant; NR then looks to see if 'that room' is either in 'schedule override' or 'on' schedule for the heating to be on, checks the current temperature (from a separate Temp/Humidity sensor in the room), and it then sends the relevant MQTT "on" or "off" message.

The said TRV then goes on or off - until then temperature in the room has equalled the set temp.

However, this is obviously having the effect of ramping as the heat inevitably goes over the set temp while the radiator is still HOT after turn off.

How can I flatten this hysteresis?
Is it best to send a "settemp xx" message and let the TRV decide?

The other question I have is that sometimes my MQTT broker comes back with "Device Unavailable" or " TRV not found" (What is the difference BTW?) and in that case - I'm resending the MQTT command, until I get a sensible reply. Is that the correct way to do it, or am I misunderstanding the whole concept of MQTT.
I'm currently sending with QOS 1 and Retain False.

So say I do just send it a settemp command. Once that temp has been reached, should I still be sending it an OFF command? Or will it do that by itself? In other words say I wanted the room to be at 21deg for 2hours - I send the command settemp 21, and then 2hrs later send the off command. During those 2hrs does the EQ3 regulate the room temp itself to 21deg?
Only, with the temp sensor in the TRV so close to the rad, my feeling was that the temp sensor up on the wall would be better suited to read the correct room temp? But then that would mean me controlling the on/off of the TRV as I'm already doing. But I'd prefer to be able to open the TRV slightly and not just FULL ON of Nothing.

Suggestions please.

Ta.

Reboot

Hallo,
i have the Problem:
Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:6392
load:0x40078000,len:11308
load:0x40080400,len:6672
entry 0x40080764
�[0;32mI (29) boot: ESP-IDF v3.3-beta1-432-g6c5481977-dirty 2nd stage bootloader�[0m
�[0;32mI (29) boot: compile time 22:36:21�[0m
�[0;32mI (39) boot: Enabling RNG early entropy source...�[0m
�[0;32mI (39) boot: SPI Speed : 40MHz�[0m
�[0;32mI (40) boot: SPI Mode : DIO�[0m
�[0;32mI (44) boot: SPI Flash Size : 4MB�[0m
�[0;32mI (48) boot: Partition Table:�[0m
�[0;32mI (52) boot: ## Label Usage Type ST Offset Length�[0m
�[0;32mI (59) boot: 0 nvs WiFi data 01 02 00009000 00004000�[0m
�[0;32mI (66) boot: 1 otadata OTA data 01 00 0000d000 00002000�[0m
�[0;32mI (74) boot: 2 phy_init RF data 01 01 0000f000 00001000�[0m
�[0;32mI (81) boot: 3 ota_0 OTA app 00 10 00010000 00177000�[0m
�[0;32mI (89) boot: 4 ota_1 OTA app 00 11 00190000 00177000�[0m
�[0;32mI (96) boot: End of partition table�[0m
�[0;32mI (100) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x3b024 (241700) map�[0m
�[0;32mI (194) esp_image: segment 1: paddr=0x0004b04c vaddr=0x3ffbdb60 size=0x03334 ( 13108) load�[0m
�[0;32mI (199) esp_image: segment 2: paddr=0x0004e388 vaddr=0x40080000 size=0x00400 ( 1024) load�[0m
�[0;32mI (201) esp_image: segment 3: paddr=0x0004e790 vaddr=0x40080400 size=0x01880 ( 6272) load�[0m
�[0;32mI (212) esp_image: segment 4: paddr=0x00050018 vaddr=0x400d0018 size=0xe6cd4 (945364) map�[0m
�[0;32mI (550) esp_image: segment 5: paddr=0x00136cf4 vaddr=0x40081c80 size=0x148b0 ( 84144) load�[0m
�[0;32mI (598) boot: Loaded app from partition at offset 0x10000�[0m
�[0;32mI (598) boot: Disabling RNG early entropy source...�[0m
�[0;32mI (598) cpu_start: Pro cpu up.�[0m
�[0;32mI (602) cpu_start: Application information:�[0m
�[0;32mI (607) cpu_start: Project name: eq3_trv_control�[0m
�[0;32mI (612) cpu_start: App version: 1.20-28-gb312d25�[0m
�[0;32mI (618) cpu_start: Compile time: 22:01:31�[0m
�[0;32mI (623) cpu_start: Compile date: Apr 5 2019�[0m
�[0;32mI (628) cpu_start: ESP-IDF: v3.3-beta1-432-g6c5481977-dirty�[0m
�[0;32mI (635) cpu_start: Starting app cpu, entry point is 0x400810ec�[0m
�[0;32mI (628) cpu_start: App cpu up.�[0m
�[0;32mI (646) heap_init: Initializing. RAM available for dynamic allocation:�[0m
�[0;32mI (653) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM�[0m
�[0;32mI (659) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM�[0m
�[0;32mI (665) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM�[0m
�[0;32mI (671) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM�[0m
�[0;32mI (677) heap_init: At 3FFCE6E8 len 00011918 (70 KiB): DRAM�[0m
�[0;32mI (683) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM�[0m
�[0;32mI (690) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM�[0m
�[0;32mI (696) heap_init: At 40096530 len 00009AD0 (38 KiB): IRAM�[0m
�[0;32mI (702) cpu_start: Pro cpu start user code�[0m
�[0;32mI (50) cpu_start: Starting scheduler on PRO CPU.�[0m
�[0;32mI (0) cpu_start: Starting scheduler on APP CPU.�[0m
�[0;32mI (113) BTDM_INIT: BT controller compile version [fe7ced0]�[0m
�[0;32mI (113) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE�[0m
�[0;32mI (213) phy: phy_version: 4100, 6fa5e27, Jan 25 2019, 17:02:06, 0, 0�[0m
�[0;32mI (583) EQ3_MAIN: REG_EVT�[0m
�[0;32mI (583) tmr: Start timer 1000 mS�[0m
�[0;32mI (593) EQ3_CTRL: scan start success�[0m
�[0;32mI (913) EQ3_CTRL: Found device CC-RT-BLE - rssi -82, ble_addr_type: 0�[0m
�[0;32mI (913) EQ3_CTRL: 00 1a 22 0d d9 e6 �[0m
�[0;32mI (3083) EQ3_MAIN: Timer0 event (nextcmd.running=1, ble_operation_in_progress=0)�[0m
�[0;32mI (3083) tmr: Start timer 1000 mS�[0m
�[0;32mI (5583) EQ3_MAIN: Timer0 event (nextcmd.running=1, ble_operation_in_progress=0)�[0m
�[0;32mI (5583) tmr: Start timer 1000 mS�[0m
�[0;32mI (8083) EQ3_MAIN: Timer0 event (nextcmd.running=1, ble_operation_in_progress=0)�[0m
�[0;32mI (8083) tmr: Start timer 1000 mS�[0m
�[0;32mI (10583) EQ3_MAIN: Timer0 event (nextcmd.running=1, ble_operation_in_progress=0)�[0m
�[0;32mI (10583) tmr: Start timer 1000 mS�[0m
�[0;32mI (13083) EQ3_MAIN: Timer0 event (nextcmd.running=1, ble_operation_in_progress=0)�[0m
�[0;32mI (13083) EQ3_MAIN: Init wifi�[0m
I (13083) wifi: wifi driver task: 3ffdd9f8, prio:23, stack:3584, core=0
I (13083) wifi: wifi firmware version: 66a98c0
I (13093) wifi: config NVS flash: enabled
I (13093) wifi: config nano formating: disabled
�[0;32mI (13093) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE�[0m
�[0;32mI (13103) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE�[0m
I (13143) wifi: Init dynamic tx buffer num: 32
I (13143) wifi: Init data frame dynamic rx buffer num: 32
I (13143) wifi: Init management frame dynamic rx buffer num: 32
I (13143) wifi: Init static rx buffer size: 1600
I (13153) wifi: Init static rx buffer num: 10
I (13153) wifi: Init dynamic rx buffer num: 32
�[0;32mI (13153) websrv: Config version 200 found�[0m
�[0;32mI (13163) websrv: Network config present - becoming client�[0m
I (13183) wifi: mode : sta (24:6f:28:16:7a:8c)
I (15933) wifi: new:<11,2>, old:<1,0>, ap:<255,255>, sta:<11,2>, prof:1
I (16923) wifi: state: init -> auth (b0)
I (16933) wifi: state: auth -> init (8a0)
I (16933) wifi: new:<11,0>, old:<11,2>, ap:<255,255>, sta:<11,2>, prof:1
I (22323) wifi: new:<11,2>, old:<11,0>, ap:<255,255>, sta:<11,2>, prof:1
I (22323) wifi: state: init -> auth (b0)
I (22323) wifi: state: auth -> assoc (0)
I (22333) wifi: state: assoc -> run (10)
I (22423) wifi: connected with FRITZ!Box 7530 MP, channel 11, bssid = 44:4e:6d:61:58:d1
I (22423) wifi: pm start, type: 1

�[0;32mI (23083) event: sta ip: 192.168.178.84, mask: 255.255.255.0, gw: 192.168.178.1�[0m
�[0;32mI (23083) websrv: ********************************************�[0m
�[0;32mI (23083) websrv: * We are now connected and ready to do work!�[0m
�[0;32mI (23093) websrv: * - Our IP address is: 192.168.178.84�[0m
�[0;32mI (23103) websrv: ********************************************�[0m
�[0;32mI (23103) EQ3_MAIN: WiFi network connected
�[0m
�[0;32mI (23113) EQ3_MAIN: SNTP not enabled
�[0m
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x400014fd PS : 0x00060a30 A0 : 0x800e2888 A1 : 0x3ffdbdc0
A2 : 0x00000000 A3 : 0xfffffffc A4 : 0x000000ff A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x00000000 A9 : 0x3ffdc090
A10 : 0x00000003 A11 : 0x00060a23 A12 : 0x00060a20 A13 : 0x3ffb65f0
A14 : 0x00000000 A15 : 0x00000000 SAR : 0x00000004 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff

Backtrace: 0x400014fd:0x3ffdbdc0 0x400e2885:0x3ffdbdd0 0x400df879:0x3ffdc0e0 0x400d6317:0x3ffdc1a0 0x400d4c3b:0x3ffdc220 0x400d6a79:0x3ffdc2c0 0x401480b9:0x3ffdc300 0x401480fd:0x3ffdc320 0x400938b1:0x3ffdc370

Rebooting...

Wiki article for integration to Home Assistant

Hi @softypit ,
thank you for your awesome project!!

I create a documentation for adding esp32_mqtt_eq3 to home assistant.
If you want, you can put it in your wiki as I cannot create a PR for it. Seems, that it's a common issue with github....

Here my article:

Home Assistant configuration

Integration into Home assistant is possible using the natively provided MQTT HVAC integration of HA. As the MQTT topic for the states is different than the inputs for temperature and mode, automations are needed to re-write the MQTT messages.

General structure:

  1. MQTT HVAC configuration
  2. Helper automation for rewriting MQTT commands for temperature control
  3. Helper automation for rewriting MQTT commands for mode selection

MQTT HVAC configuration

Adjust the name, MQTT topics and MAC-address to your esp32_mqtt_eq3 configuration.

   - platform: mqtt
     name: Badezimmer
    device:
     identifiers: '00:1A:22:0B:42:94'
    modes:
      - "off"
      - "auto"
      - "heat"
    precision: 0.5
    min_temp: 4.5
    max_temp: 29.5
    temp_step: 0.5
    mode_state_topic: "/badezimmerradout/status"
    mode_state_template: >
      {% if value_json.mode == "manual" %}
        {% if value_json.temp == "4.5" %}
          off
        {% else %}
          heat
        {% endif %}
      {% elif value_json.mode == "auto" %}
        auto
      {% endif %}
    mode_command_topic: "/ha_badezimmerradin/trv_mode"
    temperature_state_topic: "/badezimmerradout/status"
    temperature_state_template: "{{ value_json.temp }}"
    temperature_command_topic: "/ha_badezimmerradin/trv_temp"
    current_temperature_topic: "/badezimmerradout/status"
    current_temperature_template: "{{ value_json.temp }}"
    away_mode_state_topic: "/badezimmerradout/status"
    away_mode_state_template: >
      {% if value_json.mode == "holiday" %}
        on
      {% else %}
        off
      {% endif %}
      

Temperature Helper

Here as well, adjust the MQTT topics and BT names to your configuration. Add it to the automations.yaml

- id: '1573053873261'
  alias: Badezimmer_Temperature_Helper
  description: ''
  trigger:
  - platform: mqtt
    topic: /ha_badezimmerradin/trv_temp
  condition: []
  action:
    service: mqtt.publish
    data_template:
      payload: "{% if trigger.payload == \"4.5\" %}\n  00:1A:22:0B:42:94 off\n{% else\
        \ %}\n  00:1A:22:0B:42:94 settemp {{trigger.payload}}\n{% endif %}"
      topic: /badezimmerradin/trv

Mode Helper

Adjust the automation to fit your environment and append it to your automations.yaml.

- id: '1573063154330'
  alias: Badezimmer_Mode_Helper
  description: ''
  trigger:
  - platform: mqtt
    topic: /ha_badezimmerradin/trv_mode
  condition: []
  action:
    service: mqtt.publish
    data_template:
      payload: "{% if trigger.payload == \"heat\" %}\n  00:1A:22:0B:42:94 manual\n\
        {% else %}\n  00:1A:22:0B:42:94 {{trigger.payload}}\n{% endif %}"
      topic: /badezimmerradin/trv

Minor issues with offset

In handling the temperature offset data from TRV, an off-by-one limit check should be fixed, and negative numbers should be formatted correctly (the current code renders -0.5 as -1.5).
Pull request with fix will be submitted.

Unexpected entry into AP mode

There is problem with unexpected entry into AP mode. Logs:

[0;32mI (122964367) EQ3_MAIN: Timer0 event (nextcmd.running=1, ble_operation_in_progress=0)�[0m
�[0;32mI (122964367) tmr: Start timer 1000 mS�[0m
�[0;32mI (122966867) EQ3_MAIN: Timer0 event (nextcmd.running=1, ble_operation_in_progress=0)�[0m
�[0;32mI (122966867) EQ3_MAIN: Becoming WiFi client again
�[0m
I (122966867) wifi: mode : sta (84:0d:8e:0e:9f:e0)
�[0;31mE (122966877) MQTT_CLIENT: Error transport connect�[0m
�[0;32mI (122966877) mqtt: MQTT disconnected - wait for reconnect�[0m
�[0;32mI (122986877) mqtt: Other event id:7�[0m
�[0;31mE (122986877) MQTT_CLIENT: Error transport connect�[0m
�[0;32mI (122986877) mqtt: MQTT disconnected - wait for reconnect�[0m
�[0;32mI (123006877) mqtt: Other event id:7�[0m
�[0;31mE (123006877) MQTT_CLIENT: Error transport connect�[0m
�[0;32mI (123006877) mqtt: MQTT disconnected - wait for reconnect�[0m
I (123022357) wifi: mode : softAP (84:0d:8e:0e:9f:e1)
I (123022357) wifi: Total power save buffer number: 16
I (123022357) wifi: Total power save buffer number: 16
�[0;32mI (123022367) websrv: **********************************************�[0m
�[0;32mI (123022367) websrv: * We are now an access point and you can point�[0m
�[0;32mI (123022377) websrv: * your browser to http://192.168.4.1�[0m
�[0;32mI (123022377) websrv: **********************************************�[0m
�[0;32mI (123022387) EQ3_MAIN: WiFi connection failed - entering AP mode for 5 minutes
�[0m
�[0;32mI (123022397) tmr: Start timer 1000 mS�[0m
�[0;32mI (123022407) websrv: **********************************************�[0m
�[0;32mI (123022407) websrv: * We are now an access point and you can point�[0m
�[0;32mI (123022417) websrv: * your browser to http://192.168.4.1�[0m
�[0;32mI (123022417) websrv: **********************************************�[0m
�[0;32mI (123022427) EQ3_MAIN: WiFi connection failed - entering AP mode for 5 minutes
�[0m
�[0;32mI (123022437) EQ3_MAIN: setnextcmd when timer running!�[0m
�[0;32mI (123024387) EQ3_MAIN: Timer0 event (nextcmd.running=1, ble_operation_in_progress=0)�[0m
�[0;32mI (123024387) tmr: Start timer 1000 mS�[0m
�[0;32mI (123026877) mqtt: Other event id:7�[0m
�[0;32mI (123026887) EQ3_MAIN: Timer0 event (nextcmd.running=1, ble_operation_in_progress=0)�[0m
�[0;32mI (123026887) tmr: Start timer 1000 mS�[0m

After reset esp32 is in normal (not AP) mode.

I think WiFi connection failed - entering AP mode for 5 minutes is not true. If this happens esp32 is in AP mode forever.

EDIT:
Because of some reasons setnextcmd(RESTART_WIFI, 300); call is not effective (eq3_main.c file). It is because this call is within other command and nextcmd.running is set to true. Wifi restart request is ignored: EQ3_MAIN: setnextcmd when timer running! (timer command buffer size equals 1).

So the brute solution could be to set: netcmd.running = false just before restart request and setnextcmd call (new override flag will be better option).

I don't know what can be the side effects of this trick. I'll try to check this solution.

Btw, this errror occurs on my esp32 because internet provider router has unpredicted, very short wifi interface drops.

Newbie help + battery level

Good day, im a newbie and i want to have a minimal control over BLE EQ3 TRV. Since my valves ar ein manual mode i just need to send 2 data of temperature (eg 25 and 10 deg) to switch them on and off basically. Plus i want to read the battery level.
Unfortunately i dont use MQTT and i wanna control those valves when im far from home so i wanna use some cloud based service. I know how to code the part reagarding online reading of desidered temperature. i just need a simple command to send to my EQ3 that temperature. Can u help? Plus (nice to have) how to read the battery status.
PS: i know the MAC of my valves.
thanks and marry xmass

Wifi connection re-establish

When the WIFI connection is lost, EQ3-MQTT seems to be unable to a working state and remains unreachable until physically rebooted. I am on version EQ3-MQTT-ESP32 1.55-beta on a generic ESP32 Devkit.

Is there any possibility to have the code automatically retry WIFI or alternatively hard-reboot via Watchdog?

Flash address for OTA

Hello,

whats the address for the OTA upload? I cant do it working.

For control im using 0x10000
for bootloader 0x1000
and for partitions 0x8000

but for the OTA file?

EQ-3 notify error

Hi, Thanks for the excellent code. I have 9 TRV polling every 5 mins with command settime. 2 of them respond always with this error message: EQ-3 notify error.
Any suggestion?
Thank you very much

Port of MQTT

Hi,
maybe my question is stupid, but I can't solve a problem.

I have Mosquito on my server with port 1883 and ip 192.168.2.22

My ESP32 WROOM has ip 192.168.2.33 and port 1883 as a deafult. I try to connect with command:
mosquitto_sub -h 192.168.2.33 -p 1883 -u myusername -P mypass -t "mytopicnameradout/devlist"

It doesn't work. I have a message:
Connection refused

What should I do?

Thank for your answers!

P.S.
Update 21.08.2019:

I can't reach a config page too: 192.168.2.33/config
Message is the same: Connection refused

I have flashed with esptool:

esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 --before default_reset --after hard_reset write_flash -u --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 bootloader.bin 0x10000 eq3_trv_control.bin 0x8000 partitions.bin

Update 23.08.2019:
I have installed Beta-Version of Software
A Lot of thanks for it!!!

ESP32 works well, it connects to Wi-fi and I can control all of thermostats. But I still have a problem with MQTT. It shows:

Error. Connection refused

I have this configuration:

SSID: MyWLAN
Password: MyPass
MQTT URL: 192.168.2.33 (have tried with mqtt:// )
MQTT username: ivan
MQTT password: MyPass
MQTT ID: ivanroom
NTP enabled:
NTP server:
Timezone:
IP address: 192.168.2.33
Gateway address: 192.168.2.1
Netmask: 255.255.255.0

And I send response:
mosquito_sub -h 192.198.2.33 -p 1883 -u ivan -P MyPass -t /ivanroomradout/devlist

This command works with MQTT on my home server. But here no. What do I wrong?

Issue with settime validation?

Hi.
I have two ESP32 set up with Your code to monitor and control 7 EQ-3 valves with use of Home Assistant.
For now, HA executes script every few minutes sending "<bleaddr> settime" command for each of the connected EQ3s, to the ESP32 just to trigger a status response, so that it could see, how much valve is open etc.
I noticed, that after few hours o running without issues, one of the ESPs starts throwing following error in the console:
"I (26386629) EQ3_MAIN: Invalid time argument �?M��?ğ�?"

The situation goes away, when I start sending the same command, but with a white space after "settime".
I'm not the great c++ expert, but I tried to analyze the code to see if I can find the root cause, and I believe it might be caused by the fact, that this line is looking beyond actual command string, when the command only contains "settime". I assume, that as long, as the memory behind it is not occupied by anything, all works fine, but as soon as some data is stored just adjacent to the cmdstr, it then messes that check up.
That would (I think) explain, why adding white space to the command fixes it, as it reserves that additional one byte, that this validation routine looks into, preventing it from being allocated to other data.
These are just assumptions, but I thought I would share them with You so that You could look into this.

Kind Regards,
Darek.

PS. Thanks for the great software :)

Feature Request: RSSI (signal strength indication) for MAC addresses to blacklist/whitelist

Hi,

let me first thank you already for this code which is just what I was looking for to use the Equiva eQ-3 thermostats in conjunction with a soon-to-be roll-your-own centralised Node Red based control.

In my installation, the Bluetooth LE range of these thermostats is very poor and I need multiple of these ESP32 boards for full coverage.

In this situation with overlapping reach of the ESP32 MQTT EQ3 bridge modules, thermostats are discovered multiple times by the bridge modules. I am not sure if this is a battery drain issue for the thermostats, but anyways this would be a nice-to-have feature in order to choose the optimum one from different ESP32-MQTT-BLE bridge modules:

  • Provide a signal strength indication for the discovered MAC addresses via MQTT or the web config frontend.

That way, the user can choose the ESP module providing the most reliable connection for any given installation location.

Regards, Ulrich

Crash after a day

I always get a crash of my ESP32 after a day.

I cant watch it via Serial, because its not connected to my PC directly.

If i open a Serialport when its connected, the ESP is always restarting.

Im controlling the ESP via Node-Red and sending a "unlock" each 15 minutes to 2 devices.

The ESP is not responding anymore untill im resetting the device.

MQTT topic naming

After looking at some hints on MQTT topic naming and content conventions, it seems that it would probably be good to structure the MQTT data a bit differently:

  • Naming:
    Some sources (e.g. HiveMQ) recommend agains leading slashes, and I find simply appending 'radin' or 'radout' to the client id somewhat weird-looking, so I tried deleting the slash from the beginning and inserting it between id and radin/radout: bedroom/radin/trv instead of /bedroomradin/trv.
  • Content:
    Using "command" on the radin side and a json object on the radout status side seems a bit asymmetric. I was under the impression that MQTT is more state-oriented than command-oriented (although the latter needs to be done in some cases) so I would expect this topic structure:
    bedroom/trv/devices - list devices visible to this trv bridge (readonly)
    bedroom/trv/devices/01:02:03:04:06/settemp - attribute for the set temperature (read/write)
    bedroom/trv/devices/01:02:03:04:06/mode - attribute for manual/automatic mode (read/write)
    etc. For additional luxury, devices could have human-readable aliases such as left-window-radiator.
  • Persistency:
    When topics are published persistently, new subscribers are able to see the current settings, which might be useful when some components need to be restarted or have only intermittent connections.

Hope this doesn't sound critical, I'm just excited about and thankful for this software!

No connection to AP possible

I compiled this project (VSCode/PlatformIO)
espressif32 @ 1.11.0
tool-esptoolpy @ 1.20600.0
toolchain-xtensa32 @ 2.50200.80
framework-espidf @ 3.30300.190916

It works fine, when the ESP32 is itself in AP mode. However I am not able to connect to any AP as station. When I compile some of the espidf example programs, they connect immediately in station mode to all tested AP.

Are there others, having similar problems?

Set offset-Temp does'n work

Hi,
I have a problem settig the offset temperature. The offset temperature stays unchanged and the temp is change to 4.5 °C.
Several tries - always the same.

see the Log file:
eq3.log

Regards
Xander
Btw: Setting the offset temp is missing in the Web-Frontent.

Missing controller.h when building

First things first, thank you very much for this project!

Unfortunately I am not able to build it though.
I tried the instructions from here:
http://esp-idf.readthedocs.io/en/latest/get-started/index.html#start-a-project

I ran
make menuconfig
and just adapted the serial communication and the device's flash size to 4MB.

But running make (flash) I get the following error:

CC build/main/eq3_timer.o
C:/esp32_mqtt_eq3-master/main/eq3_timer.c:21:24: fatal error: controller.h: No such file or directory
compilation terminated.
make[1]: *** [/c/Users/toffe/Documents/esp-idf/make/component_wrapper.mk:286: eq3_timer.o] Fehler 1

In general, build instructions would be really nice 👍
Thanks!

mqtt_password exposed

After saving the configuration on the esp you can see the mqtt password in cleartext via the webinterface, so everyone in the wifi could see it.

LED on ESP32

Got mine working well with 5 EQ3s so thank you.
Not a programming issue but, nevertheless, would be useful. The LEDs on my ESP32s are painfully bright. It would be good to have a command to turn them off or only flash if there was an issue (loss of WifFi, MQTT or low battery on the EQ3).

Unboost causes 80% valve opening

Hi,
I added the 'poll' command for neatness and I don't actually use it with my heating-controller application. I have tested previously too and noticed the time got corrupted but hadn't realised it was the poll command that caused this.
Unfortunately without a real-time-clock in the esp-32 (we could implement something but couldn't rely on access to ntp or a known accurate time reference) it is not possible to re-set the time on the unit for each poll. Assuming you do not use 'boost' mode with your trvs you can simply use the 'unboost' command which will have the same result as 'poll' without corrupting the time.
Regards.
Paul.

According to this i tried to replace the "poll" with the "unboost" command to update the state of the valves each 10 minutes.

It always gave me 80% valve opening back, and my Valves always changed the positions from e.g. 7% to 80%

Not responding anymore

Hello,

my TRVs worked very well last time, but since afew days its not working anymore.

I changed the batterieys of my valves and after startup of my esp its scanning for the valves, its publishing the list of found valves, but when i try to send any commands it shows following:

I (585803) mqtt: [APP] Publish topic: /Eq3radin/trv
I (585813) mqtt: Handle trv msg
I (585813) EQ3_MAIN: Requested address:
I (585823) EQ3_MAIN: 00 1a 22 0e ed 99
I (585823) EQ3_MAIN: Add queue end
I (585833) tmr: Start timer 1000 mS
I (588333) EQ3_MAIN: Timer0 event
I (588333) tmr: Start timer 1000 mS
I (590833) EQ3_MAIN: Timer0 event
I (590833) tmr: Start timer 1000 mS
I (593333) EQ3_MAIN: Timer0 event
I (593333) tmr: Start timer 1000 mS
I (595833) EQ3_MAIN: Timer0 event
I (595833) tmr: Start timer 1000 mS
I (598333) EQ3_MAIN: Timer0 event
I (598333) tmr: Start timer 1000 mS
I (600833) EQ3_MAIN: Timer0 event
I (600833) tmr: Start timer 1000 mS
I (603333) EQ3_MAIN: Timer0 event
I (603333) tmr: Start timer 1000 mS

Thats it.

My valves are powerd up, battery is good, ESP is in range to them (like 50cm) but its not working

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.