Flashable UK smart plugs

For batches of these (where I know the ESPHome config well). I create the ESPHome device and configurations. Compile and download each one as a separate firmware. I then copy those to my tuya-convert host and use the correct individual firmware file within the tuya-convert proces (the script lists all the available firmware files and just select the right one).

thanks for replying.

would that take pretty much the same time as my method because you have to compile 4 different firmwares to start with, rather than 1x ‘compile firmware’ + 3x ‘rename’? are there advantages to your method? i suppose it makes adopting them easier afterwards?

quite keen to know efficient methods when i’m just starting out!

just did it this way for my latest batch, all made a lot more sense… had a couple fail but just retried again and again… 8 out of 8 gosund up111s from amazon purchased 2 weeks ago and last week :slight_smile:

1 Like

Do you have the link ? I’ve just received 2 x 3Packs and they wont flash :frowning: User Error - all ok :slight_smile:

Hi @AAllport,

I’ve previously converted a batch of Local Bytes plugs to ESPHome successfully, however I’ve just received a new batch (“2022-05 Tas: v10.0.0”) and none of them are accepting any firmware upgrades. Has something changed with this new batch? It’s almost like the firmware is read-only now…?

I’ve tried to upgrade to various versions of tasmota-minimal.bin via both the file upload and webserver methods, I’ve also tried a straight upgrade to the latest tasmota version. If using file upload, I just see a ‘connection reset’ error in the browser, if I use the webserver method the device resets and returns to the main screen but the firmware version doesn’t change. Either way, I’m completely stuck. Any ideas?

Hi @codersaur,

I think I’ve just replied to an email from you.
Please can you try again using the .bin.gz files and get back to us?

Thanks
Adam

Hi @AAllport,
I received my Tasmota power plug in the post yesterday, and have added it to my home assistant using the Mosquitto integration. So far so good!
I seem to have power monitoring, but both Current and Voltage sensors are zero. Is there a simple fix for this or do I need to go through a calibration exercise?
ORDER #3158
Thanks,
Ian

How come athom plugs do not need calibration? (although I like them less as they have red led that cannot be turned off - mainly that, but local bytes also to have nicer shape)

Some plug that is open to frirmware changes, does not have unconfigurable things like leds/relays/whatnot, and does not require calibration would be nice.

Many of the IOT things are moving to the Beken7231 family of chips. I bought two KS602S switches on Amazon last year and they were ESP devices. I bought two more and discovered that they were using the BK7231S chip. There is nothing on the outside indicating any difference. I found OpenBK and got them into a Tasmota-like (not Tasmota itself) condition that interfaces with Home Assistant as an MQTT device.

However, if you are willing to spend a few pounds more, you can buy Athom plugs and switches with ESPHome (Or Tasmota) already flashed.

Calibration?

What plug are you using? I can control the LED in all of my plugs from Athom.

Localbytes-plug-pm-eu-1 and I would like to flash this GitHub - JamesSwift/localbytes-plug-pm: An ESPHome firmware for the Localbytes smart plug onto it.

Well you are a first one that say that they can control the red led on their athom plug :slight_smile:

Or you can go libreTuya route for bekens, but it means disassembling the device without breaking it :slight_smile:

Never once I was able to keep the plug and both of it’s prongs that go into socket alive when trying to flash it.

this is esphome without any maths on Volts etc.

image

this is with

globals:
  - id: totalEnergy
    type: float
    restore_value: yes
    initial_value: '0.0' 
  - id: voltage_multiply
    type: float
    restore_value: true
    initial_value: "0.3"    
  - id: power_multiply 
    type: float
    restore_value: true
    initial_value: "0.133"    
  - id: current_multiply 
    type: float
    restore_value: true
    initial_value: "0.805"


localbytes - tuya zigbee - athom on the same circuit

so the calibration values are different out of the box, sadly i did not save original values for plug 4

plug 5

# 02:17:06.350 CMD: CurrentCal
# 02:17:06.355 RSL: RESULT = {"CurrentCal":3420}
# 02:16:25.273 CMD: VoltageCal
# 02:16:25.278 RSL: RESULT = {"VoltageCal":1504}
# 02:16:59.292 CMD: PowerCal
# 02:16:59.297 RSL: RESULT = {"PowerCal":9683}

plug 6

# 02:27:42.229 CMD: CurrentSet
# 02:27:42.233 RSL: RESULT = {"CurrentSetCal":3466}
# 02:27:49.173 CMD: VoltageSet
# 02:27:49.178 RSL: RESULT = {"VoltageSetCal":1528}
# 02:27:53.582 CMD: PowerSet
# 02:27:53.587 RSL: RESULT = {"PowerSetCal":9842}

also how do i convert those to esphome?

I’ve just received my local bytes plugs pre flashed with tasmota. I’ve managed to flash them with Tasmota minimal due to file size being too large with ESPHome. I then used the Tasmota Web ui to do an update to the minimal.bin from James’ github page. I’ve adopted the discovered device in ESPHome and compiled and installed the firmware.bin, which has resulted in the below:

substitutions:
  name: localbytess-plug-pm-dc3286
packages:
  localbytes.plug-pm: github://JamesSwift/localbytes-plug-pm/localbytes-plug-pm.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

How do I get the full configuration from the dashboard import? I tried pasting in the full localbytes-plug-pm.yaml and editing it to set my own device name etc, but when I try to install after saving, it compiles, but then fails resolving the IP address of the device.
Once I’ve done this, a second instance of the plug is discovered in ESPHome, ready for adoption, which must be as a result of the ‘dashboard import’.

In my code above, there is no OTA section which I expected to see, so perhaps adding this in when pasting the full config and trying to install is causing the problem when trying to install?

EDIT: Ignore this - I misunderstood how the dashboard import function works - all sorted now after starting over.

@JamesSwift - Hi James - I wasn’t sure whether to ask here on raise an issue/question on your github, however I am seeing some connection errors in my HA logs relating to the LocalBytes plug that I am running your ESPHome firmware configuration on. I realise this could be a hardware fault, but I just thought I would post here in case anyone else had anything similar? I wondered if it could be something to do with the power saving settings on the WiFi config within the localytes-plug-pm.yaml?

Logger: aioesphomeapi.connection
Source: /usr/local/lib/python3.10/site-packages/aioesphomeapi/connection.py:560
First occurred: 7 February 2023 at 16:11:03 (2 occurrences)
Last logged: 9 February 2023 at 06:57:08

dining-lamp @ 192.168.1.127: Connection error occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/connection.py", line 520, in send_message_await_response_complex
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/connection.py", line 519, in send_message_await_response_complex
    async with async_timeout.timeout(timeout):
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 129, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/connection.py", line 303, in _keep_alive_loop
    await self._ping()
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/connection.py", line 628, in _ping
    await self.send_message_await_response(PingRequest(), PingResponse)
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/connection.py", line 537, in send_message_await_response
    res = await self.send_message_await_response_complex(
  File "/usr/local/lib/python3.10/site-packages/aioesphomeapi/connection.py", line 522, in send_message_await_response_complex
    raise TimeoutAPIError(
aioesphomeapi.core.TimeoutAPIError: Timeout waiting for response for <class 'api_pb2.PingRequest'> after 10.0s

Sorry, I don’t check the forums very often so only just seen this post. I don’t get any notifications for some reason.

I’ve not experienced any connection issues, but my home is pretty small. Check your WiFi signal strength to see what it’s like (there’s a sensor for that which will show in home assistant). You could try altering the WiFi block to remove output_power and power_save_mode (or just set them to their defaults). The reason I adjusted them was to reduce the power usage of the plugs, they get quite warm with the esphome defaults.

Let me know how you get on. I still feel like there’s a bug somewhere around WiFi as the plugs don’t get this hot on the tasmota firmware.

wifi:
  output_power: 18db
  power_save_mode: light
  ap:
    ssid: "${friendly_name}"

I’ve just bought one of these Local Bytes smart plugs and flashed your ESPHome firmware onto it. I was then able to add it to Home Assistant using the ESPHome integration and putting in the plug’s hostname. I can turn it on/off within HA, which is all I need right now.

I have a question as an ESPHome noob though: how do I add the device to my ESPHome dashboard? I’m not entirely sure I even want to do this but I guess it adds the ability to mass-upgrade firmware when I have more devices, plus I’d like to see what other features might be available. When I start ESPHome (via a docker container) it has a “+New Device” button but it says I need to plug the device into my PC…which is impossible with these smart plugs! I tried to just create a configuration with the “name” set to the plug’s hostname but that doesn’t seem to find the plug.

EDIT: Am I supposed to add a new dummy device and then edit the YAML to match this file??

The device should show up in esphome automatically and allow you to “adopt” it. If you’re not seeing that, and not able to connect to it by using the same hostname, I wonder if you esphome docker container has proper network access?

For reference, here’s my docker-compose config. You have to use the host network mode.

version: '3'

services:
  esphome:
    image: esphome/esphome
    volumes:
      - ./projects:/config:rw
      # Use local time for logging timestamps
      - /etc/localtime:/etc/localtime:ro
    network_mode: host
    restart: always

Hello all,

I have a Local Bytes smart plug (Tasmota “edition”) which I used with no issues for a while, but I sopped using it a few months ago.

Just recently I wanted to put it back in service but, after updating the firmware and connecting it to my wireless network, the plug was not delivering power to any appliance plugged into it. I decided to flash it with ESPhome.

At the moment the plug has only the minimal image and it is imported into HA, but I don’t know how to upgrade the firmware to the full firmware.

and the diagnostic information:

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.11.3",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.11.6",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/London",
    "os_name": "Linux",
    "os_version": "6.1.21-v8",
    "supervisor": "2023.11.3",
    "host_os": "Home Assistant OS 11.1",
    "docker_version": "24.0.6",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {},
  "integration_manifest": {
    "domain": "esphome",
    "name": "ESPHome",
    "after_dependencies": [
      "zeroconf",
      "tag"
    ],
    "codeowners": [
      "@OttoWinter",
      "@jesserockz",
      "@kbx81",
      "@bdraco"
    ],
    "config_flow": true,
    "dependencies": [
      "assist_pipeline",
      "bluetooth"
    ],
    "dhcp": [
      {
        "registered_devices": true
      }
    ],
    "documentation": "https://www.home-assistant.io/integrations/esphome",
    "integration_type": "device",
    "iot_class": "local_push",
    "loggers": [
      "aioesphomeapi",
      "noiseprotocol"
    ],
    "requirements": [
      "async-interrupt==1.1.1",
      "aioesphomeapi==18.2.4",
      "bluetooth-data-tools==1.14.0",
      "esphome-dashboard-api==1.2.3"
    ],
    "zeroconf": [
      "_esphomelib._tcp.local."
    ],
    "is_built_in": true
  },
  "data": {
    "config": {
      "entry_id": "e4ed145995c84eb2b97c5753bc9203de",
      "version": 1,
      "domain": "esphome",
      "title": "Localbytes Plug PM xxxxxx",
      "data": {
        "host": "10.1.20.22",
        "port": 6053,
        "password": "",
        "noise_psk": "",
        "device_name": "localbytes-plug-pm-xxxxxx"
      },
      "options": {
        "allow_service_calls": true
      },
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "zeroconf",
      "unique_id": "4c:eb:d6:xx:xx:xx",
      "disabled_by": null
    },
    "storage_data": {
      "device_info": {
        "uses_password": false,
        "name": "localbytes-plug-pm-xxxxxx",
        "friendly_name": "Localbytes Plug PM xxxxxx",
        "mac_address": "**REDACTED**",
        "compilation_time": "Aug 18 2023, 23:52:36",
        "model": "esp01_1m",
        "manufacturer": "Espressif",
        "has_deep_sleep": false,
        "esphome_version": "2023.7.1",
        "project_name": "localbytes.plug-pm",
        "project_version": "1.6.3",
        "webserver_port": 0,
        "voice_assistant_version": 0,
        "legacy_bluetooth_proxy_version": 0,
        "bluetooth_proxy_feature_flags": 0,
        "suggested_area": ""
      },
      "services": [],
      "api_version": {
        "major": 1,
        "minor": 9
      }
    }
  }
}

Just to add that I can’t use the web GUI because port 80 is filtered. Ports 6053 and 8266 are opened.

Any help will be much appreciated.

I suggest reflashing with tasmota or speaking to LocalBytes if it was in a “broken” state before esphome.

If you read the notes here GitHub - JamesSwift/localbytes-plug-pm: An ESPHome firmware for the Localbytes smart plug it tells you how to upload the full firmware