Smart Plug Power Monitoring -Little Help?

Tags: #<Tag:0x00007f73952d4488> #<Tag:0x00007f73952d42f8>

Hi All, Firstly I’m very new to Home Assistant so please forgive me if I ask dumb questions but i’m getting there.

I wanted to get some Tuya smart plugs (Gosund UP111) running locally and with power monitoring in home assistant. I believe I have two options Tasmota and ESPHome.

I’ve managed to get Tasmota on a test device but this requires MQTT which I don’t have setup yet. So I looked at ESPHome, i’ve added the Home Assistant integration and compiled the following binary;

substitutions:
# Unique ID for Sensors.
  switch_id: "plug_washingmachine"
  # Higher value gives lower watt readout (0.0025)
  current_res: "0.00221"
  # Lower value gives lower voltage readout (880)
  voltage_div: "955"
    
esphome:
  name: ${plug_name}
  comment: Gosund UP111 - Washing Machine
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "<WiFIAP>"
  password: "<APPassword>"

# Enable logging
logger:

# Enable Home Assistant API
api:
  reboot_timeout: 0s
  password: '<ESPPassword>'
  
ota:
  password: '<ESPPassword>'

time:
  - platform: homeassistant
	id: homeassistant_time
binary_sensor:
  # Push Button
  - platform: gpio
    id: ${plug_name}_in_switch1
    internal: true
    pin: GPIO3
    name: "${plug_name}_button"
    filters:
      - invert:
    on_click:
      min_length: 50ms
      max_length: 350ms
      then:
        - switch.toggle: ${plug_name}_out_relay1
  # Template Sensor - Tracks Relay, Switches LED to Match (Internal Only)
  - platform: template
    name: "${plug_name} Template 1"
    id: ${plug_name}_template1
    internal: true
    lambda: |-
      if (id(${plug_name}_out_relay1).state) {
        return true;
      } else {
        return false;
      }
    on_state:
      - if:
          condition:
            - binary_sensor.is_on: ${plug_name}_template1
          then:
            - switch.turn_on: ${plug_name}_out_led
            - switch.turn_off: ${plug_name}_out_led_red
      - if:
          condition:
            - binary_sensor.is_off: ${plug_name}_template1
          then:
            - switch.turn_off: ${plug_name}_out_led
            - switch.turn_on: ${plug_name}_out_led_red

switch:
  # Restart Switch in HA
  - platform: restart
    name: "${plug_name} Restart"
  # Relay Output
  - platform: gpio
    pin: GPIO14
    #restore_mode: ALWAYS_ON
    id: ${plug_name}_out_relay1
    name: "${plug_name} Relay 1"
  # Blue LED Output
  - platform: gpio
    pin: GPIO1
    internal: true
    id: ${plug_name}_out_led
    inverted: yes
    name: "${plug_name} Touch Status Led Blue"  
  - platform: gpio
    id: ${plug_name}_out_led_red
    name: "${plug_name} Touch Status Led Red"
    pin: GPIO13
    inverted: True
    internal: true
    restore_mode: ALWAYS_OFF

sensor:
  - platform: hlw8012
    sel_pin:
      number: GPIO12
      inverted: True
    cf_pin: GPIO04
    cf1_pin: GPIO05
    current_resistor: ${current_res}
    voltage_divider: ${voltage_div}
    current:
      name: "${plug_name}_Amperage"
      unit_of_measurement: A
    voltage:
      name: "${plug_name}_Voltage"
      unit_of_measurement: V
    power:
      name: "${plug_name}_Wattage"
      unit_of_measurement: W
      id: "${plug_name}_Wattage"
    change_mode_every: 8
    update_interval: 10s
  - platform: total_daily_energy
    name: "${plug_name}_Total Daily Energy"
    power_id: "${plug_name}_Wattage"
    filters:
        # Multiplication factor from W to kW is 0.001
        - multiply: 0.001
    unit_of_measurement: kWh
# Extra sensor to keep track of plug uptime
  - platform: uptime
    name: ${plug_name} Uptime Sensor
    
# Wifi Signal
  - platform: wifi_signal
    name: "${plug_name} WiFi Signal Sensor"
    update_interval: 60s

Which was 99% stolen code from other posts and it validates, I’ve checked all the GPIOs against Tasmota and I think the platform and board are correct but Tasmato refused to flash OTA and when flashed through Tuya_Convert it bricked the plug, so something isn’t right!

If Tasmato is the way to go then I’ll persist with getting MQTT setup but for this use ESPHome does seem smarter and MQTT seems a bit of a learning curve.

Any suggestion, help would be greatly appreciated.

I thought there was an issue with my binary, there still might BUT.
Running ‘SetOption78 on’ in the tasmota console then allowed the ESPHome binary to be flashed OTA.

Hopefully thats all was needed and my logn winded post will be helpful for others.

No idea why Tuya_convert bricked the first device?! Same binary used via Tasmota.

Just an update for anyone that comes across this.
There seems to be an internal difference between Gosund UP111’s marked with 10A to those with 13A.
The 13A worked like a charm, the 10A ones I have refused to connect to my WiFi despite repeating the exact same steps. The plugs looked bricked with no response and not on WiFi ( no way to hard connect without cracking them open). But they simply won’t join my WiFi, think it’s due to special characters!?

To get them working I setup another AP and recovered tasmota by using the fast power cycle recovery. Joined to new AP (simple password), connected to console, set option 78 and uploaded esphome binary with real AP details in…all working.

Anyone know why a device with the exact same version of tasmota binary would take a password with special characters and another won’t?