GithubHelp home page GithubHelp logo

hypfer / esp8266-deerma-humidifier Goto Github PK

View Code? Open in Web Editor NEW
45.0 11.0 8.0 709 KB

Cloud-free wifi humidification

License: Apache License 2.0

C++ 98.14% C 1.86%
mqtt esp8266 smarthome home-assistant cloud-free xiaomi deerma

esp8266-deerma-humidifier's Introduction

esp8266-deerma-humidifier

Free your humidifier from the cloud

This is a custom firmware for the ESP8285-based Wi-Fi module of the Xiaomi Mi Smart Antibacterial Humidifier, which replaces cloud connectivity with local mqtt controls. Some disassembly and soldering required.

The internal Mi Model ID of the supported device is deerma.humidifier.jsq. The Model on the packaging being ZNJSQ01DEM.

Home Assistant Autodiscovery for all features is supported and requires Home Assistant >= 2021.11. The WifiManager library is used for on-the-fly configuration. You can even press and hold the wifi button on the device to restart the configuration. Also, ArduinoOTA is used, so that firmware updates are possible even with a reassembled device.

If you're looking for the exact opposite of this, check out esp8266-midea-dehumidifier. Or maybe even use both simultaneously and see who wins?

Furthermore, this codebase may also serve as a starting point to write replacement firmwares for other Mi devices using the same module (of which there are many).

Here's the cloud-free humidifier in action

humidifier with local cloud

Prerequisites

To replace the firmware of the official Wi-Fi module, you will need

  • A 3.3v USB TTL UART Adapter
  • Some dupont cables for temporary attachment
  • A soldering iron
  • A PH2 Screwdriver

Keep in mind that unless you backup the original firmware, there's no way to restore the module to its factory state.

Personally, that doesn't really bother me since it's a 50€ device. Therefore, I cannot help you with the firmware backup.

Usage

If you're using Home Assistant, the MQTT Autodiscovery should do its job and provide you with a new Device like this:

home assistant screenshot

In any case, communication is done via a few MQTT Topics:

  • esp8266-deerma-humidifier/HUMIDIFIER-%CHIP_ID%/status
  • esp8266-deerma-humidifier/HUMIDIFIER-%CHIP_ID%/state
  • esp8266-deerma-humidifier/HUMIDIFIER-%CHIP_ID%/command

/status will either contain online or offline and is also used for the LWT.

/state will contain a JSON state which looks like this:

{
	"state": "on",
	"mode": "setpoint",
	"humiditySetpoint": 45,
	"humidity": 41,
	"temperature": 24,
	"sound": "off",
	"led": "off",
	"waterTank": "full",
	"wifi": {
		"ssid": "Das IoT",
		"ip": "10.0.13.37",
		"rssi": -51
	}
}

and of course you can control the device via the /control topic which expects the same JSON structure as the state provides.
That also means that you can run multiple commands at once. For example if you wanted to turn LED off but Sound on, you'd publish

{
	"sound": "on",
	"led": "off"
}

to the command topic. Keep in mind, that obviously not all state properties are writable.

If you ever want to update the firmware, you can do so without disassembly thanks to ArduinoOTA. The default password is the hostname, which is mostly there to prevent accidental firmware updates.

Installation

First, you will need to unscrew the base of the unit.
As you can see, I tried drilling holes into the rubber ring where the screws are to do that without removing it. It didn't work.
Just remove it. The ring will stick well enough even after being removed twice.

humidifier base with screws marked

Then, you'll get this view. You're only interested in the Wi-Fi module, which can be found on the bottom-left.

humidifier base open

Here's a picture of the wifi module taken from the humidifier. It's labelled DJD-MI-WIFI-V01. Hello Google traveller :)

wifi module

Now, you need to solder a few temporary dupont cables to the ESP module so that you can flash it.
As you can see, there are some testpoints that can be used to make this easier.

wifi module with dupont cables

In this picture, the colors of the wires correspond to the following:

  • Orange: GND
  • Grey: VCC (3.3v!)
  • Yellow (GPIO 0)
  • Brown: RX
  • Red: TX

To flash the ESP8266 module, you need to connect these to your USB UART adapter. Don't forget to Swap RX and TX.
You may also want to solder the Yellow GPIO 0 cable to the pin right below it, since it needs to be pulled low on boot so that the ESP enters UART Download mode.

Furthermore, the 3.3v power source of most USB TTL adapters isn't powerful enough to also support the ESP. Therefore, you need to use a different power source with the same GND.
If you have some NodeMCU, Arduinos, Wemos D1 or basically anything like that lying around, you can simply use the step-down converter of that module.
Simply also plug that thing into your computer used for flashing and connect the Grey wire to it's 3.3v Pins.

The firmware can then be built and flashed using the Arduino IDE.

For this, you will need to add ESP8266 support to it by using the Boards Manager.

Furthermore, you will also need to install the following libraries using the Library Manager:

  • ArduinoOTA 1.0.3
  • ArduinoJSON 6.10.1
  • PubSubClient 2.8.0
  • WiFiManager 0.15.0

esp8266-deerma-humidifier's People

Contributors

ftwmrp avatar hypfer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp8266-deerma-humidifier's Issues

Serial.available returning falsy

Hello; I managed to flash the board and everything is working... except the UART communication.

By adding some debug statements it looks like that Serial.available() is returning a falsy value; is there some settings upon flash that I should have clicked? Or should I check connection with the cable?

Do Legacy Plugins work?

First of all: wow, just wow.
I bought this exact humidifier two months ago and didn't find any open-source firmware for that. Now stumbled upon your work. Your documentation is amazing and should make the installation pretty easy.

So, is it still possible for other software to communicate with the flashed humidifier. For instance the home bridge plugin? Or is there no other way around using mqtt?
I'm currently just blocking internet access for my humidifier to combat unneeded data exchange.

Needless to say, Grüße aus Hannover!

question

hey; i just bought the humidifier and found this plugin; I wanted to understand if this replace the firmware entirely with all the associated functions (like starting when the humidity is low, etc...)

management via mqtt does not work

hi!
I apologize in advance for my English: I'm using a translator :)

compiled the firmware, flashed the board, everything is fine. but the control via the topic / command does not work.
the topic /state shows the values, but they are not relevant. the only thing that works correctly is the topic /status when the device is turned on, the status "online" when I turn it off, changes to "offline". in the topic /command I send a json request from the example {"led":"off"}, but nothing happens.
I ask for help, maybe there are some thoughts

Looks like protocol is changed in newest devices

i turn esp82xx device into web-terminal, and try to figure out, - why control messages is not working, and status is also, not updating...

so on terminal line (after inital steps with my typing of "ok" and "cloud"), i found something like this:

properties_changed 2 1 truee
properties_changed 2 1 truee
properties_changed 2 1 truee
properties_changed 2 1 truee
properties_changed 2 1 truee
properties_changed 2 1 truee
properties_changed 2 1 truee
properties_changed 2 1 truee
properties_changed 7 1 false
and many lines like that...

there is no long string containg status anymore...
So i think it's no working with newer devices anymore...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.