esphome / esphome-core

🚨 No longer used 🚨 - The C++ framework behind ESPHome
https://esphome.io/
GNU General Public License v3.0
547 stars 115 forks source link

HLW8012 / CSE7759: voltage_divider parameter has no effect #252

Closed R3yn4ld closed 6 years ago

R3yn4ld commented 6 years ago

Operating environment/Installation (Hass.io/Docker/pip/etc.):

Unraid/Docker installation on i686 home server, with separate containers for Home assistant, MQQT, and ESPhomeyaml, all from official repos.

ESP (ESP32/ESP8266/Board/Sonoff):

Sonoff POW R1 v2 (CSE 7759 metering chip instead of HLW8012, shall be supported by Xoze Perez's library)

Affected component:

https://esphomelib.com/esphomeyaml/components/sensor/hlw8012.html

Description of problem: Voltage_diivider parameter has no effect. Can be temporary sorted out by using a multiply filter

Problem-relevant YAML-configuration entries:

sensor:
  - platform: hlw8012
    sel_pin: 5
    cf_pin: 14
    cf1_pin: 13
    #commented to clear logs
    # current:
    #   name: "Courant Lave-linge"
    #   filters:
    voltage:
      name: "Tension Lave-linge"
      filters:
        - multiply: 1.1233
    # power:
    #   name: "Puissance Lave-linge"
    #   filters:
    update_interval: 5s
    voltage_divider: 3000 #has no effect (original 2351)
    current_resistor: 0.001

Traceback (if applicable):

[15:58:48][C][light.mqtt_json:020]: Setting up MQTT light...
[15:58:48][D][mqtt.client:188]: Subscribing to topic='lave_linge/light/connexion_lave-linge/command' qos=0 with JSON...
[15:58:51][D][sensor.hlw8012:058]: Got power=2.1W, voltage=161.7V
[15:58:51][D][sensor.mqtt:080]: 'Tension Lave-linge': Pushing out value 181.680649 with 1 decimals of accuracy
[15:58:56][D][sensor.hlw8012:058]: Got power=0.0W, voltage=205.7V
[15:58:56][D][sensor.mqtt:080]: 'Tension Lave-linge': Pushing out value 231.071350 with 1 decimals of accuracy
[15:59:02][D][sensor.hlw8012:058]: Got power=0.0W, voltage=206.0V
[15:59:02][D][sensor.mqtt:080]: 'Tension Lave-linge': Pushing out value 231.346771 with 1 decimals of accuracy
[15:59:07][D][sensor.hlw8012:058]: Got power=2.1W, voltage=206.0V
[15:59:07][D][sensor.mqtt:080]: 'Tension Lave-linge': Pushing out value 231.438583 with 1 decimals of accuracy
[15:59:11][D][sensor.hlw8012:058]: Got power=0.0W, voltage=205.5V
[15:59:12][D][sensor.mqtt:080]: 'Tension Lave-linge': Pushing out value 230.887741 with 1 decimals of accuracy
[15:59:16][D][sensor.hlw8012:058]: Got power=0.0W, voltage=206.4V
[15:59:17][D][sensor.mqtt:080]: 'Tension Lave-linge': Pushing out value 231.805786 with 1 decimals of accuracy
[15:59:22][D][sensor.hlw8012:058]: Got power=2.1W, voltage=206.4V
[15:59:22][D][sensor.mqtt:080]: 'Tension Lave-linge': Pushing out value 231.897598 with 1 decimals of accuracy
[15:59:26][D][sensor.hlw8012:058]: Got power=0.0W, voltage=206.3V
[15:59:27][D][sensor.mqtt:080]: 'Tension Lave-linge': Pushing out value 231.713974 with 1 decimals of accuracy

Additional information: I have not played with current_resistor parameter yet to check if it has the same behavior.

R3yn4ld commented 6 years ago

Hello, this working perfectly since a couple of days now (dev branch).

Thanks @OttoWinter