Dohome smart plug integration (homekit)

Tags: #<Tag:0x00007fc416e50060> #<Tag:0x00007fc4093eb780> #<Tag:0x00007fc4093eb5c8>

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.

Hi Guys, downloaded those custom components into right folder and added the configs into configuration.yaml

seen at homeassistant.log the been loaded and looking for devices at gateway, although don’t find the led stripe hub.

homeassistant and dohome are in different subnets although they are between themselves, no firewall rules at all.

Any alternative to get it identified on HA?

Hello Folks. I just ordered dohome smartplugs from Amazon. They work fine when connected to homekit. I didn’t pair them with DoHome App (cloud). I wish to use them only locally with home assistant. It works fine with custom component (had to make some entity updates in code) but I was wondering if there is a better way to make them work without enabling homekit. I am not into apple ecosystem. I am little bit worried about what device does with dohome firware on my network.

I have tried flashing but the device refuses connection during (u1 and u2 flash). Doesn’t work both ways when directly connecting to device hotspot or when device is connected to local wifi network. Seems like dohome firmware is blocking flash, even more reason what is going on inside.

Hardware wise the plug looks fine and it does have ESP chip (confirmed from mac address). I don’t want to break open. Any pointers how to make it work otherwise?

may I ask how did you edit some entity? my log shows “Light is deprecated, modify DoHomeLight to extend LightEntity” . Thank you.

Hi, Have you had any luck? I’m facing the same issue while try to do the u1-u2 part, how did you manage to make it work without DoHome App? what entity updates did you do?, I’m using them with DoHome App but they lost connection with HA very often.

Hi Andres, Follow my guide above. Do not pair with Homekit, pair with your DoHome app, you should press and hold the button for about 10 sec, till starting to blink rapidly. After you pair with the app, the device will be assigned to your network. Than HA see do home plug as an entity, check your entity list

than you can use it in automation calling action ! or switch

I was only recently made aware of this thread (i only get notified about homekit stuff when people file bug reports on GitHub), but to answer the HomeKit part of the question:

This device is violating the HomeKit spec by using 123-45-678. That code is considered so weak that it’s explicitly listed as not allowed in the HomeKit spec, and implementors are supposed to go so far as make sure their random number generators don’t generate it. I will look into backing out the change that added validation about this so we can support these devices. You can keep an eye on The default device homekit 123-45-678 setting code cannot be added · Issue #49154 · home-assistant/core · GitHub to find out more about that. I don’t have much time at the moment though, so I can’t offer a timeline.

In general a native solution is better at fully supporting all the features of your device, but after this issue is resolved you will additionally have the option of a local and cloud free push-based secure and private protocol via HomeKit.

Thanks, I did that and it worked image
but after 12 hours or a day the switch lost connection with HA and I have to reboot HA and they worked again, are you facing this issue?
that’s why I tried with a third party firmware but I couldn’t and homeKit does not work either.

@Kosmodrom do you know how to handle with DoHome devices that only work with Bluetooth? I paired the device in my phone, installed the DoHome add-on, but I don’t know how to pair the bulb into the Home Assistant. HA installed in a Raspbi 3b+

Great. I only lose connection, when I don’t have power on that plug and weak wifi signal. HA sometimes do refresh and don’t see entities when you have this situations.

I have a problem with the dohome integration. My dohome device (rgb led strip) only gets recogniced as a temperatur/humidity sensor in ha.