feature-requests icon indicating copy to clipboard operation
feature-requests copied to clipboard

eQ-3 Bluetooth Thermostat support

Open bbbenji opened this issue 6 years ago • 63 comments

Describe the problem you have/What new integration you would like Support for forwarding bi-directionally data from/to the eQ-3 Bluetooth Thermostat

Please describe your use case for this integration and alternatives you've tried: Been using bt-mqtt-gateway which does exactly what the name states

Additional context Python library and command-line tool for EQ3 Smart Bluetooth thermostats

bbbenji avatar Feb 27 '19 21:02 bbbenji

There is a esp firmware that does exactly this: https://github.com/softypit/esp32_mqtt_eq3

snizzleorg avatar Mar 03 '19 16:03 snizzleorg

This would be a great addition. I have esphome nodes with sensors in almost every room. Currently I have everywhere a second ESP32 for only controlling the eq3 thermostats. Would nice to merge the sensors-nodes with the eq3-controlling nodes

egon0 avatar Mar 08 '19 22:03 egon0

Just for more context on this - there's also an ESP32 implementation here: https://github.com/softypit/esp32_mqtt_eq3

inforsgit avatar Mar 13 '19 13:03 inforsgit

I would love to have EQ3 integrated with esphome in order to easily expose it to Home Assistant.

Being not familiar with esphome architecture, does it take a lot of work to integrate aforementioned ESP32 implementation (https://github.com/softypit/esp32_mqtt_eq3) with it?

barthand avatar Mar 15 '19 10:03 barthand

I'm not 100% familiar with the inner workings of ESPHome but I think the integration I mentioned would more be for reference than directly porting it into ESPHome.

I was thinking that the Xiaomi MiFlora implementation in ESPHome (covered by the BLE Tracker code: https://github.com/esphome/esphome-core/blob/dev/src/esphome/esp32_ble_tracker.h) could serve as a starting point - that at least shows how a BLE device can be integrated in ESPHome. The major difference is that it only reports received values, whereas the EQ3s require two-way communication.

inforsgit avatar Mar 15 '19 12:03 inforsgit

Just to add even more background info (sorry for not having a solution as yet) - a Home Assistant component exists for the EQ3 thermostats but of course that only works if the home assistant server (e.g. an RPi 3) is in range of all of the heaters. I guess that, like me, that's not the case for you and the dream would be to have ESP32s around the house, each running ESPHome and acting as bridges to Home Assistant.

If so then I think we need to consider that ESPHome would present a "Climate" component to Home Assistant, in the same way that it can currently present a "Fan" component. So I assume we'd need to create a thermostat/TRV "Core" in ESPHome and then have eq3 TRVs as an extension of that...anyone think that's a good or bad idea? I'll keep thinking myself and try and flesh out the idea!

inforsgit avatar Mar 15 '19 12:03 inforsgit

@inforsgit This integration would be a lot of work, first a new esp32_bt base would need to be created (for communicating with normal BT devices) with an API that several devices like the EQ3 could hook into.

I would not recommend creating a climate component in esphome - the HA model of a climate entity is seriously broken from an architecture standpoint (there are tons of properties that are improperly documented). Plus adding a new component to esphome is a whole bunch of work because the base component would need to be created, then MQTT and native API layers, then aioesphomeapi needs to be updated and finally HA - a whole bunch of work. So I would highly recommend exposing everything as individual switches/sensors/etc. If the user wants they can still make a template in HA that converts these to a climate entity.

OttoWinter avatar Mar 15 '19 14:03 OttoWinter

Maybe just add custom component: Custom BLE device, this component will have BLE read characteristic and BLE write characteristic function. This can be enough to create eQ-3 (or any other ie. Sygonix) thermostat template

animavitis avatar Mar 16 '19 19:03 animavitis

Hi @OttoWinter, i saw that you inplement climate components in ESPHome, do you have intention of develop integration for eQ-3 TRV platform in the future?

Thank you very much.

Ilpredatore avatar Aug 30 '19 10:08 Ilpredatore

@Ilpredatore tbh, I don't have any plans for this device in particular. I have no need for a bluetooth thermostat and also don't own this unit. If someone implements it, I would be happy to accept it though.

OttoWinter avatar Aug 31 '19 17:08 OttoWinter

I've started implementation of a library that can control the EQ3 thermostats here: https://github.com/pieter/ESP-EQ3

It's fairly simple (depends on Arduino & a BLE library) and incomplete, but should be easy to expand with the necessary functionality for ESPHome. Here is the header -- you initialise it with a MAC address, then call getTemperature/setTemperature and getMode/setMode.

I hope to create a custom component for this at some point once I find some more time, if nobody beats me to it.

pieter avatar Oct 13 '19 16:10 pieter

You might look at my custom components. I spend last week on trying to get this working: https://github.com/ayufan/esphome-components.

It seems to be. So any feedback is welcome. Maybe we could upstream that if it proves to be fairly stable.

ayufan avatar Dec 04 '19 20:12 ayufan

Hi @ayufan - I'm really keen to test out your code, it looks really good. I'm struggling to get it running though - I've used the config entry on your link but it won't compile - always says platform not found: climate_eq3. I'm sure it's my mistake in applying it - I've got the files from the eq3_v2 directory in the same folder as the yaml with the config. Could you maybe add a bit more detail to describe how to install the component from scratch? Thank you!

inforsgit avatar Dec 05 '19 18:12 inforsgit

I add installation section: https://github.com/ayufan/esphome-components#1-installation @inforsgit.

Not all controls are exposed, as Climate component is not super flexible, it is less flexible what Home Assistant do offer :)

I plan to expose all controls including schedules to easily reconfigure the device given what is available.

ayufan avatar Dec 05 '19 18:12 ayufan

Great...thanks - that's amazing - initial test has the basics working 👍 👍 👍. I'll try and run through some proper testing with it and then let you know on your github if I find bugs (and solutions!). Cheers!!

inforsgit avatar Dec 05 '19 18:12 inforsgit

@inforsgit I still see some problem with time configuration. Not sure why, something is broken there.

ayufan avatar Dec 05 '19 18:12 ayufan

I fixed a bug with time. Update is on GitHub.

ayufan avatar Dec 05 '19 22:12 ayufan

Ideas whats wrong here? MAC from the valve is 00:1A:22:0E:14:73 and ESP32 is next to the valve

[10:22:47][C][template.switch:058]: Template Switch 'Refresh Bedroom EQ3' [10:22:47][C][template.switch:059]: Restore State: NO [10:22:47][C][template.switch:060]: Optimistic: NO [10:22:47][C][logger:175]: Logger: [10:22:47][C][logger:176]: Level: DEBUG [10:22:47][C][logger:177]: Log Baud Rate: 115200 [10:22:47][C][logger:178]: Hardware UART: UART0 [10:22:47][C][ota:029]: Over-The-Air Updates: [10:22:47][C][ota:030]: Address: 192.168.1.80:3232 [10:22:47][C][mqtt:051]: MQTT: [10:22:47][C][mqtt:053]: Server Address: 192.168.1.10:1883 (192.168.1.10) [10:22:47][C][mqtt:054]: Username: [redacted] [10:22:47][C][mqtt:055]: Client ID: [redacted] [10:22:47][C][mqtt:057]: Discovery prefix: 'homeassistant' [10:22:47][C][mqtt:058]: Discovery retain: YES [10:22:47][C][mqtt:060]: Topic Prefix: 'eq3bt' [10:22:47][C][mqtt:062]: Log Topic: 'eq3bt/debug' [10:22:47][C][mqtt:065]: Availability: 'eq3bt/status' [10:22:47][C][sntp:043]: SNTP Time: [10:22:47][C][sntp:044]: Server 1: '0.pool.ntp.org' [10:22:47][C][sntp:045]: Server 2: '1.pool.ntp.org' [10:22:47][C][sntp:046]: Server 3: '2.pool.ntp.org' [10:22:47][C][sntp:047]: Timezone: 'CET-1CEST-2,M3.5.0/2,M10.4.0/3' [10:22:47][C][mqtt.switch:038]: MQTT Switch 'Refresh Bedroom EQ3': [10:22:47][C][mqtt.switch:039]: State Topic: 'eq3bt/switch/refresh_bedroom_eq3/state' [10:22:47][C][mqtt.switch:039]: Command Topic: 'eq3bt/switch/refresh_bedroom_eq3/command' [10:22:47][C][mqtt.sensor:024]: MQTT Sensor 'Bedroom EQ3 Valve State': [10:22:47][C][mqtt.sensor:026]: Expire After: 3660s [10:22:47][C][mqtt.sensor:028]: State Topic: 'eq3bt/sensor/bedroom_eq3_valve_state/state' [10:22:47][C][eq3:272]: EQ3-Max Thermostat 'Bedroom EQ3' [10:22:47][C][eq3:273]: Update Interval: 1800.0s [10:22:47][C][eq3:274]: Mac Address: 1a220e1473 [10:22:47][C][eq3:275]: Valve 'Bedroom EQ3 Valve State' [10:22:47][C][eq3:275]: Unit of Measurement: '%' [10:22:47][C][eq3:275]: Accuracy Decimals: 0 [10:22:47][C][eq3:275]: Icon: 'mdi:percent' [10:22:49][I][eq3:042]: Requesting update of 1a220e1473... [10:22:50][E][eq3_cmd:144]: Clock source for 1a220e1473 is not valid. [10:22:50][W][eq3:051]: Update of 1a220e1473 failed. Tries left: 1. [10:22:53][I][eq3:042]: Requesting update of 1a220e1473... [10:22:56][E][eq3_cmd:144]: Clock source for 1a220e1473 is not valid. [10:22:56][W][eq3:056]: Update of 1a220e1473 failed. Too many tries. [10:22:56][D][sensor:092]: 'Bedroom EQ3 Valve State': Sending state nan % with 0 decimals of accuracy [10:24:32][I][ota:046]: Boot seems successful, resetting boot loop counter.

YAML:

ota:

logger:

time:

  • platform: sntp id: sntp_time climate:
  • platform: eq3_v2 id: bedroom_eq3 name: Bedroom EQ3 mac_address: 00:1A:22:0E:14:73 update_interval: 30min valve: # optional, allows to see valve state in % name: Bedroom EQ3 Valve State expire_after: 61min

konzolec avatar Dec 08 '19 09:12 konzolec

It seems to be missing WiFi connection. Eq3 requires valid time source, and this has to be taken from somewhere

On Sun, 8 Dec 2019 at 10:36, konzolec [email protected] wrote:

Ideas whats wrong here? MAC from the valve is 00:1A:22:0E:14:73 and ESP32 is next to the valve

[10:22:47][C][template.switch:058]: Template Switch 'Refresh Bedroom EQ3' [10:22:47][C][template.switch:059]: Restore State: NO [10:22:47][C][template.switch:060]: Optimistic: NO [10:22:47][C][logger:175]: Logger: [10:22:47][C][logger:176]: Level: DEBUG [10:22:47][C][logger:177]: Log Baud Rate: 115200 [10:22:47][C][logger:178]: Hardware UART: UART0 [10:22:47][C][ota:029]: Over-The-Air Updates: [10:22:47][C][ota:030]: Address: 192.168.1.80:3232 [10:22:47][C][mqtt:051]: MQTT: [10:22:47][C][mqtt:053]: Server Address: 192.168.1.10:1883 (192.168.1.10) [10:22:47][C][mqtt:054]: Username: [redacted] [10:22:47][C][mqtt:055]: Client ID: [redacted] [10:22:47][C][mqtt:057]: Discovery prefix: 'homeassistant' [10:22:47][C][mqtt:058]: Discovery retain: YES [10:22:47][C][mqtt:060]: Topic Prefix: 'eq3bt' [10:22:47][C][mqtt:062]: Log Topic: 'eq3bt/debug' [10:22:47][C][mqtt:065]: Availability: 'eq3bt/status' [10:22:47][C][sntp:043]: SNTP Time: [10:22:47][C][sntp:044]: Server 1: ' 0.pool.ntp.org' [10:22:47][C][sntp:045]: Server 2: '1.pool.ntp.org' [10:22:47][C][sntp:046]: Server 3: '2.pool.ntp.org' [10:22:47][C][sntp:047]: Timezone: 'CET-1CEST-2,M3.5.0/2,M10.4.0/3' [10:22:47][C][mqtt.switch:038]: MQTT Switch 'Refresh Bedroom EQ3': [10:22:47][C][mqtt.switch:039]: State Topic: 'eq3bt/switch/refresh_bedroom_eq3/state' [10:22:47][C][mqtt.switch:039]: Command Topic: 'eq3bt/switch/refresh_bedroom_eq3/command' [10:22:47][C][mqtt.sensor:024]: MQTT Sensor 'Bedroom EQ3 Valve State': [10:22:47][C][mqtt.sensor:026]: Expire After: 3660s [10:22:47][C][mqtt.sensor:028]: State Topic: 'eq3bt/sensor/bedroom_eq3_valve_state/state' [10:22:47][C][eq3:272]: EQ3-Max Thermostat 'Bedroom EQ3' [10:22:47][C][eq3:273]: Update Interval: 1800.0s [10:22:47][C][eq3:274]: Mac Address: 1a220e1473 [10:22:47][C][eq3:275]: Valve 'Bedroom EQ3 Valve State' [10:22:47][C][eq3:275]: Unit of Measurement: '%' [10:22:47][C][eq3:275]: Accuracy Decimals: 0 [10:22:47][C][eq3:275]: Icon: 'mdi:percent' [10:22:49][I][eq3:042]: Requesting update of 1a220e1473... [10:22:50][E][eq3_cmd:144]: Clock source for 1a220e1473 is not valid. [10:22:50][W][eq3:051]: Update of 1a220e1473 failed. Tries left: 1. [10:22:53][I][eq3:042]: Requesting update of 1a220e1473... [10:22:56][E][eq3_cmd:144]: Clock source for 1a220e1473 is not valid. [10:22:56][W][eq3:056]: Update of 1a220e1473 failed. Too many tries. [10:22:56][D][sensor:092]: 'Bedroom EQ3 Valve State': Sending state nan % with 0 decimals of accuracy [10:24:32][I][ota:046]: Boot seems successful, resetting boot loop counter.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/esphome/feature-requests/issues/87?email_source=notifications&email_token=AASOSQNFRMHMXJYXNKGFQ7TQXS53HA5CNFSM4G2WFSJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGGZVKI#issuecomment-562928297, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASOSQPK4TG7U5AV3JUSVIDQXS53HANCNFSM4G2WFSJQ .

ayufan avatar Dec 08 '19 09:12 ayufan

Has to be specified somewhere else? wifi: not enough?

Complete YAML config > https://pastebin.com/EkR7WQDD

konzolec avatar Dec 08 '19 10:12 konzolec

You seem to miss dns, because of manual ip.

On Sun, 8 Dec 2019 at 11:06, konzolec [email protected] wrote:

Has to be specified somewhere else? wifi: not enough?

Complete YAML config > https://pastebin.com/EkR7WQDD

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/esphome/feature-requests/issues/87?email_source=notifications&email_token=AASOSQJWI3LFRHGH3Q5HUFDQXTBKNA5CNFSM4G2WFSJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGG2IQY#issuecomment-562930755, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASOSQL22MFPBR2I7DY36CDQXTBKNANCNFSM4G2WFSJQ .

ayufan avatar Dec 08 '19 10:12 ayufan

Ok, let me try without that

konzolec avatar Dec 08 '19 10:12 konzolec

Issue remains, looks like it cannot connect to my valve. Do i need to set up anything extra on the valve? MAC is correct ( 00:1A:22:0E:14:73) cuz it was working with this plugin https://github.com/softypit/esp32_mqtt_eq3. Wanted to test this solution

[13:42:08][I][eq3:062]: Requesting ID of 1a220e1473... [13:42:13][W][eq3_cmd:052]: Cannot connect to 1a220e1473. [13:42:13][W][eq3:071]: ID of 1a220e1473 failed. Too many tries. [13:42:13][I][eq3:076]: Requesting Schedule of 1a220e1473... [13:42:18][W][eq3_cmd:052]: Cannot connect to 1a220e1473. [13:42:18][W][eq3:091]: Schedule of 1a220e1473 failed. Too many tries. [13:42:18][I][eq3:042]: Requesting update of 1a220e1473... [13:42:23][W][eq3_cmd:052]: Cannot connect to 1a220e1473. [13:42:23][W][eq3:051]: Update of 1a220e1473 failed. Tries left: 2. [13:42:26][I][eq3:042]: Requesting update of 1a220e1473... [13:42:31][W][eq3_cmd:052]: Cannot connect to 1a220e1473. [13:42:31][W][eq3:051]: Update of 1a220e1473 failed. Tries left: 1. [13:42:34][I][eq3:042]: Requesting update of 1a220e1473... [13:42:39][W][eq3_cmd:052]: Cannot connect to 1a220e1473. [13:42:39][W][eq3:056]: Update of 1a220e1473 failed. Too many tries

konzolec avatar Dec 08 '19 12:12 konzolec

It can be other problem. Can you look in logs in verbose? It might not be supported maybe.

On Sun, 8 Dec 2019 at 13:45, konzolec [email protected] wrote:

Issue remains, looks like it cannot connect to my valve. Do i need to set up anything extra on the valve? MAC is correct ( 00:1A:22:0E:14:73) cuz it was working with this plugin https://github.com/softypit/esp32_mqtt_eq3. Wanted to test this solution

[13:42:08][I][eq3:062]: Requesting ID of 1a220e1473... [13:42:13][W][eq3_cmd:052]: Cannot connect to 1a220e1473. [13:42:13][W][eq3:071]: ID of 1a220e1473 failed. Too many tries. [13:42:13][I][eq3:076]: Requesting Schedule of 1a220e1473... [13:42:18][W][eq3_cmd:052]: Cannot connect to 1a220e1473. [13:42:18][W][eq3:091]: Schedule of 1a220e1473 failed. Too many tries. [13:42:18][I][eq3:042]: Requesting update of 1a220e1473... [13:42:23][W][eq3_cmd:052]: Cannot connect to 1a220e1473. [13:42:23][W][eq3:051]: Update of 1a220e1473 failed. Tries left: 2. [13:42:26][I][eq3:042]: Requesting update of 1a220e1473... [13:42:31][W][eq3_cmd:052]: Cannot connect to 1a220e1473. [13:42:31][W][eq3:051]: Update of 1a220e1473 failed. Tries left: 1. [13:42:34][I][eq3:042]: Requesting update of 1a220e1473... [13:42:39][W][eq3_cmd:052]: Cannot connect to 1a220e1473. [13:42:39][W][eq3:056]: Update of 1a220e1473 failed. Too many tries

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/esphome/feature-requests/issues/87?email_source=notifications&email_token=AASOSQI3KXTRSG4QIIBWMFDQXTT5HA5CNFSM4G2WFSJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGG5S2I#issuecomment-562944361, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASOSQILI7IU2UGFDUTPI2TQXTT5HANCNFSM4G2WFSJQ .

ayufan avatar Dec 08 '19 12:12 ayufan

I tried to compile with verbose but couldn't. Im getting a weird error.

This kind of logging compiles fine logger: level: DEBUG

But this one doesnt, might be a esphome error?

logger: level: VERBOSE

https://pastebin.com/9F3qZ9sL

konzolec avatar Dec 09 '19 06:12 konzolec

I pushed a fix for VERBOSE mode.

ayufan avatar Dec 09 '19 11:12 ayufan

Great, here is now the VERBOSE log. If you can get anything useful from it

https://pastebin.com/MkjMfWzz

konzolec avatar Dec 09 '19 11:12 konzolec

No idea. Can you run esp32_ble_tracker to scan all devices with their signal strength from ESP32?

On Mon, Dec 9, 2019 at 12:22 PM konzolec [email protected] wrote:

Great, here is now the VERBOSE log. If you can get anything useful from it

https://pastebin.com/MkjMfWzz

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/esphome/feature-requests/issues/87?email_source=notifications&email_token=AASOSQLMAALGMHZQLSKBX2LQXYTADA5CNFSM4G2WFSJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGIZ7JQ#issuecomment-563191718, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASOSQPAAHVHUUM4KZVRCQLQXYTADANCNFSM4G2WFSJQ .

ayufan avatar Dec 09 '19 11:12 ayufan

Played with bit valve BLE ON/OFF and it seems it connected now but disconected afterwards

LOG > https://pastebin.com/VfVY5Ct3

konzolec avatar Dec 09 '19 17:12 konzolec

This.: State parse of 1a220e1473 failed. Invalid size: 6.

You have older version of SW: [18:30:48][I][eq3:255]: 'Bedroom EQ3': Version: 110. I think that I run it against Version: 120 only.

I also wonder what is in: [18:30:48][I][eq3:158]: State parse of 1a220e1473 failed. Invalid size: 6.. Maybe you could run a small extension that logs that?

Also, the usage of VERBOSE kills stability of the WiFi. Do not use it for normal operation :)

ayufan avatar Dec 09 '19 19:12 ayufan