master as at 10 Sept, 2019.
CommonAcControl.ino ac.sendAc(state, &prev);), if state.protocol start from DAIKIN or COOLIX state.protocol start form KELVINATOR, IR LED light up even though the state.protocol is DAIKIN or COOLIXCommonAcControl.ino example, change (line 20) kIrLed = 14Yes
- IR LED doesn't light up (when
ac.sendAc(state, &prev);), ifstate.protocolstart from DAIKIN or COOLIX- If
state.protocolstart form KELVINATOR, IR LED light up even though thestate.protocolis DAIKIN or COOLIX
I am confused by what you are saying here. Can you please try to describe it another way? Or maybe include the Serial Console output and add comments to it explain is or isn't going on?
sorry for my bad english
No need to apologise. Your "bad" English is better than my "Non existent" _your_ native language. :)
I mean, on example CommonAcControl.ino and run it.
The first and second AC protocol (DAIKIN and COOLIX) doesn't light up IR LED. But after the third AC protocol (KELVINATOR), IR LED light up as expected.
Or, try this code.
/* Copyright 2019 David Conran
*
* This example code demonstrates how to use the "Common" IRac class to control
* various air conditions. The IRac class does not support all the features
* for every protocol. Some have more detailed support that what the "Common"
* interface offers, and some only have a limited subset of the "Common" options.
*
* This example code will:
* o Try to turn on, then off every fully supported A/C protocol we know of.
* o It will try to put the A/C unit into Cooling mode at 25C, with a medium
* fan speed, and no fan swinging.
* Note: Some protocols support multiple models, only the first model is tried.
*
*/
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRac.h>
#include <IRutils.h>
const uint16_t kIrLed = 14;
IRac ac(kIrLed);
stdAc::state_t state;
stdAc::state_t prev;
void setup() {
Serial.begin(115200);
delay(200);
state.protocol = decode_type_t::DAIKIN; // Set a protocol to use.
state.model = 1; // Some A/C's have different models. Let's try using just 1.
state.mode = stdAc::opmode_t::kCool; // Run in cool mode initially.
state.celsius = true; // Use Celsius for units of temp. False = Fahrenheit
state.degrees = 25; // 25 degrees.
state.fanspeed = stdAc::fanspeed_t::kMedium; // Start with the fan at medium.
state.swingv = stdAc::swingv_t::kOff; // Don't swing the fan up or down.
state.swingh = stdAc::swingh_t::kOff; // Don't swing the fan left or right.
state.light = false; // Turn off any LED/Lights/Display that we can.
state.beep = false; // Turn off any beep from the A/C if we can.
state.econo = false; // Turn off any economy modes if we can.
state.filter = false; // Turn off any Ion/Mold/Health filters if we can.
state.turbo = false; // Don't use any turbo/powerful/etc modes.
state.quiet = false; // Don't use any quiet/silent/etc modes.
state.sleep = -1; // Don't set any sleep time or modes.
state.clean = false; // Turn off any Cleaning options if we can.
state.clock = -1; // Don't set any current time if we can avoid it.
state.power = false; // Initially start with the unit off.
prev = state;
}
void loop() {
decode_type_t protocol = decode_type_t::DAIKIN;
if (ac.isProtocolSupported(protocol)) {
state.protocol = protocol;
Serial.println("Protocol " + String(protocol) + " / " +
typeToString(protocol));
state.power = true;
ac.sendAc(state, &prev);
Serial.println("Sent a message to turn ON the A/C unit.");
prev = state;
delay(1000);
}
protocol = decode_type_t::COOLIX;
if (ac.isProtocolSupported(protocol)) {
state.protocol = protocol;
Serial.println("Protocol " + String(protocol) + " / " +
typeToString(protocol));
state.power = true;
ac.sendAc(state, &prev);
Serial.println("Sent a message to turn ON the A/C unit.");
prev = state;
delay(1000);
}
protocol = decode_type_t::KELVINATOR;
if (ac.isProtocolSupported(protocol)) {
state.protocol = protocol;
Serial.println("Protocol " + String(protocol) + " / " +
typeToString(protocol));
state.power = true;
ac.sendAc(state, &prev);
Serial.println("Sent a message to turn ON the A/C unit.");
prev = state;
delay(1000);
}
protocol = decode_type_t::COOLIX;
if (ac.isProtocolSupported(protocol)) {
state.protocol = protocol;
Serial.println("Protocol " + String(protocol) + " / " +
typeToString(protocol));
state.power = true;
ac.sendAc(state, &prev);
Serial.println("Sent a message to turn ON the A/C unit.");
prev = state;
delay(1000);
}
}
Thanks
Thanks. What is the Serial output of your modified code?
Thanks. What is the Serial output of your modified code?
Here my Serial output
␀rl␀l��|␀�l�|␂␌␌␌�␌l�␌b|��␂�␒�r�bl␌b��nn�lnn���␌b␜p�lb␎lrlp�n�␐␂␌␌�␌l␌��␌␌␌b␌n�|␂l�␌␌�b��nn�␀l��l`␂�␒␒nn␌l`␂␎␂nr���n␌␌b␌�␎l␎r��n␌␌b␌�␎l�␂�␂ll�␒�l`␂��n�␂Protocol 16 / DAIKIN
Sent a message to turn ON the A/C unit.
Protocol 15 / COOLIX
Sent a message to turn ON the A/C unit.
Protocol 18 / KELVINATOR
Sent a message to turn ON the A/C unit.
Protocol 15 / COOLIX
Sent a message to turn ON the A/C unit.
Protocol 16 / DAIKIN
Sent a message to turn ON the A/C unit.
Protocol 15 / COOLIX
Sent a message to turn ON the A/C unit.
Thanks.
If I recall correctly, it (ac.sendAc()) doesn't notice a difference in the states if only the protocol changes. To force it to change, I suggest you do as the original example does, i.e. transition from "off" to "on" and then "on" to "off". Power status is definitely something that is detected as a change in sendAc()
Thanks.
If I recall correctly, it (ac.sendAc()) doesn't notice a difference in the states if only the protocol changes. To force it to change, I suggest you do as the original example does, i.e. transition from "off" to "on" and then "on" to "off". Power status is definitely something that is detected as a change in sendAc()
if like that. When i using the example provided CommonAcControl.ino, the first and second AC protocol (DAIKIN and COOLIX) doesn't light up IR LED.
https://github.com/crankyoldgit/IRremoteESP8266/issues/899#issuecomment-530204546
I mean, on example
CommonAcControl.inoand run it.
The first and second AC protocol (DAIKIN and COOLIX) doesn't light up IR LED. But after the third AC protocol (KELVINATOR), IR LED light up as expected.
Okay. I'll take a deeper look shortly.
I found something interesting.
If i add pinMode(kIrLed,OUTPUT); on setup(). The problem gone.
Should i add pinMode(); manually, or the library already add it automatically.
Well spotted/worked out!! That's a bug. The library should do that for you.
If you download the code in branch: https://github.com/crankyoldgit/IRremoteESP8266/tree/Issue899 / PR #905 and compile using that, it should do that for you now.
Please let me if it fixes/doesn't fix the problem!
@k2biru Thanks. So I did. Fixed.
FYI, the changes mentioned above are included in the newly released version of the library (v2.6.6).
Most helpful comment
@k2biru Thanks. So I did. Fixed.