esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 34 forks source link

Sonoff POW R2 continuous restarts after adding power sensor cse7766 #1

Closed alvarea closed 5 years ago

alvarea commented 5 years ago

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

ESP (ESP32/ESP8266/Board/Sonoff): Sonoff POW R2

Affected component: https://esphomelib.com/esphomeyaml/components/sensor/cse7766.html

Description of problem: Hi, I have a sonoff POW R2 flashed with ESPhome 1.10.1 and connected to HA using API. It's working properly if I don't add any code of the CSE7766 Power Sensor. When I add the configuration entries described in the sensor chapter of ESPhomelib documentation, the sonoff starts disconnecting from API and restarting the switch. If I remove the power sensor entries of the configuration and I flash it again, the behavior is normal and it remains connected during the whole day.

Problem-relevant YAML-configuration entries:

sphomeyaml:
  name: esphome_pow_sw2
  platform: ESP8266
  board: esp01_1m
  board_flash_mode: dout

wifi:
  ssid: 'xxx'
  password: 'xxx'
  manual_ip:
    static_ip: 192.168.0.23
    gateway: 192.168.0.1
    subnet: 255.255.255.0

api:

ota:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "esphome pow sw2 boton"
  - platform: status
    name: "esphome pow sw2 status"

switch:
  - platform: gpio
    name: "esphome pow sw2"
    pin: GPIO12

output:
  # Register the green LED as a dimmable output ....
  - platform: esp8266_pwm
    id: pow_sw2_green_led
    pin:
      number: GPIO13
      inverted: True

light:
  # ... and then make a light out of it.
  - platform: monochromatic
    name: "esphome pow sw2 led"
    output: pow_sw2_green_led

# Example configuration entry
# Disable logging over USB
logger:
  baud_rate: 0

uart:
  rx_pin: RX
  baud_rate: 4800

sensor:
  - platform: cse7766
    current:
      name: "Sonoff Pow R2 Current"
    voltage:
      name: "Sonoff Pow R2 Voltage"
    power:
      name: "Sonoff Pow R2 Power"

Traceback (if applicable):

INFO Successfully compiled program.
INFO Connecting to 192.168.0.37
INFO Uploading esphome_pow_sw2/.pioenvs/esphome_pow_sw2/firmware.bin (383024 bytes)
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.0.37 using esphomelib API
INFO Connecting to 192.168.0.37:6053 (192.168.0.37)
WARNING Couldn't connect to API (Error connecting to 192.168.0.37: timed out). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.0.37:6053 (192.168.0.37)
INFO Successfully connected to 192.168.0.37
[22:43:31][I][application:097]: You're running esphomelib v1.10.1 compiled on Jan 24 2019, 22:40:56
[22:43:31][C][wifi:341]: WiFi:
[22:43:31][C][wifi:240]:   SSID: 'TC.alvarea.net'
[22:43:31][C][wifi:241]:   IP Address: 192.168.0.37
[22:43:31][C][wifi:243]:   BSSID: 20:C9:D0:26:43:55
[22:43:31][C][wifi:245]:   Hostname: 'esphome_pow_sw2'
[22:43:31][C][wifi:250]:   Signal strength: -50 dB ▂▄▆█
[22:43:31][C][wifi:251]:   Channel: 13
[22:43:31][C][wifi:252]:   Subnet: 255.255.255.0
[22:43:31][C][wifi:253]:   Gateway: 192.168.0.1
[22:43:31][C][wifi:254]:   DNS1: 0.0.0.0
[22:43:31][C][wifi:255]:   DNS2: 0.0.0.0
[22:43:31][C][uart:130]: UART Bus:
[22:43:31][C][uart:131]:   TX Pin: GPIO-1
[22:43:31][C][uart:132]:   RX Pin: GPIO3
[22:43:31][C][uart:133]:   Baud Rate: 4800 baud
[22:43:31][C][uart:137]:   Using software serial
[22:43:31][C][binary_sensor.status:046]: Status Binary Sensor 'esphome pow sw2 status'
[22:43:31][C][binary_sensor.status:046]:   Device Class: 'connectivity'
[22:43:31][C][binary_sensor.gpio:023]: GPIO Binary Sensor 'esphome pow sw2 boton'
[22:43:31][C][binary_sensor.gpio:024]:   Pin: GPIO0 (Mode: INPUT_PULLUP, INVERTED)
[22:43:31][C][switch.gpio:049]: GPIO Switch 'esphome pow sw2'
[22:43:31][C][switch.gpio:050]:   Pin: GPIO12 (Mode: OUTPUT)
[22:43:31][C][switch.gpio:066]:   Restore Mode: Restore (Default to OFF)
[22:43:31][C][output.esp8266_pwm:028]: ESP8266 PWM:
[22:43:31][C][output.esp8266_pwm:029]:   Pin: GPIO13 (Mode: OUTPUT, INVERTED)
[22:43:31][C][output.esp8266_pwm:030]:   Frequency: 1000.0 Hz
[22:43:31][C][logger:099]: Logger:
[22:43:31][C][logger:100]:   Level: DEBUG
[22:43:31][C][logger:101]:   Log Baud Rate: 0
[22:43:31][C][light.state:266]: Light 'esphome pow sw2 led'
[22:43:31][C][light.state:268]:   Default Transition Length: 1000 ms
[22:43:31][C][light.state:269]:   Gamma Correct: 2.80
[22:43:31][C][sensor.cse7766:182]: CSE7766:
[22:43:31][C][sensor.cse7766:183]:   Update Interval: 60000 ms
[22:43:31][C][sensor.cse7766:184]:   Voltage 'Sonoff Pow R2 Voltage'
[22:43:31][C][sensor.cse7766:184]:     Unit of Measurement: 'V'
[22:43:31][C][sensor.cse7766:184]:     Accuracy Decimals: 1
[22:43:31][C][sensor.cse7766:184]:     Icon: 'mdi:flash'
[22:43:31][C][sensor.cse7766:185]:   Current 'Sonoff Pow R2 Current'
[22:43:31][C][sensor.cse7766:185]:     Unit of Measurement: 'A'
[22:43:31](Message skipped because it was too big to fit in TCP buffer - This is only cosmetic)
[22:43:31][C][sensor.cse7766:185]:     Icon: 'mdi:flash'
[22:43:31][C][sensor.cse7766:186]:   Power 'Sonoff Pow R2 Power'
[22:43:31][C][sensor.cse7766:186]:     Unit of Measurement: 'W'
[22:43:31][C][sensor.cse7766:186]:     Accuracy Decimals: 1
[22:43:31][C][sensor.cse7766:186]:     Icon: 'mdi:flash'
[22:43:31][C][api:072]: API Server:
[22:43:31][C][api:073]:   Address: 192.168.0.37:6053
[22:43:31][C][ota:129]: Over-The-Air Updates:
[22:43:31][C][ota:130]:   Address: 192.168.0.37:8266
[22:43:35][D][api:531]: Client 'Home Assistant 0.85.1 (192.168.0.23)' connected successfully!
[22:43:35][D][api:531]: Client 'Home Assistant 0.85.1 (192.168.0.23)' connected successfully!
[22:43:35][D][api:241]: '192.168.0.23' disconnected.
[22:43:35][D][api:241]: '192.168.0.23' disconnected.
[22:43:58][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:44:31][D][switch:037]: 'esphome pow sw2' Turning OFF.
[22:44:31][D][switch:055]: 'esphome pow sw2': Sending state OFF
[22:44:34][D][switch:033]: 'esphome pow sw2' Turning ON.
[22:44:34][D][switch:055]: 'esphome pow sw2': Sending state ON
[22:44:58][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:45:23][I][ota:154]: Boot seems successful, resetting boot loop counter.
[22:45:58][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:46:58][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:47:58][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
WARNING Disconnected from API.
INFO Connecting to 192.168.0.37:6053 (192.168.0.37)
WARNING Couldn't connect to API (Error connecting to 192.168.0.37: timed out). Trying to reconnect in 1 seconds
WARNING Disconnected from API.
INFO Connecting to 192.168.0.37:6053 (192.168.0.37)
INFO Successfully connected to 192.168.0.37
[22:48:23][D][api:531]: Client 'Home Assistant 0.85.1 (192.168.0.23)' connected successfully!
[22:48:24][D][api:531]: Client 'Home Assistant 0.85.1 (192.168.0.23)' connected successfully!
[22:48:24][D][api:241]: '192.168.0.23' disconnected.
[22:48:24][D][api:241]: '192.168.0.23' disconnected.
[22:48:57][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:49:57][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:50:10][I][ota:154]: Boot seems successful, resetting boot loop counter.
WARNING Disconnected from API.
INFO Connecting to 192.168.0.37:6053 (192.168.0.37)
WARNING Couldn't connect to API (Error connecting to 192.168.0.37: timed out). Trying to reconnect in 1 seconds
WARNING Disconnected from API.
INFO Connecting to 192.168.0.37:6053 (192.168.0.37)
INFO Successfully connected to 192.168.0.37
[22:50:47][D][api:531]: Client 'Home Assistant 0.85.1 (192.168.0.23)' connected successfully!
[22:50:47][D][api:531]: Client 'Home Assistant 0.85.1 (192.168.0.23)' connected successfully!
[22:51:16][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:52:16][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:52:35][I][ota:154]: Boot seems successful, resetting boot loop counter.
[22:53:16][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:54:16][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:55:16][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:56:16][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:57:16][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:58:16][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[22:59:16][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
WARNING Disconnected from API.
INFO Connecting to 192.168.0.37:6053 (192.168.0.37)
Exception in thread Thread-1836:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 1073, in run
    self.function(*self.args, **self.kwargs)
  File "/home/homeassistant/venv/local/lib/python2.7/site-packages/esphomeyaml/api/client.py", line 136, in func
    self._fatal_error()
  File "/home/homeassistant/venv/local/lib/python2.7/site-packages/esphomeyaml/api/client.py", line 242, in _fatal_error
    self.on_disconnect()
  File "/home/homeassistant/venv/local/lib/python2.7/site-packages/esphomeyaml/api/client.py", line 444, in try_connect
    cli.connect()
  File "/home/homeassistant/venv/local/lib/python2.7/site-packages/esphomeyaml/api/client.py", line 198, in connect
    self._socket.settimeout(0.1)
AttributeError: 'NoneType' object has no attribute 'settimeout'

Additional information:

OttoWinter commented 5 years ago

"AttributeError: 'NoneType' object has no attribute 'settimeout'" is not the real issue here, it's just an issue in esphomeyaml, which does not impact the ESP itself - only viewing the logs.

For the disconnects, please provide USB logs, connection/crash issues are (obviously) not debuggable remotely.

novikovav69 commented 5 years ago

I have a similar problem. at first it clicks. Then the connection falls off. The device hangs, the button stops working. What you need to send and how to get it? Tasmota was stable.

esphomeyaml:
  name: tt
  platform: ESP8266
  board: esp01_1m
  arduino_version: latest

wifi:
  ssid: 'Aurelia2_4'
  password: '****'
  power_save_mode: light
  fast_connect: true
  manual_ip:
    static_ip: 192.168.100.44
    gateway: 192.168.100.1
    subnet: 255.255.255.0

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:
  password: '****'

ota:
  password: '****'

switch:
  - platform: gpio
    pin: GPIO12
    name: "Living Room Torsher"
    id: relay

uart:
  rx_pin: RX
  baud_rate: 4800

sensor:
  - platform: total_daily_energy
    name: "Total Daily Energy"
    power_id: my_power
  - platform: cse7766
    current:
      name: "Sonoff Pow R2 Current"
    voltage:
      name: "Sonoff Pow R2 Voltage"
    power:
      name: "Sonoff Pow R2 Power"
      id: my_power
      filters:
        # Multiplication factor from W to kW is 0.001
        - multiply: 0.001
      unit_of_measurement: kW

time:
  - platform: sntp
    id: my_time

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Sonoff Basic Button"
    on_press:
      - switch.toggle: relay
  - platform: status
    name: "Sonoff S20 Status"
novikovav69 commented 5 years ago

I think this is critical. I have many such devices and they control the heating.

novikovav69 commented 5 years ago

INFO Reading configuration... INFO Detected timezone 'MSK' with UTC offset 3 INFO Starting log output from 192.168.100.44 using esphomelib API INFO Connecting to 192.168.100.44:6053 (192.168.100.44) WARNING Couldn't connect to API (Error connecting to 192.168.100.44: [Errno 113] No route to host). Trying to reconnect in 1 seconds INFO Connecting to 192.168.100.44:6053 (192.168.100.44) WARNING Couldn't connect to API (Error connecting to 192.168.100.44: [Errno 113] No route to host). Trying to reconnect in 2 seconds INFO Connecting to 192.168.100.44:6053 (192.168.100.44) WARNING Couldn't connect to API (Error connecting to 192.168.100.44: [Errno 113] No route to host). Trying to reconnect in 4 seconds INFO Connecting to 192.168.100.44:6053 (192.168.100.44) WARNING Couldn't connect to API (Error connecting to 192.168.100.44: [Errno 113] No route to host). Trying to reconnect in 8 seconds INFO Connecting to 192.168.100.44:6053 (192.168.100.44) WARNING Couldn't connect to API (Error connecting to 192.168.100.44: [Errno 113] No route to host). Trying to reconnect in 16 seconds

novikovav69 commented 5 years ago

removed the sensor cse7766 settings. Let's see what will happen.

brandond commented 5 years ago

@novikovav69 as mentioned above, you need to pull logs via USB, not API or MQTT. If it's crashing and/or not connecting to the network, you obviously can't use the network to collect the logs necessary to debug the issue.

novikovav69 commented 5 years ago

I am not a very good specialist in this area. How to pull logs via USB? Does it have to be powered? Or logs are stored on the device like file?

novikovav69 commented 5 years ago

I connected the device through USB. In the terminal I get a set of characters. 220 off

novikovav69 commented 5 years ago

I'll be back when there will be a stable job.

OttoWinter commented 5 years ago

220 off

???

I connected the device through USB. In the terminal I get a set of characters.

Can you open a serial monitor with baud rate 115200 (also possible through ESPHome addon btw)?

alvarea commented 5 years ago

Hi,

The same here, I need more information to pull the logs out. I'm not using Hassio ESPhome add-on, but hassbian and the esphomeyaml through terminal or dashboard. I connected the sonoff POW through USB to my raspberry, then /dev/ttyUSB0 (FT232R UART) appears on the Dashboard and I updated the firmware once more to add CSE7766 Power Sensor configuration code. Following your instructions I set the logger baud rate = 115200 and updated the firmware:

logger: baud_rate: 115200 Then I use the show logs options on the Dashboard, but I guess I'm doing something wrong since I don't get any logs information, simply nothing happens:

Show Logs esphome_pow_sw2.yaml INFO Reading configuration... INFO Starting log output from /dev/ttyUSB0 with baud rate 115200

Sorry if this a basic question, but I'm not an expert here.

Regards, Agustin.

OttoWinter commented 5 years ago

@alvarea Also remove any uart section you have in your code (and remove CSE7766, it uses the same UART line for the power chip, so you can't have logs and power monitoring at the same time).

The issue you're seeing could be several things. One option would be that the RX/TX cables are swapped.

alvarea commented 5 years ago

Hi Otto,

Thanks a lot for your help. I removed uart and CSE7766 sections and I flashed again. Remember that when I do that, the issue disappear and the POW is always connected with no cuts.

Once removed I connected it to USB and ask for the logs doing that:

(venv) homeassistant@hassbian:~/.homeassistant/config_esphomeyaml $ esphomeyaml esphome_pow_sw2.yaml logs

INFO Reading configuration...
Found multiple options, please choose one:
  [1] /dev/ttyUSB0 (FT232R USB UART)
  [2] Over The Air (192.168.0.37)

(number): 1
INFO Starting log output from /dev/ttyUSB0 with baud rate 115200

However nothing is displayed on the terminal. What am I doing wrong. Thanks!

Regards,

OttoWinter commented 5 years ago

However nothing is displayed on the terminal.

After flashing the ESP is still in flashing mode. You need to unplug the ESP, re-plug the USB cable (this time without holding down any buttons) and then start log output.

alvarea commented 5 years ago

Hello Otto,

I added the uart and cse7766 platform again, then reflashed, restarted and finally I got the logs by USB cable. However, when it is connected by USB cable the issue does not appear and it seems to stay connected for hours.

The issue (continuous disconnections from the network) appears only when these sections are added to the code (uart+cse7766) and the sonoff is connected to the power (220V), with or without any load.

Here you are the logs by USB cable:

(venv) homeassistant@hassbian:~/.homeassistant/config_esphomeyaml $ esphomeyaml esphome_pow_sw2.yaml logs
INFO Reading configuration...
Found multiple options, please choose one:
  [1] /dev/ttyUSB0 (FT232R USB UART)
  [2] Over The Air (192.168.0.37)
(number): 1
INFO Starting log output from /dev/ttyUSB0 with baud rate 115200
[10:30:07][I][wifi:349]: WiFi connected!
    ===> wifi info removed <===
[10:30:07][D][binary_sensor:027]: 'esphome pow sw2 status': Sending state ON
[10:30:07][C][api:023]: Setting up Home Assistant API server...
[10:30:07][C][ota:129]: Over-The-Air Updates:
[10:30:07][C][ota:130]:   Address: **********:8266
[10:30:07][I][application:089]: setup() finished successfully!
[10:30:07][I][application:097]: You're running esphomelib v1.10.1 compiled on Feb  9 2019, 10:28:59
[10:30:07][C][wifi:341]: WiFi:
    ===> wifi info removed <===
[10:30:07][C][uart:130]: UART Bus:
[10:30:07][C][uart:131]:   TX Pin: GPIO-1
[10:30:07][C][uart:132]:   RX Pin: GPIO3
[10:30:07][C][uart:133]:   Baud Rate: 4800 baud
[10:30:07][C][uart:137]:   Using software serial
[10:30:07][C][binary_sensor.status:046]: Status Binary Sensor 'esphome pow sw2 status'
[10:30:07][C][binary_sensor.status:046]:   Device Class: 'connectivity'
[10:30:07][C][binary_sensor.gpio:023]: GPIO Binary Sensor 'esphome pow sw2 boton'
[10:30:07][C][binary_sensor.gpio:024]:   Pin: GPIO0 (Mode: INPUT_PULLUP, INVERTED)
[10:30:07][C][switch.gpio:049]: GPIO Switch 'esphome pow sw2'
[10:30:07][C][switch.gpio:050]:   Pin: GPIO12 (Mode: OUTPUT)
[10:30:07][C][switch.gpio:066]:   Restore Mode: Restore (Default to OFF)
[10:30:07][C][output.esp8266_pwm:028]: ESP8266 PWM:
[10:30:07][C][output.esp8266_pwm:029]:   Pin: GPIO13 (Mode: OUTPUT, INVERTED)
[10:30:07][C][output.esp8266_pwm:030]:   Frequency: 1000.0 Hz
[10:30:07][C][logger:099]: Logger:
[10:30:07][C][logger:100]:   Level: DEBUG
[10:30:07][C][logger:101]:   Log Baud Rate: 115200
[10:30:07][C][light.state:266]: Light 'esphome pow sw2 led'
[10:30:07][C][light.state:268]:   Default Transition Length: 1000 ms
[10:30:07][C][light.state:269]:   Gamma Correct: 2.80
[10:30:07][C][sensor.cse7766:182]: CSE7766:
[10:30:07][C][sensor.cse7766:183]:   Update Interval: 60000 ms
[10:30:07][C][sensor.cse7766:184]:   Voltage 'esphome pow sw2 Voltage'
[10:30:07][C][sensor.cse7766:184]:     Unit of Measurement: 'V'
[10:30:07][C][sensor.cse7766:184]:     Accuracy Decimals: 1
[10:30:07][C][sensor.cse7766:184]:     Icon: 'mdi:flash'
[10:30:07][C][sensor.cse7766:185]:   Current 'esphome pow sw2 Current'
[10:30:07][C][sensor.cse7766:185]:     Unit of Measurement: 'A'
[10:30:07][C][sensor.cse7766:185]:     Accuracy Decimals: 1
[10:30:07][C][sensor.cse7766:185]:     Icon: 'mdi:flash'
[10:30:07][C][sensor.cse7766:186]:   Power 'esphome pow sw2 Power'
[10:30:07][C][sensor.cse7766:186]:     Unit of Measurement: 'W'
[10:30:07][C][sensor.cse7766:186]:     Accuracy Decimals: 1
[10:30:07][C][sensor.cse7766:186]:     Icon: 'mdi:flash'
[10:30:07][C][api:072]: API Server:
[10:30:07][C][api:073]:   Address: 192.168.0.37:6053
[10:30:07][C][ota:129]: Over-The-Air Updates:
[10:30:07][C][ota:130]:   Address: 192.168.0.37:8266
[10:30:07][I][application:114]: Running through first loop()
[10:30:07][I][application:141]: First loop finished successfully!
[10:30:09][D][api:531]: Client 'Home Assistant 0.87.0 (*********)' connected successfully!
[10:30:09][D][api:531]: Client 'Home Assistant 0.87.0 (*********)' connected successfully!
[10:30:38][D][switch:033]: 'esphome pow sw2' Turning ON.
[10:30:38][D][switch:055]: 'esphome pow sw2': Sending state ON
[10:30:42][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[10:31:42][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[10:31:59][I][ota:154]: Boot seems successful, resetting boot loop counter.
[10:32:42][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[10:33:10][D][switch:037]: 'esphome pow sw2' Turning OFF.
[10:33:10][D][switch:055]: 'esphome pow sw2': Sending state OFF
[10:33:42][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[10:34:07][D][switch:033]: 'esphome pow sw2' Turning ON.
[10:34:07][D][switch:055]: 'esphome pow sw2': Sending state ON
[10:34:42][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[10:35:42][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[10:36:42][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[10:37:42][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
...
[10:59:42][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[11:00:42][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
[12:01:42][D][sensor.cse7766:147]: Got voltage=0.0V current=0.0A power=0.0W
....
OttoWinter commented 5 years ago

I have heard that changing the baud_rate setting has something to do with it. Could you try removing the baud_rate: 0 line from your logger config and see if that works?

alvarea commented 5 years ago

Hello,

I'm afraid the issue is still there after removing the baud_rate from logger config. This is what I did, please confirm that it is exactly what you mentioned:

# Disable logging
#logger:
  # baud_rate: 0

uart:
  rx_pin: RX
  baud_rate: 4800

sensor:
  - platform: cse7766
    current:
      name: "esphome pow sw2 Current"
    voltage:
      name: "esphome pow sw2 Voltage"
    power:
      name: "esphome pow sw2 Power"

With that configuration the sensor works and it shows current, voltage and power, however the ESP is restarting constantly in a random way.

Then, I've removed the uart: and sensor: sections again and it has started to work perfectly: no restarts for hours.

Any ideas? Thanks in advance!

frenck commented 5 years ago

This has been fixed in v1.11.0 👍 @OttoWinter I guess it can be closed?

OttoWinter commented 5 years ago

Yes 👍

alvarea commented 5 years ago

Hi Otto,

I've just updated the ESP POW-R2 and it seems to work smoothly. Great job and Thanks a lot!

Regards, Agustín.-