Description
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: