Dohome smart plug integration (homekit)

Tags: #<Tag:0x00007f7398520e78> #<Tag:0x00007f7398520bd0> #<Tag:0x00007f7398520ae0>

Hi guys,

I bought some cheap switch DoHome https://www.aliexpress.com/item/4000419350003.html and it works well with iOS, I added to home. I wanna integrate plug with Home Assistant. The system recognizes the device and after I add Homekit code (which is 123-45-678). It says incorrect Homekit code. Please check it and try again.

I guess that Homekit code is kind of default and this is an uncertified device by Apple, but on the other side, iPhone accepted device. I also tried with some other default code which I found on internet code 111-22-333 that code pass but it HA says “Abort pairing on all controllers, or try restarting the device, then continue to resume pairing”. Tried that and nothing…

Thanks

1 Like

I have the same outlets. If I try to add one from the discovered tile on the integrations page (with 123-45-678), I get “Incorrect HomeKit code. Please check it and try again.” If I click the plus button and add HomeKit Controller while it’s in pairing mode, I can select it from the dropdown list and enter the same code, but it hangs on the pairing screen with the blue circle spinning around.

Thanks in advance if anyone can help us get these working!

Kosmodrom, it looks like the manufacturer supports it, but I can’t read their language. I also found a tutorial on flashing a custom esp firmware on this thing.

Might try it out this weekend if I have time.

Best!

I just got these as well this week. I looked at those webpages and they seem to give good instructions but there is no firmware that I can find that works beyond Dohomes. The website give some instruction on how to create firmware but that is beyond me. It appears to use Esp8285 and can be upgrade OTA but just no firmware yet.

I think I’ll focus on getting it paired with HA homekit controller.

I will use this method to get homekit devices to operate in HA in the mean time.

@updog I succeed to pair with HA https://github.com/SmartArduino/DoHome/tree/master/DoHome_HassAssistant_Component

You have English version link with description. Overall:

  1. Download folder custom_components (or put componetnts if you already have that folder) and put in HA root where is configuration.yaml
  2. Connect DoHome device to network, and put dohome: into configuration.yaml since I’m using docker I had to additional lines to configuration.yaml and add at end .255. e.g my router is 10.3.141.1, DoHome plug has 10.3.141.101 IP and my discovery_ip: 10.3.141.255. Finally my code in configuration.yaml look like this.
dohome:
  discovery_ip: '10.3.141.255'
  discovery_retry: 3
  1. Restart HA
  2. Check the entities you should see switch_dohome_xxxx
  3. Make your card widget

I was going to use this method but I rather not use Dohome cloud and keep local if possible. Am I correct in thinking that your method uses Dohome cloud?

I was trying to upload the provided home assistant firmware but had no luck.

@Kosmodrom, I got that dohome integration to work, but I had to add the devices to homekit before my home assistant saw either of my plugs. I’m working on making a firmware with esphome at the moment. Here’s a basic yaml I used to flash it from the dohome provisional to a completely useless esphome firmware (following this up to step 2.4 http://support.doiting.com/index/getOneArticle?id=108 )

esphome:
  name: plug_e38e
  platform: ESP8266
  board: esp8285

wifi:
  ssid: "updog_iot"
  password: "updog_iot_wifi_password"
  manual_ip:
    static_ip: 192.168.2.22
    gateway: 192.168.2.1
    subnet: 192.168.2.0
    dns1: 192.168.2.1

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Plug E38E Fallback Hotspot"
    password: "QAFdCL13S946"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

Not sure if you have to specify the ip, but mdns doesn’t work on my router atm, so I did. I also had to compile this and install it with the dohome tool rather than the esphome ota, but after doing that, I can flash it now ota from the esphome add-on.

And here’s as far as I’ve gotten, no power switch, no energy monitoring, but adding this to the yaml lets me toggle the blue led on and off!

switch:
 - platform: gpio
   name: "plug_e38e_switch"
   pin: 5

I’ll update my yaml and give a better write-up of the steps once I get other stuff working here.

Here’s my final yaml, I don’t know why I thought it had a energy monitoring chip. The home assistant switch, the physical button, and the blue led should all stay in sync, but I’m not sure what happens when it turns on and if there’s a case where the switch will be off while the led is on or vice-versa or how to handle that type of scenario.

esphome:
  name: plug_e38e
  platform: ESP8266
  board: esp8285

wifi:
  ssid: "updog_iot"
  password: "updog_iot_wifi_password"
  manual_ip:
    static_ip: 192.168.2.22
    gateway: 192.168.2.1
    subnet: 192.168.2.0
    dns1: 192.168.2.1

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Plug E38E Fallback Hotspot"
    password: "QAFdCL13S946"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

binary_sensor:
  - platform: gpio
    id: plug_e38e_power_button
    pin:
      number: 4
      mode: INPUT_PULLUP
    name: plug_e38e_power_button
    on_press:
      - switch.toggle: plug_e38e_relay
    internal: True

switch:
  - platform: gpio
    id: plug_e38e_led
    name: plug_e38e_led
    pin:
      number: 5
      inverted: True
    internal: true
  - platform: gpio
    id: plug_e38e_relay
    name: plug_e38e_relay
    pin: 12
    on_turn_on:
     - switch.turn_on: plug_e38e_led
    on_turn_off:
     - switch.turn_off: plug_e38e_led

In hindsight, I wonder how much I could’ve gotten by looking at the source of the dohome integration…

Oh well, now anyone who finds this should be able to use it with Home Assistant by eitehr the dohome integration or by flashing esphome onto it. Thanks for the help!

1 Like

I did’t use any firmware just method that I mentioned above. Also I didn’t use homekit for integration. Just IPhone DoHome (and router) app to obtain IP address. For integration with iPhone I do HomeKit bridge

Thank you. Your instructions and yaml worked. I largely failed before because I uploaded with Dohome app using the plug connected to router wifi or computer connect to plug wifi. What worked is the plug connected to computer hotspot for uploads.