esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 36 forks source link

Problem with IR climate on Whirlpool (Galactic) IR remote control DG11J1-91 #4650

Closed TokarevSergey closed 1 year ago

TokarevSergey commented 1 year ago

The problem

Good afternoon. I use a Whirlpool (Galactic) air conditioner with an IR remote control DG11J1-91 image

and universal IR remote control Smart9 S08 based on esp8266 image

universal IR remote control Smart 9 S08 I connected to 5 volts and hid behind the cover 20230703_231522

During the first connection and setup, a device malfunction was detected. Which leads to the impossibility of creating any automation and his work in this form. Namely: if in ESPHome firmware in ****.yaml delete the line (receiver_id:)

image

in this case, when controlling a Whirlpool (Galactic) air conditioner with ESPHome climate integration, everything works well. Exactly until the moment the air conditioner is turned on from the native IR remote control DG11J1-91. After that, if any button for selecting the air conditioner operation mode is pressed in the ESPHome integration, it is physically turned off, and the shutdown button is inverted. Here's a video https://github.com/esphome/issues/assets/98225056/275b0379-e5b5-496b-9280-fca8ce8a34e8

And if in the ESPHome firmware in ****.yaml you do not delete the line (receiver_id:) image

it is not at all clear what is happening, there is no logic at all. Here's a video https://github.com/esphome/issues/assets/98225056/5532cce5-948f-4821-bcb1-3249235ea3df

Which version of ESPHome has the issue?

ESPHome Current version: 2023.6.3

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

Home Assistant 2023.6.3 Supervisor 2023.06.4 Operating System 10.3

What platform are you using?

ESP8266

Board

Universal IR remote control Smart9 S08 based on esp8266

Component causing the issue

ESPHome IR Remote Climate (Platform name: whirlpool)

Example YAML snippet

Новый точечный рисунок (4)

Anything in the logs that might be useful for us?

Новый точечный рисунок (4) — копия

Additional information

Help me please

juapem commented 1 year ago

I do have the same problem and I have not been able to solve it yet

TokarevSergey commented 1 year ago

у меня такая же проблема и я пока не могу ее решить

Maybe you know how to reach the esp home whirlpool integration developer?

ElyOshri commented 1 year ago

I also have this issue and I've been able to solve it by just turning off the receiver while I'm transmitting something. To turn off the receiver I just modified whirlpool.cpp, what I did was basically get the time when the transmission starts and if its been less then 500ms the receiving functions just returns. (you might be able to get away with less than 500ms but I didn't want to risk it)

// defining the time as a global variable
long int t1 = millis() + 500; 
void WhirlpoolClimate::transmit_state() {
  t1 = millis(); // starting the timer
  ...
}
bool WhirlpoolClimate::on_receive(remote_base::RemoteReceiveData data) {
  // Check if the esp isn't transmitting the same data
  if(millis() - t1 < 500 ){
    ESP_LOGV(TAG, "Blocked receive because of current trasmission");
    return false;
   }
  ...
}

If you want I can upload the full custom component, I just modified it a bit so it would work with my remote (DG11J1-04) which is not supported

TokarevSergey commented 1 year ago

У меня также есть эта проблема, и я смог решить ее, просто выключив приемник, пока я что-то передаю. Чтобы выключить приемник, который я только что изменил whirlpool.cpp, я в основном получил время начала передачи, и если оно было меньше 500 мс, функции приема просто возвращаются. (возможно, вам удастся обойтись менее чем 500 мс, но я не хотел рисковать)

// defining the time as a global variable
long int t1 = millis() + 500; 
void WhirlpoolClimate::transmit_state() {
  t1 = millis(); // starting the timer
  ...
}
bool WhirlpoolClimate::on_receive(remote_base::RemoteReceiveData data) {
  // Check if the esp isn't transmitting the same data
  if(millis() - t1 < 500 ){
    ESP_LOGV(TAG, "Blocked receive because of current trasmission");
    return false;
   }
  ...
}

Если вы хотите, я могу загрузить полный пользовательский компонент, я просто немного изменил его, чтобы он работал с моим пультом (DG11J1-04), который не поддерживается.

I am very grateful for your help. Please reset all code and please tell me to insert it into esphome firmware Screenshot_20230812_092011_Home Assistant Screenshot_20230812_092043_Home Assistant

ElyOshri commented 1 year ago

In order for you to add the custom component you will have to insert the following folder into /config/esphome/my_components/ whirlpool_updated.zip (do not insert it as a zip, only insert it as a folder whirlpool_updated)

After you add the custom component you will have to edit the .yaml configuration by changing the climate platform to whirlpool_updated and adding this code:

external_components:
  - source: 
      type: local
      path: my_components
    components: [ whirlpool_updated ]

The climate section should look like this:

climate:
  - platform: whirlpool_updated
    name: "Bedroom AC"
    receiver_id: rcvr
    model: "DG11J1-04"
    sensor: temp_sensor
TokarevSergey commented 1 year ago

Чтобы добавить пользовательский компонент, вам нужно будет вставить следующую папку в /config/esphome/my_components/ whirlpool_updated.zip (не вставляйте ее как zip, а только как папку whirlpool_updated)

После того, как вы добавите пользовательский компонент, вам нужно будет отредактировать конфигурацию, .yamlизменив климатическую платформу на whirlpool_updatedи добавив этот код:

external_components:
  - source: 
      type: local
      path: my_components
    components: [ whirlpool_updated ]

Раздел климата должен выглядеть так:

climate:
  - platform: whirlpool_updated
    name: "Bedroom AC"
    receiver_id: rcvr
    model: "DG11J1-04"
    sensor: temp_sensor

Please tell me. I made a mistake.

image

image

image

The system cannot restart because the configuration is not valid: Integration error: external_components - Integration 'external_components' not found.

ElyOshri commented 1 year ago

oh sorry I when I wrote ".yaml" file I meant the device file, so just paste that piece of code after the climate section in s08.yaml and remote it from configuration.yaml

TokarevSergey commented 1 year ago

о, извините, когда я писал файл «.yaml», я имел в виду файл устройства, поэтому просто вставьте этот фрагмент кода после раздела климата s08.yamlи удалите его изconfiguration.yaml

Thank you very much. You helped me a lot. Now it works less and less. But a new problem has emerged. Now if the air conditioner was turned off from the remote control and you press the "smart" button, it sends a signal to turn on and turn on the "cooling / heating" mode, and nothing happens in homeassistant integration does not understand that the air conditioner has turned on and if you press the mod selection button, it will turn on in the integration , and in fact turn off. Do you have the same?

juapem commented 1 year ago

@ElyOshri your fix worked like charm! I was thinking on doing exactly the same but had no idea how to implement it. I think this should be included in the main package of ESP @jesserockz

This has been a common issue in whirlpool and Midea

TokarevSergey commented 1 year ago

@ElyOshriваше исправление сработало как шарм! Я думал сделать то же самое, но понятия не имел, как это реализовать. Я думаю, это должно быть включено в основной пакет ESP.@jesserockz

Это обычная проблема в Whirlpool и Midea.

If only it were possible. :(

the-mentor commented 1 year ago

@ElyOshri what would it take to upstream this fix?

the-mentor commented 1 year ago

@TokarevSergey quick question. how did you get 5v inside the AC unit to mount the ir blaster?

TokarevSergey commented 1 year ago

@TokarevSergey быстрый вопрос. как вам удалось получить 5 В внутри блока переменного тока для установки ИК-бластера?

image Look in the photo there is a 3.3 volt input, I did this, measured the power and ran the wires there. This is if you have 3.3 volts there, but my power supply turned out to be 5 volts. Do you have the same air conditioner? I took 5 volt power from the IR signal receiving unit, which goes there to power the 5 volt diodes.

the-mentor commented 1 year ago

@TokarevSergey i think i have the same unit mind sending me a picture of where you pulled 5v from ?

thanks!

PS - I also submitted a PR based on the changes that @ElyOshri suggested hoping this will get upstreamed and everyone can benefit from the fix.

TokarevSergey commented 1 year ago

@TokarevSergeyДумаю, у меня такое же мнение, и я прислал мне фотографию того места, откуда ты выдернул 5 В?

Спасибо!

PS - Я также подал PR на основе изменений, которые@ElyOshriпредложил надеяться, что это будет распространено и каждый сможет извлечь выгоду из исправления.

Yes, of course, only if possible in the evening, I'm busy right now.

TokarevSergey commented 1 year ago

@TokarevSergeyДумаю, у меня такое же мнение, и я прислал мне фотографию того места, откуда ты выдернул 5 В?

Спасибо!

PS - Я также подал PR на основе изменений, которые@ElyOshriпредложил надеяться, что это будет распространено и каждый сможет извлечь выгоду из исправления.

20230928_212526 20230928_212537 20230928_212623 20230928_212656 20230928_212704 20230928_212709 20230928_212720 20230928_212737 20230928_212751 20230928_212758 20230928_212836 20230928_212844 20230928_212852 20230928_212856 20230928_212901

the-mentor commented 1 year ago

A fix for this was up streamed and should be available in the next release of esphome (2023.9.2)

glmnet commented 1 year ago

Hi, I just see this as I got @ mentioned in the PR, I was the original contributor to this component, and at the time it was working properly. I wonder how come now disabling RX during TX is required, I just tested my AC and it is not working (2023.9.0) (not sure how I didn't notice before, but I'm not used to keep my nodes updated, however I updated this recently) At first I though this was a problem with ESP32, but then I see you're also having an issue with ESP8266 too, the reason for this reasoning was that I was expecting the remote receiver to be disabled while the remote transmitter was taking place, this used to be the case as the ESP8266 does bit bang the output to generate the 38khz signal so having interrupts enabled could cause inaccurate 38khz signals.

Anyway, did anyone find this working fine until some version of ESPHome?

In any case, a transmit shouldn't cause a receive for any protocol at all, while this might not be a problem for many protocols, it can cause other unexpected behavior and odd log messaging, etc.

glmnet commented 1 year ago

I found the regression https://github.com/esphome/esphome/pull/2476/files @CarlosGS changed it so the timing is better, however he though the InterruptLock was no longer necessary. I would like to bring it back if you guys agree, a slight interrupt can cause the whole IR transmission to fail.

For ESP32 (with hw transmitter) I believe disabling remote receiver (at a base level) while transmitting is a much better idea

the-mentor commented 1 year ago

Hi @glmnet looks like the PR I submitted got merged. I read what you wrote but I'm not sure if you've suggested a better solution that will work for both esp8266 and esp32 but if you do I'm down to trying it.

Edit: in general I think the reciver should be disabled since I don't see a use case where you will ever need to receive while transmitting

glmnet commented 1 year ago

Your solution should work for ESP32 too (in case it was affected, did not try) For ESP8266 this worked before as interrupts were disabled while transmitting, since this is no longer the case this problem showed up here. I propose to disable interrupts again, this should make the transmitter even more reliable and as a bonus mute the receiver.

To test this approach, you have to add InterruptLock lock; as it was in the code before the PR I mentioned in the previous post.

Receiving IR or RF signals while transmitting signals might have some useful cases only when the media is different, i.e. different frequencies in RF or different rooms in IR (light)

I guess remote_transmitter could have a mute: property to mute remote receivers, this could address more scenarios, in case somebody would like to deal with that.

CarlosGS commented 1 year ago

@glmnet I see! Though ESP8266's implementation should still be robust in the presence of normal interrupts (checked the ESPHome codebase at the time and there were no long interrupts, and TX adapts to any variations https://github.com/esphome/esphome/pull/2476#issuecomment-952188362), I still don't think the interrupt lock is necessary. Instead the separate mute: parameter would be a great option for more flexibility, will keep an eye for other TX/RX issues where it could help.

But yeah this particular one should now be solved for both platforms, nice debugging job all :+1:

the-mentor commented 1 year ago

@TokarevSergey you can close this issue since the fix is now available in the public release of esphome 2023.9.2

TokarevSergey commented 1 year ago

Now I don’t have time, I’ll check everything and close it. Thank you.

TokarevSergey commented 1 year ago

@TokarevSergeyвы можете закрыть эту проблему, поскольку исправление теперь доступно в общедоступной версии esphome 2023.9.2.

At this stage the situation is like this.

If the air conditioner is turned off. and press "SMART" on the remote control image

Then the air conditioner turns on image

And in the Home Assistant integration the following happens: the temperature is set to 23 degrees and the “Heating/Cooling” mode does not turn on. image

after clicking any of these buttons image

Then the air conditioner turns off image

And what happens when you integrate Home Assistant is that it turns on. image

And if you continue to press the buttons on the integration board, the mode changes, but the air conditioner does not turn on until you turn it on from the remote control. image

Please help me figure it out. Below is my configuration, maybe I configured something wrong?

esphome: name: s08ir platform: ESP8266 board: esp_wroom_02

wifi: ssid: "DomWiFi" password: "Dom1WiFi2" fast_connect: true

logger: level: DEBUG

api: password: "s08ir"

ota: password: "s08ir"

status_led: pin: number: GPIO4

remote_receiver: id: "s08_receiver" pin: number: GPIO5 inverted: true dump: all

remote_transmitter: id: "s08_transmitter" pin: number: GPIO14 inverted: false carrier_duty_percent: 55%

binary_sensor:

sensor:

climate:

TokarevSergey commented 1 year ago

@TokarevSergey you can close this issue since the fix is now available in the public release of esphome 2023.9.2

please help

prokudin07 commented 1 year ago

@TokarevSergeyвы можете закрыть эту проблему, поскольку исправление теперь доступно в общедоступной версии esphome 2023.9.2.

At this stage the situation is like this.

I have exactly the problem. Compared commands in the raw format from the native IR remote and from esphome object in debug log - almost identical

prokudin07 commented 1 year ago

@TokarevSergey Думаю, что надо закрыть это issue и открыть новое. То, что на скрине и ниже - написать новое, так как ту проблему решили, а новую создали и упомяни меня в тексте, поддержу.

image
TokarevSergey commented 1 year ago

Thank you. For your understanding and help. Enter how this problem was solved. But another problem came up, I described it in this topic #5014

TokarevSergey commented 1 year ago

Thank you. For your understanding and help. Enter how this problem was solved. But another problem came up, I described it in this topic #5014