Control Daikin AC From Anywhere With Beautiful UI and Losant

Introduction: Control Daikin AC From Anywhere With Beautiful UI and Losant

About: Internet of things, Home automation, you name it i make it

Hello,

In this instructable we will learn how to control Daikin air-conditioner from any point in the world using Losant IoT Enterprise Platform and their amazing UI dashboard

The ESP8266 is a low-cost Wi-Fi chip with full TCP/IP stack and MCU (microcontroller unit)

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: How It Works

The microcontroller (ESP8266) connects Losant IoT platform and waits for input (user changes something in the dashboard) then the IR sensor sends information to the Daikin air-conditioner

Make sure the IR transmitter is as close as possible to the AC

Step 2: Required Parts and Components

Step 3: Assembling the B0X

  1. Drill 2 holes with screwdriver or drill or whatever is easy for you
  2. Hot glue the transmitter to one of the holes (the one which will point to the AC)
  3. Connect ESP8266 to the IR Transmitter
  4. Connect the USB cable to the ESP8266
  5. Run the USB cable through the other hole
  6. Close the case with 4 screws
  7. You are done :)

Wiring the IR Transmitter to the ESP8266

IR Transmitter - EPS8266

- (minus, GND) - GND

+ (plus, VCC) - VIN

S (DAT) - D2

Step 4: Setting Up the Device in Losant

  • Create a device called IR Transmitter
  • Add 5 device attributes
  1. Data type - Boolean with Name status
  2. Data type - Boolean with Name quiet
  3. Data type - Boolean with Name powerful
  4. Data type - Number with Name temperature
  5. Data type - Number with Name fan

Here a full tutorial on how to get started by Losant

Step 5: Making the Dashboard

Create a dashboard called AC DASHBOARD and Input Controls Block

Add 6 Controls

  • Toggle Input with Label = Status, Template-ID = toggle-0, Dynamic Value, Device IDs/Tags = IR Transmitter, Attribute = status, Default value = false
  • Toggle Input with Label = Quiet, Template-ID = toggle-1, Dynamic Value, Device IDs/Tags = IR Transmitter, Attribute = quiet, Default value = false

  • Toggle Input with Label = Powerful, Template-ID = toggle-0, Dynamic Value, Device IDs/Tags = IR Transmitter, Attribute = powerful, Default value = false

  • Range Input with Label = Temperature, Template-ID = range-0, Min = 18, Max = 32, Device IDs/Tags = IR Transmitter, Attribute = temperature, Default value = 18

  • Range Input with Label = Fan, Template-ID = range-1, Min = 0, Max = 5, Device IDs/Tags = IR Transmitter, Attribute = fan, Default value = 0

  • Button trigger with Label = Send, On Click = Send Device Command, Device IDs/Tags = IR Transmitter, Command name = command, Payload = check below


Payload:

{
"status" : {{toggle-0}},
"quite" : {{toggle-1}},
"powerful" : {{toggle-2}},
"temperature" : {{range-0}},
"fan" : {{range-1}}
}

Step 6: Upload the Code to the ESP8266

You need to add the Losant library

Upload it to the ESP8266

Congratulations you can now control your AC from anywhere

#include <ESP8266WiFi.h>
#include <IRremoteESP826.h> #include <IRsend.h> #include <Losant.h> #include <ir_Daikin.h>

const char *WIFI_SSID = "ssid"; const char *WIFI_PASS = "pass";

const char *DEVICE_ID = "device-id"; const char *ACCESS_KEY = "access-key"; const char *ACCESS_SECRET = "access-secret";

WiFiClientSecure wifiClient; IRDaikinESP dakinir(D2);

LosantDevice device(DEVICE_ID);

void handleCommand(LosantCommand *command) { Serial.println(); Serial.print("Command received: "); Serial.println(command->name);

if (strcmp(command->name, "command") == 0) {

JsonObject &payload = *command->payload; payload.printTo(Serial); char json[400];

StaticJsonBuffer<200> jsonBuffer;

payload.printTo(json, sizeof(json));

JsonObject &root = jsonBuffer.parseObject(json);

if (!root.success()) { Serial.println("parseObject() failed"); return; }

bool status = root["status"]; bool quiet = root["quite"]; bool powerful = root["powerful"];

int16_t temperature = root["temperature"]; int16_t fan = root["fan"];

if (status) { dakinir.on(); } else { dakinir.off(); } dakinir.setFan(fan); dakinir.setTemp(temperature); dakinir.setQuiet(quiet); dakinir.setPowerful(powerful);

dakinir.send(); } }

void connect() { Serial.print("Connecting to "); Serial.println(WIFI_SSID);

WiFi.begin(WIFI_SSID, WIFI_PASS);

while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }

Serial.println(); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP());

Serial.println(); Serial.print("Connecting to Losant...");

device.connectSecure(wifiClient, ACCESS_KEY, ACCESS_SECRET);

while (!device.connected()) { delay(500); Serial.print("."); }

dakinir.begin();

Serial.println("Connected successfully"); }

void setup() { Serial.begin(115200);

device.onCommand(&handleCommand);

connect(); }

void loop() { bool toReconnect = false;

if (WiFi.status() != WL_CONNECTED) { Serial.println("Disconnected from WiFi"); toReconnect = true; }

if (!device.connected()) { Serial.println("Disconnected from Losant"); Serial.println(device.mqttClient.state()); toReconnect = true; }

if (toReconnect) { connect(); }

device.loop(); }

Home Improvement Contest 2017

Participated in the
Home Improvement Contest 2017

First Time Author Contest

Participated in the
First Time Author Contest

Be the First to Share

    Recommendations

    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest
    • Fix It Contest

      Fix It Contest

    5 Discussions

    0
    Gökhan Türkeli
    Gökhan Türkeli

    2 years ago

    Seems really nice. I tried a similar project with Blynk and although I received and sent the signals I couldn't succeed to get a response from the AC.

    It is a really nice instructable though. Just it is a pity since there are lots of no name ACs around which usually use other manufacturers' communication protocols such as Samsung.

    0
    onelinez
    onelinez

    2 years ago

    That is pretty cool(Pun-Intended)! Do you think this would work with a similar type Lennox unit? I have one that I would love to try this on. Any thoughts?

    0
    raphael.michaels712
    raphael.michaels712

    Reply 2 years ago

    Hello,

    I am using the IRremoteESP8266 and there is ready to use version for Daikin, unfortanly there is no for Lenoxx. You can checkout the library here - https://github.com/markszabo/IRremoteESP8266/

    0
    BbBoo
    BbBoo

    2 years ago

    I will definitely try this, thank you.

    0
    Swansong
    Swansong

    2 years ago

    That's really neat, one of my friends in Okinawa would love this for his :)