Improvement Xiaomi smart kettle (I need help!)



  • Hello!
    Recently, I purchased a smart Xiaomi kettle. But to my disappointment, he seemed quite stupid.πŸ˜„ I can not turn it on remotely, I can only change its settings from the application on the smartphone. Therefore, I thought about its automation with the help of MySensors.

    smart Xiaomi kettle

    On the panel of the kettle there are two touch buttons and two LEDs - boiling and heating. I want to connect the MySensors node to them. The activation signal is applied to the buttons, and the work status is received from the LEDs.

    two touch buttons and two LEDs

    Perhaps you have already encountered similar projects in this forum... Please share links to them here.πŸ™Œ

    Perhaps you have a similar sketch in your collection? I will be very grateful if you share it.

    I am sure that such a device will be useful to many participants in this forum, to improve their not very smart devices.πŸ˜‰



  • @vladimir I do not understand the purpose of switch a kittle remotely. If there is no water, what would you do?

    Additionally, I think you'd find very little in internet on your topic. It required hacking into existing Xiaomi electronics. If you want to do that, you need to dismantle the kettle and reverse engineer it.



  • @alexsh1 I do not see problems that do not allow connecting to the control panel of the kettle.
    These images I took on the Internet:

    alt text

    alt text

    I have already done this with a Chinese-made desk lamp. For this, I used a sketch of the relay node. But everything was easier there, I removed the button and connected the output from the Arduino instead. I rarely use a desk lamp, so I allowed myself to sacrifice a button for the sake of experimentation. I usually manage it through Siri.
    On the teapot, I still want to leave the physical buttons, and get feedback about their condition.



  • @vladimir hey, but for safety reasons, how do you counter the fact that if there is no water in it, you just don't burn your house down. I did some quick calculations but the advantages of remotely setting the kettle on versus burning the house down, don't seem that favourable ;).



  • @omemanti It has protection against heating without water. But, I do not plan to launch it when I am away from home. I just want to use it in automation scripts, for example in the morning when the alarm sounds a wake-up call.



  • @vladimir If you do not see a problem, why not dismantling it and connecting a relay to simulate a button press?

    I have automated a coffee machine to switch on/off at a certain time to preheat, but I still fail to understand why would anyone need a smart kettle remote control.



  • @alexsh1 In fact, the purpose of this post is not to understand "why," but to understand "how" to automate the device so that there is feedback from it. At the code level.



  • either purchase a standard cheap kettle, and a wallplug, then you can switch on/off via this. Or else you need to create a device that can emulate a persons capacity touching
    This guy used a floating pin on Arduino, and then set it to GND, maybe worth a try...
    http://blog.theultimatelabs.com/2012/05/triggering-capacitive-touch-screen-with.html



  • If anyone is interested in this project, then I hasten to inform you, good news! πŸŽ‰
    Today I came across a device "Venta Connected (WiFi control for Venta LW45 humidifier)" from the user @reinhold
    Here is a link to the device page: https://www.openhardware.io/view/539/Venta-Connected-WiFi-control-for-Venta-LW45-humidifier
    @reinhold, thank you for this project! πŸ™Œ

    I tried to adapt the code of this device to fit my needs. Here's what I got:

    #define SKETCH_NAME "XiaomiSmartKettle"
    #define SKETCH_VERSION "1.0"
    
    #define MY_DEBUG                     // Enable debug prints to serial monitor
    #define MY_RADIO_NRF24               // Enable and select radio type attached
    #define MY_REPEATER_FEATURE          // Enabled repeater feature for this node
    
    #include <SPI.h>
    #include <MySensors.h> 
    
    /**************************************
    //***** MySensors settings
     **************************************/
    
    #define WAITING_TIME 250
    
    // Pin Setup:
    // Button & LED Actions (output):
    //   - PIN_BOIL  D3 ... Boil button press
    //   - PIN_WARM   D4 ... Warm button press
    // LED detection (input, pullup):
    //   - LED_BOIL   D5 ... Boil LED 
    //   - LED_WARMPOWER  D6 ... Warm power LED (Warming is on, but the heating is not involved yet)
    //   - LED_WARMACT  D7 ... Warm action LED (Warming is on and the heater is running)
    
    #define PIN_BOIL 3
    #define PIN_WARM 4
    #define LED_BOIL 5
    #define LED_WARMPOWER 6
    #define LED_WARMACT 7
    
    #define ID_BOIL 1
    #define ID_WARMPOWER 2
    #define ID_WARMACT 3
    //#define ID_REPEATER 254
    
    
    
    bool boil = false;
    bool warmpower = false;
    bool warmact = false;
    
    bool prev_boil = false;
    bool prev_warmpower = false;
    bool prev_warmact = false;
    
    
    MyMessage msg_boil(ID_BOIL, V_STATUS);
    MyMessage msg_warmpower(ID_WARMPOWER, V_STATUS);
    MyMessage msg_warmact(ID_WARMACT, V_STATUS);
    
    
    /**************************************
     ***** Implementation
     **************************************/
    void setup() {
      // PIN modes
      pinMode(PIN_BOIL,OUTPUT);
      pinMode(PIN_WARM,OUTPUT);
      pinMode(LED_BOIL,INPUT_PULLUP);
      pinMode(LED_WARMPOWER,INPUT_PULLUP);
      pinMode(LED_WARMACT,INPUT_PULLUP);
    
    }
    
    void presentation() {
      present(ID_BOIL, S_BINARY, "Kettle BOIL", true);
      present(ID_WARMPOWER, S_BINARY, "Kettle WARM POWER", true);
      present(ID_WARMACT, S_BINARY, "Kettle WARM ACTION", true);
    //  present(ID_REPEATER, S_ARDUINO_REPEATER_NODE);
    
      sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
    }
    
    void loop() {
      readKettleState();
    
      bool changed = false;
      if (boil != prev_boil) {
        Serial.println(F("BOIL changed from "));Serial.print(prev_boil); Serial.print(F(" to ")); Serial.println(boil);
        changed = true;
        send(msg_boil.set(boil));
        prev_boil = boil;
      }
      if (warmpower != prev_warmpower) {
        Serial.println(F("WARMPOWER changed from "));Serial.print(prev_warmpower); Serial.print(F(" to ")); Serial.println(warmpower);
        changed = true;
        send(msg_warmpower.set(warmpower));
        prev_warmpower = warmpower;
      }
      if (warmact != prev_warmact) {
        Serial.println(F("WARMACT changed from "));Serial.print(prev_warmact); Serial.print(F(" to ")); Serial.println(warmact);
        changed = true;
        send(msg_warmact.set(warmact));
        prev_warmact = warmact;
      }
    
      wait(WAITING_TIME);
    }
    
    void receive(const MyMessage &message) {
      readKettleState();
      switch (message.sensor) {
        
        case ID_BOIL:
            if (message.type == V_STATUS) {
              bool newstate = message.getBool();
              Serial.print(F("Incoming message to set BOIL to: "));
              Serial.println(newstate);
              if (boil != newstate) {
                pressButton(PIN_BOIL);
                Serial.println(F("   => Emulating button press to toggle BOIL"));
              } else {
                Serial.println(F("   => No need to change BOIL state"));
              }
            } else {
              Serial.print(F("Incoming message for ID_BOIL, unknown message type "));
              Serial.println(message.type);
            }
            break;
          
        case ID_WARMPOWER:
            if (message.type == V_STATUS) {
              bool newstate = message.getBool();
              Serial.print(F("Incoming message to set WARMPOWER to: "));
              Serial.println(newstate);
              if (warmpower != newstate) {
                pressButton(PIN_WARM);
                Serial.println(F("   => Emulating button press to toggle WARMPOWER"));
              } else {
                Serial.println(F("   => No need to change WARMPOWER state"));
              }
            } else {
              Serial.print(F("Incoming message for ID_WARMPOWER, unknown message type "));
              Serial.println(message.type);
            }
            break;
    
        case ID_WARMACT:
            if (message.type == V_STATUS) {
              bool newstate = message.getBool();
              Serial.print(F("Incoming message to set WARMACT to: "));
              Serial.println(newstate);
              
              saveState(ID_WARMACT, newstate);
              if (newstate==1) {
                ledOn(LED_WARMACT);
              } else {
                ledOff(LED_WARMACT);
              }
            } else {
              Serial.print(F("Incoming message for ID_WARMACT, unknown message type "));
              Serial.println(message.type);
            }
            break;
            
        default:
            Serial.print(F("Incoming message for sensor "));
            Serial.print(message.sensor);
            Serial.print(F(", which cannot receive any messages, type="));
            Serial.println(message.type);
      }
    }
    
    
    void readKettleState() {
      boil = digitalRead(LED_BOIL) == LOW;
      warmpower = digitalRead(LED_WARMPOWER) == LOW;
      warmact = digitalRead(LED_WARMACT) == LOW;
    }
    
    
    
    void pressButton(int pin) {
      digitalWrite(pin, HIGH);
      wait(100);
      digitalWrite(pin, LOW);
    }
    void ledOn(int pin) {
      digitalWrite(pin, HIGH);
    }
    void ledOff(int pin) {
      digitalWrite(pin, LOW);
    }
    

    I have not yet verified this code on the device, since I do not have all the necessary components. But it compiled without errors, and that makes me happy already!

    I have only the fear that the function of warming the water will not work correctly, since the kettle has two LEDs that display the status:
    LED_WARMPOWER - Warming is on, but the heating is not involved yet
    LED_WARMACT - Warming is on and the heater is running.

    I would be grateful if you could help me fix this. πŸ™Œ Perhaps you will notice other errors in the code, please tell me about them. πŸ˜‰



  • @vladimir Hello, are there any kettles to buy, that have on/off function enabled via bluetooth? Xiaomis newer models maybe?


Log in to reply
 

Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts