esphome / issues

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

Esphome not togging switch #3613

Open luccaVeira opened 2 years ago

luccaVeira commented 2 years ago

The problem

As we can see in the logs, when I press the nextion screen button once it toggles the home assistant relay to on printing [D][nextion:436]: Got touch page=0 component=4 type=PRESS [12:33:23][D][binary_sensor:036]: 'esphass': Sending state ON , but when I press again, esphome prints the log [D][nextion:436]: Got touch page=0 component= 4 type=PRESS and n executes the toggle

Which version of ESPHome has the issue?

2022.9.1

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2022.9.6

What platform are you using?

ESP8266

Board

nodemcu lolin v3

Component causing the issue

binary_sensor

Example YAML snippet

esphome:
  name: teste

esp8266:
  board: nodemcuv3

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:
  encryption:
    key: ""

ota:
  password: ""

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "ESP8266 Wifi"
    password: "esp12345"

captive_portal:

uart:
  rx_pin: D1
  tx_pin: D2
  baud_rate: 115200

sensor:
  - platform: homeassistant
    id: smart_energy_meter
    entity_id: sensor.smart_energy_meter_at4p_phase_a_voltage

binary_sensor:
  - platform: nextion
    page_id: 0
    component_id: 4
    id: b0
    name: esphass
    filters:
      - delayed_on_off: 30ms
    on_press:
      then:
        - homeassistant.service:
            service: switch.toggle
            data:
              entity_id: switch.interruptor_quarto_switch_2

display:
  - platform: nextion
    id: nextion1
    update_interval: 5s
    lambda: |-
      it.set_component_text_printf( "t0", "Voltagem: %.2fV", id(smart_energy_meter).state);

Anything in the logs that might be useful for us?

INFO Reading configuration /config/esphome/teste.yaml...
INFO Starting log output from teste.local using esphome API
INFO Successfully connected to teste.local
[12:54:44][I][app:102]: ESPHome version 2022.9.1 compiled on Sep 24 2022, 12:50:41
[12:54:44][C][wifi:502]: WiFi:
[12:54:44][C][wifi:360]:   Local MAC: 84:CC:A8:81:74:80
[12:54:44][C][wifi:361]:   SSID: [redacted]
[12:54:44][C][wifi:362]:   IP Address: 10.0.0.110
[12:54:44][C][wifi:363]:   BSSID: [redacted]
[12:54:44][C][wifi:365]:   Hostname: 'teste'
[12:54:44][C][wifi:367]:   Signal strength: -62 dB ▂▄▆█
[12:54:44][C][wifi:371]:   Channel: 8
[12:54:44][C][wifi:372]:   Subnet: 255.255.255.0
[12:54:44][C][wifi:373]:   Gateway: 10.0.0.1
[12:54:44][C][wifi:374]:   DNS1: 45.70.28.35
[12:54:44][C][wifi:375]:   DNS2: 8.8.8.8
[12:54:44][C][logger:275]: Logger:
[12:54:44][C][logger:276]:   Level: DEBUG
[12:54:44][C][logger:277]:   Log Baud Rate: 0
[12:54:44][C][logger:278]:   Hardware UART: UART0
[12:54:44][C][uart.arduino_esp8266:102]: UART Bus:
[12:54:44][C][uart.arduino_esp8266:103]:   TX Pin: GPIO4
[12:54:44][C][uart.arduino_esp8266:104]:   RX Pin: GPIO5
[12:54:44][C][uart.arduino_esp8266:106]:   RX Buffer Size: 256
[12:54:44][C][uart.arduino_esp8266:108]:   Baud Rate: 115200 baud
[12:54:44][C][uart.arduino_esp8266:109]:   Data Bits: 8
[12:54:44][C][uart.arduino_esp8266:110]:   Parity: NONE
[12:54:44][C][uart.arduino_esp8266:111]:   Stop bits: 1
[12:54:44][C][uart.arduino_esp8266:115]:   Using software serial
[12:54:44][C][nextion:117]: Nextion:
[12:54:44][C][nextion:118]:   Device Model:     NX8048K050_011R
[12:54:44][C][nextion:119]:   Firmware Version: 163
[12:54:44][C][nextion:120]:   Serial Number:    DB605428A3165234
[12:54:44][C][nextion:121]:   Flash Size:       33554432
[12:54:44][C][nextion:122]:   Wake On Touch:    True
[12:54:44][C][captive_portal:088]: Captive Portal:
[12:54:44][C][mdns:094]: mDNS:
[12:54:44][C][mdns:095]:   Hostname: teste
[12:54:44][C][ota:089]: Over-The-Air Updates:
[12:54:44][C][ota:090]:   Address: teste.local:8266
[12:54:44][C][ota:093]:   Using Password.
[12:54:44][C][api:138]: API Server:
[12:54:44][C][api:139]:   Address: teste.local:6053
[12:54:44][C][api:141]:   Using noise encryption: YES
[12:54:44][C][homeassistant.sensor:030]: Homeassistant Sensor 'smart_energy_meter'
[12:54:44][C][homeassistant.sensor:030]:   State Class: ''
[12:54:44][C][homeassistant.sensor:030]:   Unit of Measurement: ''
[12:54:44][C][homeassistant.sensor:030]:   Accuracy Decimals: 1
[12:54:44][C][homeassistant.sensor:031]:   Entity ID: 'sensor.smart_energy_meter_at4p_phase_a_voltage'
[12:54:44][D][homeassistant.sensor:024]: 'sensor.smart_energy_meter_at4p_phase_a_voltage': Got state 124.30
[12:54:44][D][sensor:126]: 'smart_energy_meter': Sending state 124.30000  with 1 decimals of accuracy
[12:54:49][D][homeassistant.sensor:024]: 'sensor.smart_energy_meter_at4p_phase_a_voltage': Got state 123.70
[12:54:49][D][sensor:126]: 'smart_energy_meter': Sending state 123.70000  with 1 decimals of accuracy
[12:54:52][D][nextion:436]: Got touch page=0 component=4 type=PRESS
[12:54:52][D][binary_sensor:036]: 'esphass': Sending state ON
[12:55:05][D][nextion:436]: Got touch page=0 component=4 type=PRES
[12:55:10][D][nextion:436]: Got touch page=0 component=4 type=PRES

Additional information

No response

tricoveri commented 1 year ago

same boat here. The home assistant service works in my case, i just tried firing it using time instead of the binary sensor and the toggling happens, what I haven't been able to figure out so far is the binary sensor.