Gosund P1 power strip with power monitoring

The newer ones do not have that issue. Or, at least, not for all of them.
Unfortunately still not the best WiFi strength.

Thank you for the information. I will first test it with my one bar.

Unfortunately I can’t even get one of the seats switched without the config.

So it would be really very helpful for me if you could post me the config of ESP home one at a time (also via PN if you like) so that I can continue.

A heartfelt thank you

“The newer ones”… bought them around 3 weeks to lastly 3 days ago… they had it all…

I had 3 of them, only one, so far, with that issue. But due to Your experience, it looks like the production date is not so important, just “some has problem”.

configuration plugstrip Gosund P1 (need to be cleaned)

1 Like

Thank you very much !

@QbaF great work! Thanks for sharing!
Is there a way to not have the main button always flashing blue ?
Thanks in advance!

Of course. There are a lot of ways. Two easiest ones could be:

  • switching it off (entity id: “${plug_name}_ledblue”)
  • remove this led from esphome yaml

I also have a P1 and successfully flashed it with esphome.
It shows up in home-assistant (esphome integration), showing " esp8285 by espressif Firmware: 2021.12.2 (Dec 23 2021, 20:34:04)".

But I don’t see any buttons which I could toggle or current/ampere values. If I click on either “Automation” or “Scripts” I only get “There are no automations available for this device.”

How do I get further ? I’m pretty new to home-assistant so maybe I’m missing sth fundamental.

It depends exactly what ESPHome code You use.

@QbaF I’m using this config:

# Taken from old PR: https://github.com/esphome-devices/esphome-devices/pull/78/files
# Current [wiki entry](https://www.esphome-devices.com/devices/Gosund-P1)
# doesn't work (no entities at all)
esphome:
  name: powerstrip-desk
  platform: ESP8266
  board: esp8285

wifi:
  ssid: !secret wifi_casita_ssid
  password: !secret wifi_casita_pass

  ap:
    ssid: "Gosund P1 Fallback Hotspot"
    password: !secret wifi_fallback_pass
ota:

api:
  reboot_timeout: 1min

logger:
  #level: VERY_VERBOSE
  #level: DEBUG
  baud_rate: 0
  logs:
    adc: INFO

status_led:
  pin:
    number: GPIO02
    inverted: True

uart:
  rx_pin: GPIO03
  tx_pin: GPIO01
  baud_rate: 4800

switch:
- platform: gpio
  name: PS-1 Socket 1
  id: socket_1
  pin: GPIO14
- platform: gpio
  name: PS-1 Socket 2
  id: socket_2
  pin: GPIO12
- platform: gpio
  name: PS-1 Socket 3
  id: socket_3
  pin: GPIO13
- platform: gpio
  name: PS-1 USBs
  id: socket_usb
  pin:
    number: GPIO05
    inverted: True

sensor:
- platform: cse7766
  current:
    name: "PS1 Current"
  voltage:
    name: "PS1 Voltage"
    filters:
    - calibrate_linear:
      - 0.7 -> 0.0
      - 97.5 -> 231.5
  power:
    name: "PS1 Power"
    filters:
    - calibrate_linear:
      - 0.0 -> 0
      - 290 -> 690
      - 490 -> 1170
    - lambda: "return x < 2 ? 0 : x;"
  update_interval: 20s

- platform: adc
  pin: A0
  id: socket_buttons
  update_interval: 1s
  on_value_range:
    - below: 0.33
      then:
        - switch.toggle: socket_3
    - above: 0.33
      below: 0.67
      then:
        - switch.toggle: socket_2
    - above: 0.67
      below: 0.88
      then:
        - switch.toggle: socket_1

binary_sensor:
- platform: gpio
  pin: GPIO16
  id: power_button
  on_press:
    then:
      - switch.toggle: socket_usb

output:
  - platform: esp8266_pwm
    id: state_led
    pin:
      number: GPIO0
      inverted: true

light:
  - platform: monochromatic
    output: state_led
    id: state_light

Strange. You should see 4 buttons (switches).
Could You show this device site in HA?

Thx for the Template

but i cant see the Powermonitoring

Switches work’s well

any idea on this

thx

Show this device site in HA

This is my first integration using ESPHome so I am using some Gosund P1 devices I have used before with Home Assistant using Tasmota. It has been a steep learning curve. I used the YAML from Gosund P1 | ESPHome-Devices and uploaded after flashing Tasmota mimimal. It connects and I can control the four outputs from HA. I am getting the wifi signal and the time up but no power information. It created the sensors in HA but they are not getting data. They did with the Tasmota implementation. Have I done something stupid and if so how do I work out what?

Thanks

DAvid

I have similar code, at least in the area of voltage, current and power. Is no one of these sensors getting data?
Typo, indentation?

None of the power ones, but wifi and uptime are ok

I did cut and paste the code but possibly I have altered the indentation when changing the top items.

I will check now

D

I can’t see an issue here with indents

Here is the code I am using

esphome:

name: power-strip-1

platform: ESP8266

board: esp8285

esp8266_restore_from_flash: true

substitutions:

plug_name: p1_01

wifi:

ssid: xxx

password: xxx

#domain: !secret domain

#use_address: 192.168.6.6

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:

ssid: "${plug_name} Fallback Hotspot"

password: !secret Fallback_Hotspot

captive_portal:

Enable logging

logger:

#level: VERY_VERBOSE

#baud_rate: 0

#level: DEBUG

baud_rate: 0

logs:

adc: INFO

Enable Home Assistant API

api:

ota:

time:

  • platform: homeassistant

    id: homeassistant_time

status_led:

pin:

number: GPIO02

inverted: True

uart:

rx_pin: GPIO03

#tx_pin: GPIO01

baud_rate: 4800

sensor:

  • platform: wifi_signal

    name: “${plug_name} - WiFi Signal”

    update_interval: 60s

  • platform: uptime

    name: “${plug_name} - Uptime”

    icon: mdi:clock-outline

    update_interval: 60s

  • platform: cse7766

    current:

    name: “${plug_name} - Ampere”

    unit_of_measurement: A

    accuracy_decimals: 3

    icon: mdi:flash-outline

    voltage:

    name: “${plug_name} - Volt”

    unit_of_measurement: V

    accuracy_decimals: 1

    icon: mdi:flash-outline

    filters:

    - lambda: return x * 2.34245;
    

    power:

    name: “${plug_name} - Watt”

    unit_of_measurement: W

    id: “${plug_name}_Wattage”

    icon: mdi:flash-outline

    filters:

    - lambda: return x * 2.34245;
    

    update_interval: 3s

  • platform: total_daily_energy

    name: “${plug_name} - Dagverbruik”

    power_id: “${plug_name}_Wattage”

    filters:

    # Multiplication factor from W to kW is 0.001
    
    - multiply: 0.001
    

    unit_of_measurement: kWh

    icon: mdi:clock-alert

  • platform: adc

    pin: GPIO17

    id: gpio17

    internal: true

    update_interval: 0.1s

    filters:

    • lambda: |-

      if(x >= 0.60 && x < 0.90){

      id(buttonrelay1).publish_state(true);
      

      } else if(x >= 0.30 && x < 0.60){

      id(buttonrelay2).publish_state(true);
      

      }

      else if(x > 0.10 && x < 0.30){

      id(buttonrelay3).publish_state(true);
      

      } else {

      id(buttonrelay1).publish_state(false);
      
      id(buttonrelay2).publish_state(false);
      
      id(buttonrelay3).publish_state(false);
      

      }

      return{};

binary_sensor:

  • platform: gpio

    id: button

    internal: true

    pin:

    number: GPIO16

    mode: INPUT

    inverted: true

    #on_state:

    on_press:

    • switch.toggle: relay4
  • platform: template

    id: buttonrelay1

    internal: true

    on_press:

    • switch.toggle: relay1

    filters:

    • delayed_off: 100ms
  • platform: template

    id: buttonrelay2

    internal: true

    on_press:

    • switch.toggle: relay2

    filters:

    • delayed_off: 100ms
  • platform: template

    id: buttonrelay3

    internal: true

    on_press:

    • switch.toggle: relay3

    filters:

    • delayed_off: 100ms

text_sensor:

  • platform: version

    name: “${plug_name} - ESPHome Version”

switch:

  • platform: gpio

    pin: GPIO14

    id: relay1

    restore_mode: RESTORE_DEFAULT_ON

    name: ‘${plug_name} - Switch1’

    icon: mdi:power-socket-eu

  • platform: gpio

    pin: GPIO12

    id: relay2

    restore_mode: RESTORE_DEFAULT_ON

    name: ‘${plug_name} - Switch2’

    icon: mdi:power-socket-eu

  • platform: gpio

    pin: GPIO13

    id: relay3

    restore_mode: RESTORE_DEFAULT_ON

    name: ‘${plug_name} - Switch3’

    icon: mdi:power-socket-eu

  • platform: gpio

    pin: GPIO05

    id: relay4

    restore_mode: RESTORE_DEFAULT_ON

    name: ‘${plug_name} - Switch USB’

    icon: mdi:power-socket-eu

    inverted: yes

  • platform: restart

    name: “${plug_name} - ESP Restart”

  • platform: template

    name: ‘${plug_name} - Switch off 60s (reset!)’

    turn_on_action:

    - switch.turn_off: relay3
    
    - delay: 60s
    
    - switch.turn_on: relay3
    

Much better would be if You will replace that post with link to pastebin with code. I am not sure if I will be able to help You but for most others that will be easier to check.

haha more learning :slight_smile: