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

Relay states #17

Closed
uls169 opened this issue Sep 15, 2019 · 107 comments
Closed

Relay states #17

uls169 opened this issue Sep 15, 2019 · 107 comments
Assignees
Labels
enhancement New feature or request

Comments

@uls169
Copy link

uls169 commented Sep 15, 2019

Hi, do I understand well that I can't get status of relay with this firmware? I don't want to set it manually, but it is good to see when thermostat's relay is on or off back in home automation software (hass in my case).
Thanks.

@ghost
Copy link

ghost commented Sep 22, 2019

with automation rules you could check if actualTemperature < desiredTemperature -> relay is on.

How did you do the configuration in home assistant? Can you share your config for the themostat?

@uls169
Copy link
Author

uls169 commented Sep 23, 2019

Good idea with automation rule, but I think this way we could use as fault verification only.
Of course it is only an opinion. I don't know if the thermostat MCU sends state of relay to ESP. If not, my idea is nonsense.
I have not configured it in my production HASS server yet, I have this device installed for year with original FW, now I flashed klaus one and I only tried to check status and set it via mqtt (on my test HASS server). I asked for relay state in the moment when I thought about reasonable integration. Every relay device what I saw had state feedback (from sonoff to xiaomi or z-wave fibarro or heatit) if I remember well.
How I said, it's just idea, I don't know if it can be implemented well.

@cclein
Copy link

cclein commented Sep 23, 2019

I could see that being usefull. When the relay is on your home automation system triggers a ceiling fan, etc...

@uls169
Copy link
Author

uls169 commented Oct 29, 2019

Or simply for power consumption calculation.

@bikemike
Copy link

bikemike commented Nov 9, 2019

The MCU doesn't send the relay state. You would need to modify the board to hook the relay control pin on the MCU up to a gpio pin on the ESP. Then you'd need to modify the code as well.

I have done this and it works well but I'm using my own custom firmware.

Here is a pic of the board mod. I added a 10k/10k voltage divider to drop the MCU voltage from 5 to 2.5v.

MVIMG_20191108_231026

@uls169
Copy link
Author

uls169 commented Nov 10, 2019

@bikemike mike, thanks, simple idea, simple solution. Can you provide code diff so we can check your changes? Or firmware file as @pmaster555 mentioned in post above?

@fabcia
Copy link

fabcia commented Nov 13, 2019

@bikemike, I join the @pmaster555 and @uls169 requests for changes (diff in code) or firmware. I hope to have your news soon ....

@bikemike
Copy link

I have some code that does this in my C17GH3 thermostat repository here:

https://github.com/bikemike/C17GH3Thermostat/blob/master/src/main.cpp#L35

Search for PIN_RELAY_MONITOR and relayOn

I'm adding support for my BHT-002-GBLW to that codebase but I haven't quite finished it yet. I'll post again when I get it working reasonably well with Home Assistant and the MQTT HVAC component.

@klausahrenberg klausahrenberg added the enhancement New feature or request label Nov 15, 2019
@klausahrenberg klausahrenberg self-assigned this Nov 15, 2019
@klausahrenberg
Copy link
Owner

The device has no flag for relay working or not. I like the solution of bikemike. Maybe I will include the flag in my firmware also. At the tyua module are almost all IOs available, to use this for relay state is a good idea.

@bikemike
Copy link

I've added support for BHT-002-GBLW to my firmware now but be warned that it isn't very user friendly. It requires changing the timezone in code and compiling - both of which I haven't documented yet.

https://github.com/bikemike/MikesThermostat

@coldfire84
Copy link

Is there something we can do here that's purely software? i.e. some logic in the formware that works out target temperature, set point, whether heating schedule is active or manual mode is enabled and returns what is, in effect, the state of the relay?

@bikemike, does your hardware modification allow for control of the relay, or is it simply state only?

@bikemike
Copy link

You could probably compute the state of the relay but I don't think the "deadzone temperature" setting is transmitted from the MCU so you would have to have an additional setting for that on the wifi module. For me it was just easier to solder a wire.

If you want to control the relay then you would have to make additional hardware changes. I did this for another thermostat I have (C17GH3) so I could control two relays (for baseboard electric and a gas fireplace). I disconnected the MCU from the relay and rewired so the wifi module reads the state from the MCU and controls both relays.

@valepe
Copy link

valepe commented Nov 29, 2019

Does anyone can tell me where solder the voltage divider on the BHT-6000 thermostats?
Link: BHT-6000 board

@bikemike
Copy link

@valepe You will need to check which pin on J1 connects to the relay control. If it is like my board(bac-002-wifi), the second from the bottom is GND, and 4th from the bottom is the relay pin.

@klausahrenberg
Copy link
Owner

Software solution for this hw modification is implemented now in 0.97

@ahmaddxb
Copy link

Software solution for this hw modification is implemented now in 0.97

Can you elaborate more on this? Do you still need to do the hardware mod or is this all done in software now.

@klausahrenberg
Copy link
Owner

klausahrenberg commented Dec 11, 2019

Hi, ok to explain. This issue can not be solved by software only. The thermostat (MCU) definitily sends no state info of the heating relay. Please do the small modification that bikemike showed here: #17 (comment)
My firmware now asks for GPIO05 and sends the state. But it works only with this hardware modification.

@ahmaddxb
Copy link

@bikemike My board look like this. As you can see I have a J3Y on Q3 and Q4 as well as something on R9 and R10. How would I go about checking which connection point is needed to be made. Could i test is with a multimeter while turning on and off the relay by adjusting the temperature controls on the unit? Also what would I be looking for? Or could you tell me the correct way to approach this. Thanks

20190429_141805

@realthk
Copy link

realthk commented Dec 12, 2019

It is a different setup indeed, though the board is the same, but your seems to have transistors where our version is left empty at Q3, Q4, only a 0 resistor on Q4:
20191211_121725
But as the panel is the same, the relay control line is most likely still on R10 and the affected leg of Q4 is also GND, so it should not be any different to get the signal.
BTW, which model is that? Mine is this.

@klausahrenberg
Copy link
Owner

My board look like this. As you can see I have a J3Y on Q3 and Q4 as well as something on R9 and R10.

@ahmaddxb Could you let me know your exactly model? Does your model supports more function, like cooling/ventilation? And also, if the hw modification is also working at your model - I would wonder, if this would not work because layout is the same.

@ahmaddxb
Copy link

ahmaddxb commented Dec 13, 2019

Yes mine has heating cooling and ventilation modes, model is BAC-002ALW used for 2 Pipe 3 Speed Central Air conditioner.
I only use it for cooling side and wanted to monitor the state of the repay to know when the valve is opened on my AC.

https://www.aliexpress.com/item/32913037607.html?spm=a2g0s.9042311.0.0.27424c4dqwOdze

I haven't tried the hw mod yet i wanted to know a way to test if putting the wire in the same location as @bikemike if it could work on my model. Is there some test i could do with a multimeter while triggering the relay on and off with the unit by adjusting the temperature to above and below the desired temp.

@bikemike
Copy link

@ahmaddxb, yours probably has multiple relays so you will have to figure out which one is used for cooling and trace that back from the relay to the board. You'll have to disconnect the thermostat and use a multimeter to check continuity with the relay signal pin and the ribbon cable pins.

@shin-01
Copy link

shin-01 commented Dec 21, 2019

For some reasons, I think in BHT-6000 heating and off state are swapped...

OFF state:
{"idx":"thermostatbeca_11482470","ip":"192.168.1.105","firmware":"1.00","temperature":20.50,"targetTemperature":20.00,"deviceOn":true,"schedulesMode":"off","state":"heating"}

