-
Notifications
You must be signed in to change notification settings - Fork 836
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
Support for Samsung AC to turn off #1648
Comments
Why didn't you follow the template that was created when you opened this issue? That contains valuable info for us. Are you using the "controlsamsungac example" completely unmodified? |
I wanted to provide more info , but since I am very new to this, some of them I did not understand. |
Can you please include the entire code in which it fails to turn off, so we can try to reproduce the problem? |
Also, what version of the library or |
/* Copyright 2019 David Conran
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
* Suggested circuit:
* https://github.com/crankyoldgit/IRremoteESP8266/wiki#ir-sending
*
* Common mistakes & tips:
* * Don't just connect the IR LED directly to the pin, it won't
* have enough current to drive the IR LED effectively.
* * Make sure you have the IR LED polarity correct.
* See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
* * Typical digital camera/phones can be used to see if the IR LED is flashed.
* Replace the IR LED with a normal LED if you don't have a digital camera
* when debugging.
* * Avoid using the following pins unless you really know what you are doing:
* * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
* * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere.
* * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
* * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
* for your first time. e.g. ESP-12 etc.
*/
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Samsung.h>
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRSamsungAc ac(kIrLed); // Set the GPIO used for sending messages.
void printState() {
// Display the settings.
Serial.println("Samsung A/C remote is in the following state:");
Serial.printf(" %s\n", ac.toString().c_str());
}
void setup() {
ac.begin();
Serial.begin(115200);
delay(200);
// Set up what we want to send. See ir_Samsung.cpp for all the options.
Serial.println("Default state of the remote.");
printState();
Serial.println("Setting initial state for A/C.");
ac.off();
ac.setFan(kSamsungAcFanLow);
ac.setMode(kSamsungAcCool);
ac.setTemp(25);
ac.setSwing(false);
printState();
}
void loop() {
// Turn the A/C unit on
Serial.println("Turn on the A/C ...");
ac.on();
ac.send();
printState();
delay(5000); // wait 15 seconds
// and set to cooling mode.
Serial.println("Set the A/C mode to cooling ...");
ac.setMode(kSamsungAcCool);
ac.send();
printState();
delay(15000); // wait 15 seconds
// Turn the A/C unit off.
Serial.println("Turn off the A/C ...");
ac.off();
ac.send()
printState();
delay(15000); // wait 15 seconds
// Turn the A/C unit off.
Serial.println("Turn off the A/C ...");
ac.off();
ac.send()
printState();
delay(15000); // wait 15 seconds
} library is the latest I am using it in esp32. Let me know if there is any particular pin that I got to use for this to work. |
Btw. You're missing Okay. The Samsung A/C class will not send a second special "Off" message when it thinks the A/C is already off. As long as the power state changes in the class between See: IRremoteESP8266/src/ir_Samsung.cpp Lines 358 to 361 in 203a61e
Or put another way, sending two "off" messages without turning the device "on" (via the class), the second off will never send the correct message because it believes it is already off. |
Mine was working till I upgraded to 2.7.19 / 2.7.20 - Samsung AC will no longer turn off. I rolled back to version 2.7.18 and everything working as it used to. @gladson1990 - try forcing the version and check again? |
* Remove "signature" checks, as they were flat out wrong. We were trying to use the checksum as a fixed signature. This caused some messages to fail to decode on the ESP. * Streamline some code. * Clean up some code style formatting. * Remove bad assumptions of bits that controlled settings that were actually located in the checksum bytes. * Write a huge unit test to simulate and verify the code in Issue #1648 should do the correct thing. Fixes #1648 (Hopefully) Ref #1277
@gladson1990 & @rg2k I've created a test to verify the code you submitted, and it seems to (now at least) do what I said it should in #1648 (comment) IRremoteESP8266/test/ir_Samsung_test.cpp Lines 1675 to 1766 in e2b01f5
FYI @xorbital @IceOnly ... That PR should address #1277 (comment) |
Sure @crankyoldgit I ll try and let u know. Appreciate your knowledge of fixing things fast! |
@crankyoldgit I tried with the branch, and it did not work for me. // Example of data captured by IRrecvDumpV2.ino const uint16_t kSamsungAcStateLengthlo =21; uint8_t samsungState[kSamsungAcStateLengthlo] = {0x02, 0xB2, 0x0F, 0x00, 0x00, 0x00, 0xC0, 0x01, 0xD2, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x01, 0x12, 0xAF, 0x71, 0x80, 0x15, 0xC0}; |
I can also confirm that the branch did not work. |
Can you please capture the same sequence of signals/messages from the real remote? That way I can compare the two. |
* Ground truth data indicates the initial analysis of the power setting bits was lacking. Power control seems to be located in two places. Same location in each of the two main 7 byte sections. * Use user provided data to confirm we can sucessfully construct the same "Off" message. * Update & extend Unit test coverage to support this. Fixes #1648 FYI #1277
I think I've found the issue. It seems the power setting is located in two places in the protocol message, not the single place the initial analysis had determined. Can you please re-download and test the latest revision of that branch and confirm please? |
@crankyoldgit The latest fix is working well. |
Still no luck on my side. I suspect it has something to do with the 'beep' setting, but I'll only be able to go into deep troubleshooting later in the week. Will stay on ver .18 for now. |
I'll be merging it into |
@rg2k without data etc, I'm unable to help. |
…hanges. (#1650) * Remove "signature" checks, as they were flat out wrong. We were trying to use the checksum as a fixed signature. This caused some messages to fail to decode on the ESP. * Add second location for Power setting that was missing. - Fixes Power Off problems. * Streamline some code. * Clean up some code style formatting. * Remove bad assumptions of bits that controlled settings that were actually located in the checksum bytes. * Write a huge unit test to simulate and verify the code in Issue #1648 should do the correct thing. Fixes #1648 Ref #1277
_v2.8.0 (20211119)_ **[Bug Fixes]** - Fix compilation issue when using old 8266 Arduino Frameworks. (#1639 #1640) - Fix potential security issue with `scrape_supported_devices.py` (#1616 #1619) **[Features]** - SAMSUNG_AC - Change `clean` setting to a toggle. (#1676 #1677) - Highest fan speed is available without Powerful setting. (#1675 #1678) - Change `beep` setting to a toggle. (#1669 #1671) - Fix Beep for AR12TXEAAWKNEU (#1668 #1669) - Add support for Horizontal Swing & Econo (#1277 #1667) - Add support for On, Off, & Sleep Timers (#1277 #1662) - Fix power control. Clean-up code & bitmaps from Checksum changes. (#1277 #1648 #1650) - HAIER_AC176/HAIER_AC_YRW02 - Add support A/B unit setting (#1672) - Add support degree Fahrenheit (#1659) - Add support `Lock` function (#1652) - Implement horizontal swing feature (#1641) - Implement Quiet setting. (#1634 #1635) - Basic support for Airton Protocol (#1670 #1681) - HAIER_AC176: Add Turbo and Quiet settings (#1634) - Gree: Add `SwingH` & `Econo` control. (#1587 #1653) - MIRAGE - Add experimental detailed support. (#1573 #1615) - Experimental detailed support for KKG29A-C1 remote. (#1573 #1660) - ELECTRA_AC: Add support for "IFeel" & Sensor settings. (#1644 #1645) - Add Russian translation (#1649) - Add Swedish translation (#1627) - Reduce flash space used. (#1633) - Strings finally in Flash! (#1493 #1614 #1623) - Add support for Rhoss Idrowall MPCV 20-30-35-40 A/C protocol (#1630) - Make `IRAc::opmodeToString()` output nicer for humans. (#1613) - TCL112AC/TEKNOPOINT: Add support for `GZ055BE1` model (#1486 #1602) - Support for Arris protocol. (#1598) - SharpAc: Allow position control of SwingV (#1590 #1594) **[Misc]** - HAIER_AC176/HAIER_AC_YRW02 - Replace some magic numbers with constants (#1679) - Small fix `Quiet` and `Turbo` test (#1674) - Fix `IRHaierAC176::getTemp()` return value description (#1663) - Security Policy creation and changes. (#1616 #1617 #1618 #1621 #1680) - IRrecvDumpV2/3: Update PlatformIO envs for missing languages (#1661) - IRMQTTServer - Use the correct string for Fan mode in Home Assistant. (#1610 #1657) - Move a lot of the strings/text to flash. (#1638) - Minor code style improvements. (#1656) - Update Supported Devices - HAIER_AC176 (#1673) - LG A/C (#1651 #1655) - Symphony (#1603 #1605) - Epson (#1574 #1601) - GREE (#1587 #1588) - SharpAc (#1590 #1591) - Add extra tests for LG2 protocol (#1654) - Fix parameter expansion in several macros. - Move some strings to `IRtext.cpp` & `locale/default.h` (#1637) - RHOSS: Move include and defines to their correct places (#1636) - Make makefile only build required files when running `run-%` target (#1632) - Update Portuguese translation (#1628) - Add possibility to run specific test case (#1625) - Change `googletest` library ignore (#1626) - Re-work "Fan Only" strings & matching. (#1610) - Address `C0209` pylint warnings. (#1608)
## _v2.8.0 (20211119)_ **[Bug Fixes]** - Fix compilation issue when using old 8266 Arduino Frameworks. (#1639 #1640) - Fix potential security issue with `scrape_supported_devices.py` (#1616 #1619) **[Features]** - SAMSUNG_AC - Change `clean` setting to a toggle. (#1676 #1677) - Highest fan speed is available without Powerful setting. (#1675 #1678) - Change `beep` setting to a toggle. (#1669 #1671) - Fix Beep for AR12TXEAAWKNEU (#1668 #1669) - Add support for Horizontal Swing & Econo (#1277 #1667) - Add support for On, Off, & Sleep Timers (#1277 #1662) - Fix power control. Clean-up code & bitmaps from Checksum changes. (#1277 #1648 #1650) - HAIER_AC176/HAIER_AC_YRW02 - Add support A/B unit setting (#1672) - Add support degree Fahrenheit (#1659) - Add support `Lock` function (#1652) - Implement horizontal swing feature (#1641) - Implement Quiet setting. (#1634 #1635) - Basic support for Airton Protocol (#1670 #1681) - HAIER_AC176: Add Turbo and Quiet settings (#1634) - Gree: Add `SwingH` & `Econo` control. (#1587 #1653) - MIRAGE - Add experimental detailed support. (#1573 #1615) - Experimental detailed support for KKG29A-C1 remote. (#1573 #1660) - ELECTRA_AC: Add support for "IFeel" & Sensor settings. (#1644 #1645) - Add Russian translation (#1649) - Add Swedish translation (#1627) - Reduce flash space used. (#1633) - Strings finally in Flash! (#1493 #1614 #1623) - Add support for Rhoss Idrowall MPCV 20-30-35-40 A/C protocol (#1630) - Make `IRAc::opmodeToString()` output nicer for humans. (#1613) - TCL112AC/TEKNOPOINT: Add support for `GZ055BE1` model (#1486 #1602) - Support for Arris protocol. (#1598) - SharpAc: Allow position control of SwingV (#1590 #1594) **[Misc]** - HAIER_AC176/HAIER_AC_YRW02 - Replace some magic numbers with constants (#1679) - Small fix `Quiet` and `Turbo` test (#1674) - Fix `IRHaierAC176::getTemp()` return value description (#1663) - Security Policy creation and changes. (#1616 #1617 #1618 #1621 #1680) - IRrecvDumpV2/3: Update PlatformIO envs for missing languages (#1661) - IRMQTTServer - Use the correct string for Fan mode in Home Assistant. (#1610 #1657) - Move a lot of the strings/text to flash. (#1638) - Minor code style improvements. (#1656) - Update Supported Devices - HAIER_AC176 (#1673) - LG A/C (#1651 #1655) - Symphony (#1603 #1605) - Epson (#1574 #1601) - GREE (#1587 #1588) - SharpAc (#1590 #1591) - Add extra tests for LG2 protocol (#1654) - Fix parameter expansion in several macros. - Move some strings to `IRtext.cpp` & `locale/default.h` (#1637) - RHOSS: Move include and defines to their correct places (#1636) - Make makefile only build required files when running `run-%` target (#1632) - Update Portuguese translation (#1628) - Add possibility to run specific test case (#1625) - Change `googletest` library ignore (#1626) - Re-work "Fan Only" strings & matching. (#1610) - Address `C0209` pylint warnings. (#1608)
FYI, the changes mentioned above have now been included in the new v2.8.0 release of the library. |
Thank u much :) |
Hi ,. I just tried the controlsamsungac example. First I did an on and off which worked. Then I tried off and again off , the second time the ac turned on. Now when I try to turn off the ac it's not turning off. The ac receives the code but doesn't turn off and I don't see any temperature on the display. Can someone tell me how can I make the AC off. All I wanted was to turn on, set temp and turn off. Now only the last part turn off is pending. Kindly help .
The text was updated successfully, but these errors were encountered: