A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/crankyoldgit/IRremoteESP8266/issues/1748 below:

Need help with COOLIX vs COOLIX48 · Issue #1748 · crankyoldgit/IRremoteESP8266 · GitHub

I've followed the web-ac-controller example to create a sketch to control my AC unit.
The unit use the 24 bit protocol ( derived by testing the remote control with the irdump example ) but whatever I do in my sketch I always send out a 48-bit message vs a 24-bit.
Cannot find anywhere a way to force the use of the 24-bit protocol.

Can someone share a bit of light on this ?

Here to sketch:

#include <WebOTA.h>
#include <EEPROM.h>

#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Coolix.h>
const uint16_t kIrLed = D7;  
#define AUTO_MODE kCoolixAuto
#define COOL_MODE kCoolixCool
#define DRY_MODE kCoolixDry
#define HEAT_MODE kCoolixHeat
#define FAN_MODE kCoolixFan

#define FAN_AUTO kCoolixFanAuto
#define FAN_MIN kCoolixFanMin
#define FAN_MED kCoolixFanMed
#define FAN_HI kCoolixFanMax
#define SEND_COOLIX true
#undef SEND_COOLIX48 

IRCoolixAC ac(kIrLed);  // Set the GPIO to be used to sending the message.

int HeatingPin = D7;
const char* ssid = "SSID";                 // Your personal network SSID
const char* wifi_password = "PASSWORD";  // Your personal network password

String location = "AC_REMOTE";


// MQTT
const char* mqtt_server       = "192.168.x.x";  // IP of the MQTT broker
const char* mqtt_username     = "mqtt_usr"; // MQTT username
const char* mqtt_password     = "Password"; // MQTT password
const char* clientID          = (location).c_str(); // MQTT client ID

int brightness = 0;
int fade = 1;
unsigned long new_time = 0;
unsigned long old_time = 0;
WiFiClient wifiClient;
PubSubClient client(mqtt_server, 8883, wifiClient); 


// Custom function to connet to the MQTT broker via WiFi
void connect_WiFi(){
  boolean LEDSTS = LOW;
  
  Serial.print("Connecting to ");
  Serial.println(ssid);
  Serial.println(WiFi.hostname());
  // Connect to the WiFi
  WiFi.setHostname(clientID);
  WiFi.begin(ssid, wifi_password);

  // Wait until the connection has been confirmed before continuing
  pinMode(D0, OUTPUT);     // Initialize the D0 pin as an output Using Led to check if it is connect or connecting
  digitalWrite(D0, LEDSTS);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    LEDSTS=LEDSTS^1;
    digitalWrite(D0, LEDSTS);
  }
  digitalWrite(D0, LOW);    // I'm connected. Led goes off

  // Debugging - Output the IP Address of the ESP8266
  Serial.println("");
  Serial.print("Version: ");
  Serial.println(vers);
  Serial.println("WiFi connected");
  Serial.println(WiFi.hostname());
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  Serial.println(humidity_topic);
  Serial.println(temperature_topic);
}

void callback(char* topic, byte* payload, unsigned int length) {
  payload[length] = '\0';
  strTopic = String((char*)topic);

     if ( ModeSt_Rec == "cool" )     { ac.setMode(kCoolixCool); }
     if ( ModeSt_Rec == "dry" )      { ac.setMode(kCoolixDry); }
     if ( ModeSt_Rec == "auto" )     { ac.setMode(kCoolixAuto); }
     if ( ModeSt_Rec == "heat" )     { ac.setMode(kCoolixHeat); }
     if ( ModeSt_Rec == "fan_only" ) { ac.setMode(kCoolixFan); }
     if ( ModeSt_Rec == "off" )      { ac.setPower(false); }// Tutti i parametri restano come sono. Spengo l'unita'

     if ( ModeSt_Rec == "auto" )     {   ac.setFan(kCoolixFanAuto0); }   // Se in auto il mode allora auto0
     if ( FanSt_Rec == "auto" )      {   ac.setFan(kCoolixFanAuto); }
     if ( FanSt_Rec == "max" )       {   ac.setFan(kCoolixFanMax); }
     if ( FanSt_Rec == "med" )       {   ac.setFan(kCoolixFanMed); }
     if ( FanSt_Rec == "min" )       {   ac.setFan(kCoolixFanMin); }
     TempSt_Rec = String((char*)payload);
     ac.setTemp(int (TempSt_Rec.toFloat()));

  if(strTopic == switch1_topic )
    {
    switch1 = String((char*)payload);
    Serial.println(switch1);
    if(switch1 == "ON")
      {
        ac.on();                 // Accendiamo
        digitalWrite(HeatingPin, HIGH);
      }
    else
      {
        ac.off();                 // Spegniamo
        digitalWrite(HeatingPin, LOW);
        ModeSt_Rec1 = "off";
      }
      ac.send();
      client.publish(modest_topic, ModeSt_Rec1.c_str());
    }
}

void setup() {
  
  Serial.begin(9600);
  ac.begin();                             // Inizializzazione AC
  dht.begin();                            // Initializa DHT11/12 library
                                          // Moved in setup to avoid connecting every time.
  delay(1000);       
  connect_WiFi();
  wdt_enable(5000);                       // Watchdog  timer to 5 seconds
  pinMode(BUILTIN_LED, OUTPUT);           // Initialize the BUILTIN_LED pin as an output
  pinMode(D0, OUTPUT);                    // Initialize the D0 pin as an output for Connection Led Indicator
  analogWrite(BUILTIN_LED, brightness);   // Let's put BUILTIN_LED as analog for a nice effet of the led
  Serial.setTimeout(2000);

  pinMode(HeatingPin, OUTPUT);

  // Connect to MQTT Broker
  // client.connect returns a boolean value to let us know if the connection was successful.
  if (client.connect(clientID, mqtt_username, mqtt_password)) {
    Serial.println("Connected to MQTT Broker! and subscribe ");
    client.setCallback(callback);
    client.subscribe(switch1_topic);
  }
  else {
    Serial.println("Connection to MQTT Broker failed...");
  }
  old_time = millis();
}


void loop() {
  wdt_reset();
  webota.handle();
  
  if (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print("NotConn");
    connect_WiFi();
  }


     String hs="Hum: "+String((float)h)+" % ";
     String ts="Temp: "+String((float)t)+" C ";

     if (!client.publish(temperature_topic, String(t).c_str())) {
       client.connect(clientID, mqtt_username, mqtt_password);
       delay(10); // This delay ensures that client.publish doesn't clash with the client.connect call
       client.publish(temperature_topic, String(t).c_str());
     }

     // PUBLISH to the MQTT Broker (topic = Humidity, defined at the beginning)
     if (!client.publish(humidity_topic, String(h).c_str())) {
          client.connect(clientID, mqtt_username, mqtt_password);
          delay(10); // This delay ensures that client.publish doesn't clash with the client.connect call
          client.publish(humidity_topic, String(h).c_str());
     }
  }

}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4