On State:
{"idx":"thermostatbeca_11482470","ip":"192.168.1.105","firmware":"1.00","temperature":20.50,"targetTemperature":22.50,"deviceOn":true,"schedulesMode":"off","state":"off"}

@funtik039
Copy link

funtik039 commented May 10, 2020

Hi all. I have BAC-2000WIfi. Its the same as BAC-002GALW.
6TXLQ8GLw38

But it have another board.
Some one can help whis it? How to upgrade this termostat?
IfB0O6tJ3As

In my logic it must be like this:
mod

@kicune
Copy link

kicune commented Apr 6, 2022

Does anyone can tell me where solder the voltage divider on the BHT-6000 thermostats? Link: BHT-6000 board

I found the following place for heating state connection on BHT-6000. I used pads for the non-soldered Q4 and R9 parts, which simplified the task nicely, IMO. I had only 1206 resistors at hand; something smaller, like 0805 would be even better.
I also cut off the track from Q4 to the via just to be sure, but I think it would be OK even if it stays there. Also note that I had to replace the wifi module for standard ESP12e - AFAIK new units are all shipped out with RTL module, which is unusable for our purpose (had about 5 in my hands, all RTL-based).
PXL_20220406_063401358 MP
PXL_20220406_063411508 MP

@kicune
Copy link

kicune commented Apr 20, 2022

I also cut off the track from Q4 to the via just to be sure, but I think it would be OK even if it stays there.

Well, as I learned later, it would not. With Q4 track in place, the output of relay is connected to the thermocouple, causing it to report insanely high temperatures. So just scratch it away with a exacto knife or some other sharp object.

@ikke-t
Copy link

ikke-t commented Aug 29, 2022

Hi,
thanks for the tips here. I thought I upload pictures of my newer version of ME81H. I ordered some random brand from e-bay, which had no wifi. I added this firmware to Wemos Mini D1, and unsoldered the esp-12 chip, and put it into ME81H. Then I found R2 location had changed a bit, but still it seems to work the same as previous pics. It gives the heating state, Here are the pics from the newer revision:

Before ESP:
IMG_20220818_223829

With ESP:
IMG_20220829_190229

And with the relay state info voltage drop down:
IMG_20220829_192424

@rande83
Copy link

rande83 commented Oct 8, 2022

Hi guys.

I recently bought a Beca BHT-002 from Amazon.
Apparently a new hardware variant has been installed here.
The chip used here is the Tuya CB3S, which cannot be flashed with Tasmota.
As a replacement, I have already flashed and transplanted an ESP-12S.

Now to the actual question:
Does anyone know how I can get the relay status on the GPIO with this new layout?

IMG_20221008_140502_Arcide-LMC8.4-v2.3~2.jpg

regards

@Mictronics
Copy link

I bet the 0 Ohm resistors on Q5 and Q6 are the signals for valve open and close. You have to probe status for each.

@ZsZs73
Copy link

ZsZs73 commented Oct 9, 2022

Have you tried to check the pin of J2 like here #17 (comment)

@rande83
Copy link

rande83 commented Oct 9, 2022

OK, I have just taken the measurements...

The relay status is really via the 0 Ohm resistors of Q5 & Q6.

In this case, with this board revision, the signal from the resistor must be tapped via Q5 or from the corresponding pin of pin header J2.

Thank you very much.

@REDKIY-RAK
Copy link

Хорошо, я только что сделал замеры...

Состояние реле действительно определяется через резисторы 0 Ом Q5 и Q6.

В этом случае, при такой ревизии платы, сигнал от резистора должен быть снят через Q5 или с соответствующего вывода контактного разъема J2.

Большое вам спасибо.

Hello. I have exactly the same fee as you. Could you show me where and what to solder, I'm not good at this.

@dwarning
Copy link

Sorry - one stupid question: What is the difference of this hardware hack to the mqtt variables action (heating/idle) or state (heating/cooling)? I have a BHT-002 GALW flashed with fashberg firmware and using in this case action to show the state of the heater very well. Before I build in the wall thermostat I check by a lamp and per ear if the relay is working and is in line with action variable, And it is!
So what value has the hardware hack? More trust?

