Skip to content
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

eQ-3 Bluetooth Thermostat support #87

Closed
bbbenji opened this issue Feb 27, 2019 · 67 comments
Closed

eQ-3 Bluetooth Thermostat support #87

bbbenji opened this issue Feb 27, 2019 · 67 comments

Comments

@bbbenji
Copy link

bbbenji commented Feb 27, 2019

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

@snizzleorg
Copy link

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

@egon0
Copy link

egon0 commented Mar 8, 2019

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

@inforsgit
Copy link

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

@barthand
Copy link

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?

@inforsgit
Copy link

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
Copy link

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!

@OttoWinter
Copy link
Member

@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.

@animavitis
Copy link

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

@Ilpredatore
Copy link

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.

@OttoWinter
Copy link
Member

@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.

@pieter
Copy link

pieter commented Oct 13, 2019

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.

@ayufan
Copy link

ayufan commented Dec 4, 2019

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.

@inforsgit
Copy link

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!

@ayufan
Copy link

ayufan commented Dec 5, 2019

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.

@inforsgit
Copy link

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

@ayufan
Copy link

ayufan commented Dec 5, 2019

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

@ayufan
Copy link

ayufan commented Dec 5, 2019

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

@konzolec
Copy link

konzolec commented Dec 8, 2019

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

@ayufan
Copy link

ayufan commented Dec 8, 2019 via email

@konzolec
Copy link

konzolec commented Dec 8, 2019

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

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

@ayufan
Copy link

ayufan commented Dec 8, 2019 via email

@konzolec
Copy link

konzolec commented Dec 8, 2019

Ok, let me try without that

@konzolec
Copy link

konzolec commented Dec 8, 2019

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

@ayufan
Copy link

ayufan commented Dec 8, 2019 via email

@konzolec
Copy link

konzolec commented Dec 9, 2019

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

@ayufan
Copy link

ayufan commented Dec 9, 2019

I pushed a fix for VERBOSE mode.

@konzolec
Copy link

konzolec commented Dec 9, 2019

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

https://pastebin.com/MkjMfWzz

@ayufan
Copy link

ayufan commented Dec 9, 2019 via email

@inforsgit
Copy link

Hi! Is there any reason why MQTT is mandatory for this component? I'm using the Home Assistant API connection so I don't actually need the MQTT but it won't compile without it. In addition I'm having some issues with MQTT, as reported in esphome/issues#951.

@Ilpredatore
Copy link

Hello everybody! any news regarding developing eq3 integration?
thank you very much

@aqualx
Copy link

aqualx commented Feb 14, 2020

Hi! Is there any reason why MQTT is mandatory for this component? I'm using the Home Assistant API connection so I don't actually need the MQTT but it won't compile without it. In addition I'm having some issues with MQTT, as reported in esphome/issues#951.

MQTT is mandatory only if you have expire_after setting:

    valve: # optional, allows to see valve state in %
      expire_after: 61min

@aqualx
Copy link

aqualx commented Feb 14, 2020

Hello everybody! any news regarding developing eq3 integration?
thank you very much

It is already working with custom_component made by @ayufan.
Works nice without any major issues at all.
In my case ESP-32 should be not farther than 3-5m from EQ-3 for stable connection.

@Gravitate1
Copy link

@ayufan Your component works really well.
However, I find that it becomes unstable and constantly loses wifi connection when linked to more than a single EQ-3.

Does this happen for anyone else?

Is there any configuration that would help prevent this as it's not really viable for me to set up one esp32 board for every EQ-3 in the house?

@Truck0ff
Copy link

Can we implement a custom Bluetooth sensor that can be associated with the esp32 Bluetooth module and read its values.
For me I have door switches and the climate controlled modules.
Sorry my python is very rusty and getting into esphome again after a few years.
I have 3 esp32, and 3 Bluetooth door sensors from Bunnings in the grid connect series. Along with the Bluetooth climate sensors.
I haven’t pulled them apart yet to look at the board or the architecture but don’t know yet if the integration to the esp32 through Bluetooth would be a massive gain.

@Abbadon89
Copy link

Is there any way we can make this work with esp32_ble_tracker at the same time?

This is made on purpose. No, it just doesn't work stable with the concurrent WiFi/BT access otherwise. Maybe it would be possible to run it, but I prefer to avoid that :)

I tried to use one esp as 'bridge' for one eq3 and few miflora devices but esp32 ble tracker is required to do so. Any way to bypass that limitation?

@yunnanpl
Copy link

In order to do so (multiple functionalities on esp32), and as I had some stability issues with https://github.com/softypit/esp32_mqtt_eq3, I decided to rewrite it in python (I am less bad at python :D).
At the moment it has basic eq3 functionality, and it reads Mijia thermometers. I will add ATC thermometers later.
Furthermore, it has homeassistant mqtt autodiscovery functionality, so there is no need to configure the climate entities (as it is quite burdensome). I see no issue to add miiflora to it.
In addition, it scans BLE every 1-2 minutes, as a preparation for device tracking and presence detection. You are free to check it out: https://github.com/yunnanpl/esp32_python_eq3

@h0jeZvgoxFepBQ2C
Copy link

With the new bluetooth proxy support, would it be possible to just forward the eq3 bluetooth data to home assistant via proxy?

@h0jeZvgoxFepBQ2C
Copy link

Sorry if I ask you @OttoWinter , but is this something which Home assistant has to implement or is there a support code required in esphome to make eq3 bt thermostat running via bluetooth proxy?

@nagyrobi
Copy link
Member

The Bluetooth proxy of ESPHome currently only provides Home Assistant with passive sensor data that is advertised by certain devices. Not all devices are supported and ESPHome does not decode or keep a list.

To find out if your device is supported, please search for it in the Home Assistant Integrations list.

The Individual device integrations in Home Assistant (such as BTHome) will receive the data from the Bluetooth Integration in Home Assistant which automatically aggregates all ESPHome bluetooth proxies with any USB Bluetooth Adapters you might have.

@h0jeZvgoxFepBQ2C
Copy link

Ok, so I guess to make the eq3 thermostat running Home Assistant would have to add some code for it as far as I understood? At least to get the passive sensor data (temperature)? Active control is not possible then I guess?

@inforsgit
Copy link

I'm really hopeful that the bluetooth proxy function will one day allow for EQ3 control via home assitant but indeed, my understanding is that it's not currently there. In the Home Assitant release notes it mentions indeed that

Bluetooth proxies are currently limited to forwarding passive data. Active connections are coming in a future release.

So I assume this means that EQ3 control would need this future release to make it happen.

In terms of an EQ3 integration for Home Assitant, I believe it's already there: https://www.home-assistant.io/integrations/eq3btsmart/ - it would just be a case of this using the proxies.

@h0jeZvgoxFepBQ2C
Copy link

So you think the passive temperature transmission should be working already with the bluetooth proxy?

@inforsgit
Copy link

So you think the passive temperature transmission should be working already with the bluetooth proxy?

I'm not sure, I've not tested it, but if someone has a Pi running HA then they could give it a go. In any case I don't think it would be so useful because the eq3 doesn't acutally report its sensed temperature AFAIK, as it mentions in the HA integration:

As the device doesn’t contain a temperature sensor (read more), we report target temperature also as current one.

@nagyrobi
Copy link
Member

nagyrobi commented Sep 20, 2022

Wow that's a really smart one! A thermostat without a built-in temperature sensor! Who would have thought...

Anyway, ESPHome's bluetooth proxy is not yet ready to replace a full-featured USB Bluetooth dongle, but hopefully in the near future it will be.

@ayufan
Copy link

ayufan commented Sep 20, 2022

Wow that's a really smart one! A thermostat without a built-in temperature sensor! Who would have thought...

It has sensor, but it is not exposed via BT since the control of thermostat is done on separate IC while BT is after-though on separate IC.

@h0jeZvgoxFepBQ2C
Copy link

As the device doesn’t contain a temperature sensor (read more), we report target temperature also as current one.

Ahhhh damn, forgot about this. Yeah, then the bluetooth proxy is no solution at all at the moment unfortunately :( Maybe then when the active bluetooth relaying comes in HA...

@maunsen
Copy link

maunsen commented Oct 6, 2022

As the newest Homeassistant release supports Active Bluetooth Proxy and the eq3 thermostats are already available as a component in hass it could work as of now.
I am not at home until sunday, so unfortunatly I can't try it out right away.

@000al000
Copy link

000al000 commented Oct 6, 2022

In home assistant eq3 component is broken now

@h0jeZvgoxFepBQ2C
Copy link

Is there a issue already created on github? If yes, could you link it?

@000al000
Copy link

000al000 commented Oct 6, 2022

home-assistant/core#76040

@000al000
Copy link

I tried Active Bluetooth Proxy - no success :(

@h0jeZvgoxFepBQ2C
Copy link

Me too, didnt work.

@dbuezas
Copy link

dbuezas commented Oct 20, 2022

Here's a new custom component that does work with the newer Home Assistant https://github.com/dbuezas/eq3btsmart

Could someone that had the thermostats working with esphome tell me if the BTProxy works? (For me it doesn't, but I suspect it is because the Firmware Version)

If you could drop there any error logs, I may be able to get it working with BTProxies too
Update: it does not work with BTProxy

@ariznaf
Copy link

ariznaf commented Jan 9, 2023

Hello, I am very interested in this component too.

I have tried the custom component from @ayufan, but it gives me an error when imported and compiling climate.py, so I could not test it.

I have opened an issue.

I will try the component from you, @dbuezas to see if it works for me.
Thank you for the efforts.

@gmag11
Copy link

gmag11 commented Jan 10, 2023

I leave this here if it helps to anybody. This is not actually related to EspHome, sorry for that.
I've forked @softypit and modified it to add Home Assistant MQTT discovery so, as soon as you configure EQ3 gateway in an ESP32, it registers itself to add a device for every EQ3 valve.
https://github.com/gmag11/esp32_mqtt_eq3
Binaries are included in releases

@bbbenji bbbenji closed this as completed Feb 21, 2024
@AleXSR700
Copy link

Hi everyone,
I am just curious if eQ-3 support has made its way into ESPHome?
I am currently using tasmota as a bluetooth proxy but would like to try ESPHome because of its BTHome support (for my T&H sensors).

@github-actions github-actions bot locked and limited conversation to collaborators Sep 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests