Localbytes plug - adoption by esphome

I have flashed a tasmota plug with esphome (minimal) to install the https://github.com/JamesSwift/localbytes-plug-pm firmware. So currently it simply has minimal esphome. It is connected to my wifi and, in HA Integrations, I added this device to ESPHOME using the ip address.

It is in HA but is not showing in the actual Esphome web page.

The project has the following statement:

At this point you can use the “dashboard import” feature of esphome to take ownership of the device. The next time you hit install/update via the dashboard, the full firmware will be uploaded to the plug.

So this would suggest that “import” would automatically add an entry to EspHome where I can do whatever is required with Yaml code. First I would install the full firmware but this suggests it would do that there.

I have only done initial installs of devices that I can attach to my laptop and this allows me to pick up the appropriate api and ota details so that I can ensure any new yaml has this info.

Not sure what I have to do now to get this properly into Esphome. If I simply add a new device in ESPHOME, I will end up overwriting the Yaml with code that does not reflect the firmware required.



2023-10-27

I did get a copy of the yaml from the project and created a tailored copy of it for a new Esphome device, with a manual ip of the minimal esphome plug. That has updated and started the plug correctly but I don’t think this is the correct way. It meant I had to comment out the dashboard_import as I expect this will overwrite my yaml if an update is detected and applied. This would clear out my wifi, ota, encryption details.

I also see in some online conversations that Esphome should actually give an option in the Esphome web page to “Adopt” a “Discovered” Esphome device. I don’t think I ever get that in my HA Esphome. I have to add esphome flashed devices in the Integrations page using the ip address.

This is another project waiting for me get round to it! I have a few of these, ALL with Tasmota and I have one that I “freed” ready for the change over.

I’ve converted a few other devices from Tasmota to ESPHome and I’m realitively happy with the process now. I found that it is MUCH easier if you name the device in ESPHome rather than use the generic naming. It could just be me, but I found the whole conversion process was smoother when doing this, no issues with keys and passwords and joining to HA/ESPHome.

So I’ve always created a new ESPHome device with a new name and minimal configuration. Once that’s working pasted in the new code, or used a package.

So far I’ve converted Sonoff Mini R2s and TCPSmart Plugs(UK) and (touch wood) all are absolutely fine. My ESPhome page is now getting a bit unwieldy now though. Hey, another project!!!

1 Like

Hello,

I am having the same issue. I did flash the Local Bytes smart plug with the minimal ESPhome image and now I don’t know how how to upload the full image in Home Assistant…

I can’t access the web UI either.

Thanks

If you look at the available WiFi access points, do you see one that starts with local-bytes or something similar?

If you’ve downloaded the minimal firmware you need to connect to it in AP mode first so that you can input your WiFi details.

I should have mentioned that in my first post, my mistake.

Yes I had joined the Local Bytes smart plug to my Wi-Fi network by connecting to the SSID initially broadcasted by the plug.

All I can get in Home Assistant related to the smart plug is:

The only opened ports are:

PORT     STATE SERVICE
6053/tcp open  x11
8266/tcp open  espeasy-p2p

The next step I haven’t tried myself so I’m relying on the documentation and a quick look at the minimal code. Two options come to mind to try;

  1. Can you find the IP address of the device and can you connect to it? If so does it have an OTA dialog box?
  2. The documentation suggests that after it’s adopted by ESPHome and then updated it picks up the “full” firmware.
  1. I know the IP address, but, as the http(s) ports (80 and 443) are closed, I can’t access the web UI (I get the “page cannot be displayed” error).

  2. Well, it didn’t :slight_smile:

I wonder if I can add some code to Home Assistant’s configuration.yaml file to somehow force the update into the smart plug…

I haven’t been through the process on the LocalBytes plugs, but I’ve been through a similar process converting my TCPSmart plugs from Tasmota to ESPHome.

Sorry, re-reading the minimal code, there isn’t a webserver!

At this point you can use the “dashboard import” feature of esphome to take ownership of the device. The next time you hit install/update via the dashboard, the full firmware will be uploaded to the plug.

That implies that once you’ve adopted the device in the ESPHome dashboard, if you hit update, it loads the new code!? From the minimal yaml file,

package_import_url: github://JamesSwift/localbytes-plug-pm/localbytes-plug-pm.yaml@main

That implies that once you’ve adopted the device in the ESPHome dashboard, if you hit update, it loads the new code!?

I wish I knew where that “update” button is so I can hit it :slight_smile:

I assume that, as long as the smart plug shows in ESPhome (see my screenshot above), is has been adopted, right?

I’m very interested in how this goes, as I’m about to do this to my existing LocalBytes Tasmota plugs. So I’ll do my best with what I’ve learned so far… I’m no expert!

I think it’s talking about the Update when the code is outdated? So if you used a downloaded file, it should be outdated and needs updating?

There’s an ESPHome update, lets see what happens…

Nothing happened to my smart plug yet. I have delete it from the ESPhome integration, added back, nothing.

I wonder if there is any way to do a hard reset on the smart plug, so I force it into forgetting my Wi-Fi network. Then I could access it via the web UI on the “Localbytes Plug PM” SSID and push the “full” image.

There’s nothing I can find saying how to do a hard reset I’m afraid.

I’m struggling to understand the documentation about dashboard import. It appears to be straighforward, add the url and that config is imported.

I wonder if it’s this? In the full yaml

project:
    name: localbytes.plug-pm
    version: "1.0.0"

and in the minimal yaml

  project:
    name: localbytes.plug-pm
    version: "1.6.0"

Does that mean the dashboard import won’t happen because the minimal is newer than the full?

In @JamesSwift version (the original) of the ESPHome yaml, his minimal is 1.6.0 and full is 1.6.3!

Is it possible that LocalBytes have changed some of the code but forgot the version numbers?

Just fired off an email to LocalBytes asking them to have a look.

I tried to update using the ESPHome Dashboard in Home Assistant:

I put both, the minimal and full configuration YAML files in the ESPHome folder.

Trying to upgrade the firmware using the “Install” feature in ESPHome Dashboard , I get the “ERROR Error receiving acknowledge version: timed out” error and the installation stops.

Here is the log:

INFO ESPHome 2023.11.6
INFO Reading configuration /config/esphome/localbytes-plug-pm.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing localbytes-plug-pm (board: esp01_1m; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.1.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- ArduinoJson @ 6.18.5
Compiling .pioenvs/localbytes-plug-pm/src/esphome/components/api/api_connection.cpp.o
Compiling .pioenvs/localbytes-plug-pm/src/esphome/components/api/api_frame_helper.cpp.o
[...]
Compiling .pioenvs/localbytes-plug-pm/FrameworkArduino/umm_malloc/umm_poison.c.o
Archiving .pioenvs/localbytes-plug-pm/libFrameworkArduino.a
Linking .pioenvs/localbytes-plug-pm/firmware.elf
RAM:   [====      ]  43.1% (used 35320 bytes from 81920 bytes)
Flash: [=====     ]  48.6% (used 498005 bytes from 1023984 bytes)
Building .pioenvs/localbytes-plug-pm/firmware.bin
esp8266_copy_factory_bin([".pioenvs/localbytes-plug-pm/firmware.bin"], [".pioenvs/localbytes-plug-pm/firmware.elf"])
======================== [SUCCESS] Took 228.03 seconds ========================
INFO Successfully compiled program.
INFO Connecting to 10.1.20.22
INFO Uploading /data/build/localbytes-plug-pm/.pioenvs/localbytes-plug-pm/firmware.bin (502160 bytes)
ERROR Error receiving acknowledge version: timed out

I’m guessing here but, assuming that is the ip address of he device that the device is saying no thank you?

As you are compiling the code locally maybe try changing the version number to greater than V1.6.0?

So I’ve just done my first LocalBytes plug!

  1. Compiled locally the minimal code, BUT changed the version to V0.9.0
  2. On the Tasmota plug, uploaded Tasmota minimal firmware.
  3. Uploaded the LocalBytes locally compiled firmware.
  4. Connected to the LocalBytes AP and entered WiFi credentials.
  5. Recieved notification of new ESPHome device and configured device.
  6. In ESPHome dashboard adopted device.
  7. After getting API key, ESPHome immediately compiled new code.
  8. Received notification that device required reconfiguring.
  9. Reconfigured device (get required API key from YAML file)
  10. Unable to reconfigure, “Can’t connect to ESP. Please make sure your YAML file contains an ‘api:’ line.”
  11. Unplugged device and plugged back in.
  12. Same error
  13. Restarted HA
  14. Took a long while before ESPHome asked for reconfiguration.
  15. Connecting to the device ip I now see voltage and current details.
  16. Still unable to reconfigure in ESPHome, getting the same error.

So I think it looks like the versioning is the issue? I just an ESPHome configuration to get around.

Yes, something similar here. I’m tempted to go back to Tasmota…

I gave up. I may be an idiot, but this plug is crap - I resorted to ESPHome because there was no power coming out of the plug and I assumed this was due to the latest Tasmota firmware I upgrade it to.

I don’t have the spare time to waste on this plug any longer - I’ll put it into the WEEE bin and look for an alternative.