Nous A1T Tasmota --> ESPhome

I have a Nous A1T socket this is already flashed with Tasmota.
Is it possible to flash this socket with ESPHome?
I can not upload the .bin file (.bin.gz) via the firmware upgrader in Tasmota. It always comes the message “Not enough space”.

My ESPHome.yaml

substitutions:
  devicename: "smartplug"
  # Higher value gives lower watt readout
  current_res: "0.00280"
  # Lower value gives lower voltage readout
  voltage_div: "775"


esphome:
  name: nous-a1t-001
  comment: "Nous Smart Wifi A1T - 001"
  name_add_mac_suffix: true
  project:
    name: "NOUS.Smart-Wifi-Socket_001"
    version: "A1T"  

esp8266:
  board: esp8285
  restore_from_flash: true

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "mykey"

ota:
  password: "mypassword"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.xx.xxx
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.xx.xxx
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.xxxx

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Nous-A1T-001 Fallback Hotspot"
    password: "mypassword"


captive_portal:

# see: https://esphome.io/components/time.html
time:
  - platform: homeassistant
    id: homeassistant_time

# Enable Web server
web_server:
  port: 80

light:
  - platform: status_led
    id: led
    pin:
      number: GPIO13
      inverted: true

binary_sensor:
  - platform: status
    name: "${devicename} - Status"

  # toggle relay on/off
  - platform: gpio
    pin:
      number: GPIO00
      mode: INPUT_PULLUP
    id: "button_state"
    on_press:
      - switch.toggle: "button_switch"

switch:
  - platform: template
    name: "${devicename} - Switch"
    icon: mdi:power
    optimistic: true
    id: "button_switch"
    lambda: |-
      if (id(relay).state) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      - switch.turn_on: relay
      - light.turn_on: led
    turn_off_action:
      - switch.turn_off: relay
      - light.turn_off: led
  - platform: gpio
    pin: GPIO14
    id: relay

sensor:
  - platform: wifi_signal
    name: "${devicename} - Wifi Signal"
    update_interval: 60s
    icon: mdi:wifi

  - platform: uptime
    name: "${devicename} - Uptime"
    update_interval: 60s
    icon: mdi:clock-outline

  - platform: total_daily_energy
    name: "${devicename} - Electric Consumption [kWh]"
    power_id: "nous_a1t_watt"
    filters:
      # Multiplication factor from W to kW is 0.001
      - multiply: 0.001
    unit_of_measurement: kWh
    icon: mdi:calendar-clock

  - platform: adc
    pin: VCC
    name: "${devicename} - VCC Volt"
    icon: mdi:flash-outline

  - platform: hlw8012
    sel_pin:
      number: GPIO12
      inverted: True
    cf_pin: GPIO04
    cf1_pin: GPIO05
    change_mode_every: 4
    current_resistor: ${current_res}
    voltage_divider: ${voltage_div}
    update_interval: 3s

    current:
      name: "${devicename} - Ampere"
      unit_of_measurement: A
      accuracy_decimals: 3
      icon: mdi:current-ac

    voltage:
      name: "${devicename} - Voltage"
      unit_of_measurement: V
      accuracy_decimals: 1
      icon: mdi:flash-outline

    power:
      name: "${devicename} - Power"
      id: "nous_a1t_watt"
      unit_of_measurement: W
      icon: mdi:gauge

text_sensor:
  - platform: wifi_info
    ip_address:
      name: "${devicename} - IP Address"
    ssid:
      name: "${devicename} - Wi-Fi SSID"
    bssid:
      name: "${devicename} - Wi-Fi BSSID"
  - platform: version
    name: "${devicename} - ESPHome Version"
    hide_timestamp: true    

Yes it is.

Because it probably is. Other than esphome the tasmota firmware packs everything (including the stuff you don’t need) into the binary. That’s typically causes to always be short on space having tasmota flashed.

The typical scenario is to flash a tasmota-minimal.bin to have space for a ota update again.

You could probably also just build a esphome firmware with the minimal amount of components possible to still fit in - something like:

esphome:
  name: nous-a1t-001
  platform: ESP8266
  board: esp8285

wifi:
  networks:
  - ssid: 'SSID'
    password: 'PASSWORD'

ota:

logger:
  level: NONE

after that you can just use the esphome magic to directly run ota updates without hassle :muscle:

Thanks, this will be the way i go.

Dear all,

I just ordered the same A1T plugs.

Now from the manufacturer docs (Nous A1T Tasmota Smart WiFi Socket 16A with Power monitoring - Nous technology) I found that the HLW8012 indeed is a model BL0937, which should be stated in the device definition according to HLW8012 Power Sensor — ESPHome.

Now not a single YAML file for the A1T found on the web does use this option, including the file above.

Can someone explain if I got something wrong? Thanks.

@orange-assistant and @svenson, I would be grateful if you could quickly confirm what the device to be used is. Thanks, guys!

:eyes:

I have no idea what your device is using :man_shrugging:

In general the HLW8012 configuration should even work for a BL0937 but the later should have advantages in accuracy when configured probably. :white_check_mark:

Feel free to post your mileage :blue_car:

Flashing with tasmota-minimal.bin (~380 kB) gives the same “not enought space” error. Plug shows: Tasmota 13.0.0. Uploading minimal ESPhome binary (~475 kB)) fails too.

Plug Date of MFG: 11.2023

Edit/Solved: uploading the zipped Version (tasmota-minimal.bin.gz) works fine.

My “detailed” tutorial:

  1. Plug the Nous A1T and connect to the WiFi hotspot it created (tasmota-….)

  2. Go to 192.168.4.1 and connect the device to your WiFi….It will show you the IP that the device will use in your home WiFi.

  3. After connecting your PC to your home WiFi, go to this IP. Then upgrade with the file tasmota-minimal.bin.gz from here: Tasmota ESP8266 Binaries
    Be careful: do not use tasmota-minimal file after finishing these steps (i.e. after flashing ESPHome). There is a possibility to brick your device.

After finishing, reconnect to Tasmota UI with the same IP.

  1. In Home Assistant ESPHome, create a new device (pick ESP8266 at creation) and replace the yaml with the one here: Nous A1t | devices.esphome.io

  2. Add - platform: esphome under ota: and build the configuration (Install, Manual Download)

  3. Flash the ESPHome binary using the Tasmota UI (Firmware Upgrade)

I would add one thing: When using the above yaml in step three, I couldn’t get ESPhome to connect to the device.

ESPhome was expecting the device to broadcast the address “devicename.local”, but the yaml appends a bit from the MAC address to the name the device broadcasts on mDNS. Meaning, ESPhome is looking for “devicename.local” but the device is broadcasting “devicename-randomchars.local”.

So in the bit of yaml here, change name_add_mac_suffix to false.

esphome:
  name: $devicename
  comment: "Nous Smart Wifi Socket A1T (Tasmota)"
  name_add_mac_suffix: false
  project:
    name: "NOUS.Smart-Wifi-Socket"
    version: "A1T"

Generally i avoid hostnames (sometimes these .local hostnames doesnt work). That’s why i use local IP (as stated in my comment). But good to add this info too.