@rp3tya
Copy link

rp3tya commented Feb 7, 2023

... I had to replace the wifi module for standard ESP12e - AFAIK new units are all shipped out with RTL module, which is unusable for our purpose (had about 5 in my hands, all RTL-based).

How did you remove the original module? This turned out to be more challenging than it appears at first sight, but is a very attractive upgrade.

@kirscheGIT
Copy link

Use a heat gun set to a temp of a little bit more than 260C. Before remove the LCD otherwise it will leave some black marks on the screen.

@kicune
Copy link

kicune commented Feb 8, 2023

I used Chipquik SMD solder removal kit (https://www.chipquik.com/store/product_info.php?products_id=210001), it helps tremendously. First I remove the maximum amount of original solder with solder wick, then add Chipquik to the contacts. Heat gun also helps, but it is not strictly necessary with this setup - component usualy falls off by itself.

@DSF4ever
Copy link

DSF4ever commented Feb 8, 2023

In case you find in other new devices (beside our beloved thermostats) as well new chips inside (like WB2S, WB3S, WB3, CB3S, CBU, ...) there is a good chance that it is already supported with OpenBeken (or OpenBK) firmware.
see: https://openbekeniot.github.io/webapp/devicesList.html

May be worth to check before starting the chip transplantation ;-)

And may be, somewhere in the future, someone is smart enough (and find the time) to develop based on this work a new firmware for the new Tuya chip thermostats?

@eisengrau
Copy link

The solder pads shown on the picture posted by bikemike are not availeble in this version, so hopefully I found a general solution for all versions: just add resitors around the connector IMG_20220108_202838 I found only 2.4kOhms resistors but the value doesn't really matter if it is in the kOhms range. edit: grammar

Hello,

I have the same board. As I see, the resistors that you soldered in paralel. Is one of them touching C4?

@ZsZs73
Copy link

ZsZs73 commented Mar 6, 2023

Actually they are not parallel but serial, making a voltage divider.
The pin 5 of the connector will be switched to 5V when the heating is on (otherwise it is at 0V). Pin 7 of the same connector is GND, and the pin of C4 where the resistor is soldered is also at GND. So in the end the middle of the divider will be at 2.5V with heating on and 0V with heating off.
Pin 1 of the connector is the one with square shaped soldering pad.
I hope that this explains.

@cparg
Copy link

cparg commented Apr 22, 2023

I recently bought a Beca BHT-002 from Amazon. Apparently a new hardware variant has been installed here. The chip used here is the Tuya CB3S, which cannot be flashed with Tasmota. As a replacement, I have already flashed and transplanted an ESP-12S....

Hello @rande83, could you get this to work ?

@rande83
Copy link

rande83 commented Apr 22, 2023

I recently bought a Beca BHT-002 from Amazon. Apparently a new hardware variant has been installed here. The chip used here is the Tuya CB3S, which cannot be flashed with Tasmota. As a replacement, I have already flashed and transplanted an ESP-12S....

Hello @rande83, could you get this to work ?

Hi.

Yes, it's working fine... 👍

@andreas-bulling
Copy link

andreas-bulling commented Oct 22, 2023

The solder pads shown on the picture posted by bikemike are not availeble in this version, so hopefully I found a general solution for all versions: just add resitors around the connector IMG_20220108_202838 I found only 2.4kOhms resistors but the value doesn't really matter if it is in the kOhms range. edit: grammar

which resistors would be even better here? Thanks!

And did you not have to replace the Wifi module - afaik this one cannot be flashed/uses a different chip?

@ZsZs73
Copy link

ZsZs73 commented Oct 23, 2023

The relay pin is dirven by the other microcontroller on the PCB and the two possible voltages are 5V or 0V
The purpose of these two resitors is to protect the input pin (GPIO5 in this case) of the ESP chip as it is not 5V tolerant.
Ideally the otput of the voltage divider should provide logical 1 which is 3.3V to the GPIO5 input. (rather slightly less than slightly more)
A divider like 5V - 3.3k - OUT - 4.7k - GND would provide ~3V at the output.
But I'd not bother too much with the values. I guess any voltage above 2V is considered as logical 1, just pick two identical resistors in 2k-22k range and it would be ok.

All the thermostats I bought from MOES arrived with TYWE3S module which is based on ESP8266 according to its data sheet
I had to desolder them in order to flash them initially as the TX-RX pins are connected to the other controller which interferes with the flashing.

@andreas-bulling
Copy link

andreas-bulling commented Oct 23, 2023

Thanks a lot - this is tremendously helpful.

I also desoldered them but thought I'd need to completely replace them. I put an ESP 12s there instead...

UPDATE:
I just did the modification and it works like a charm. The thermostat I am using is a Moes WHT-NV-GB-WH-M
Thanks so much again @ZsZs73 !

@andreas-bulling
Copy link

andreas-bulling commented Oct 26, 2023

One additional question though: If the target temperature is set to 20 degrees and the current floor temperature is 16 degrees - then upon activating the thermostat it should start heating, right?! For some reason I have to set it to 24 degree for it to turn on. Is this "normal"/the same for you?

@rande83
Copy link

rande83 commented Oct 26, 2023

The important thing is the room temperature and not the floor temperature. Have you already calibrated (set the offset) the thermostat correctly with the help of another accurate thermometer?

@andreas-bulling
Copy link

andreas-bulling commented Oct 26, 2023

Thanks for your reply. What sense does that make if I may ask?

Wouldn't one want to set the target temperature for the floor given that most underfloor heating systems (for sure ours) are not meant to heat up the room but to provide comfort/warm feet? The original thermostat from AEG (that I replaced with the one from Moes) also operates around the floor temperature.

But I guess this is internal to the tuya mcu and cannot be changed?

How can I calibrate the thermostat?

@andreas-bulling
Copy link

I think I found a solution - the thermostat luckily offers a "system function" menu through which internal settings can be accessed. One setting is about the internal and external temperature sensor. I've set that to "external only" and this seems to do the trick.

@Andi-Coder
Copy link

OK, I have just taken the measurements...

The relay status is really via the 0 Ohm resistors of Q5 & Q6.

In this case, with this board revision, the signal from the resistor must be tapped via Q5 or from the corresponding pin of pin header J2.

Thank you very much.

Hi @rande83 do you have a picture how to solder it?

@rande83
Copy link

rande83 commented Dec 8, 2023

Thanks for your reply. What sense does that make if I may ask?

Wouldn't one want to set the target temperature for the floor given that most underfloor heating systems (for sure ours) are not meant to heat up the room but to provide comfort/warm feet? The original thermostat from AEG (that I replaced with the one from Moes) also operates around the floor temperature.

But I guess this is internal to the tuya mcu and cannot be changed?

How can I calibrate the thermostat?

Hi, of course underfloor heating is there to heat the room and not primarily to keep your feet warm. That is the basic function of underfloor heating.

@rande83
Copy link

rande83 commented Dec 8, 2023

OK, I have just taken the measurements...

The relay status is really via the 0 Ohm resistors of Q5 & Q6.

In this case, with this board revision, the signal from the resistor must be tapped via Q5 or from the corresponding pin of pin header J2.

Thank you very much.

Hi @rande83 do you have a picture how to solder it?

Hi. Unfortunately I'm a bit busy these days, but I'll try to disassemble the device in the next days to provide you a picture.

@rande83
Copy link

rande83 commented Dec 14, 2023

@Andi-Coder here you have a picture of my device.

IMG_20231214_194448_Arcide-LMC8.4-RX2P-v3~3.jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests