Closed alvarea closed 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.
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"
I think this is critical. I have many such devices and they control the heating.
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
removed the sensor cse7766 settings. Let's see what will happen.
@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.
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?
I connected the device through USB. In the terminal I get a set of characters. 220 off
I'll be back when there will be a stable job.
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)?
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.
@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.
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,
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.
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
....
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?
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!
This has been fixed in v1.11.0 👍 @OttoWinter I guess it can be closed?
Yes 👍
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.-
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:
Traceback (if applicable):
Additional information: