Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guide for new device type "Gosund EP2 Smart Plug" (Product Key: wifvoilfrqeo6hvu) #470

Closed
Ro4cHii opened this issue Apr 30, 2021 · 3 comments

Comments

@Ro4cHii
Copy link

Ro4cHii commented Apr 30, 2021

The problem

Since I was having trouble setting up the Gosund EP2 Plug, here is a quick guide to have it behave like this:
Plug_Config

The device comes with 6 DPs in its original firmware:

  • DP1 = State (on/off)
  • DP2 = ? (is always 0 for me)
  • DP4 = Current
  • DP5 = Power
  • DP6 = Voltage
  • DP7 = ? (is always 'False' for me)

Please note:

  • Since the entity IDs get created automatically, the sensor names I am using may differ from yours.
  • The real values may be about ~1% off due to the way I calculate them so if this is a problem just adapt the calculations mentioned further below
  • There seems to be a certain threshold until reasonable values are provided by the plug (e.g. if I try to just charge my phone it shows 0 Watts)
  • Internet access may NOT be blocked or else (at least) DP4 and DP5 will show "not available" (There seems to be some way around this according to this comment but I haven't really figured it out yet)

Configuration configuration.yaml

localtuya:
  - host: 192.168.x.x
    device_id: ''
    local_key: ''
    friendly_name: Gosund EP2 Plug
    protocol_version: "3.3"
    entities:
      - platform: binary_sensor
        friendly_name: Plug Status
        id: 1
        device_class: power
        state_on: "true"
        state_off: "false"
      - platform: sensor
        friendly_name: Plug Current
        id: 4
        device_class: current
        unit_of_measurement: "A"
      - platform: sensor
        friendly_name: Plug Power
        id: 5
        device_class: power
        unit_of_measurement: "W"
      - platform: sensor
        friendly_name: Plug Voltage
        id: 6
        device_class: voltage
        unit_of_measurement: "V"
      - platform: switch
        friendly_name: Plug Switch
        id: 1

Configuration template_sensors.yaml

The values provided by the power and current sensors don't have the correct scaling yet. You can specify the scaling for the entities themselves but I prefer to do it via template sensors because usage is more flexible. I also created a template sensor for the voltage since I don't want to see the decimal place.

plug2_power:
  friendly_name: Plug Power
  unit_of_measurement: 'W'
  device_class: power
  value_template: '{{((states("sensor.plug_dp5") | int) / 10) | int}}'
plug_voltage:
  friendly_name: Plug Voltage
  unit_of_measurement: 'V'
  device_class: voltage
  value_template: '{{((states("sensor.plug_dp6") | int) / 10) | int}}'
plug_current:
  friendly_name: Plug Current
  unit_of_measurement: 'A'
  device_class: current
  value_template: |-
    {% set currentFlow = ((states("sensor.plug_dp4") | int) / 1000) %}
    {% if currentFlow < 0.01 %}
      {{currentFlow | int}}
    {% else %}
      {{currentFlow | round(2)}}
    {% endif %}
@AimPizza
Copy link

How can I get the local key of a Gosund device?

@Eugeniusz-Gienek
Copy link

I've got this plug and I have hard time adding it to LocalTuya. The thing is that when I try to add it it says no datapoints found - thus I have to add them manually. For some reason the switch is disabled in the UI - I can't understand why. Could You help please?

@kloodhu
Copy link

kloodhu commented Dec 31, 2022

i have the same problem, but with a gosund strip. hardly a could add to localtuya, but switches are unavailable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants