Hello everyone. I’m having a weird problem. At first I thought it could be hardware but testing the switches from HA I realized that it was not reflected in the esphome log. I just added some ids to the switches and after compiling they stopped working.
I have an esp32 connected to an 8 relay board.
I share the code in case you see any errors that you are not seeing. Thank you so much
esphome:
name: meteo
esp32:
board: esp32dev
framework:
type: arduino
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "meteo_ap"
password: !secret wifi_password
api:
logger:
#level: VERBOSE
ota:
password: "xxxxxxxxxxxxxxxxx"
captive_portal:
dashboard_import:
package_import_url: github://esphome/bluetooth-proxies/esp32-generic.yaml@main
esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true
bluetooth_proxy:
active: true
button:
- platform: safe_mode
name: Safe Mode Boot
entity_category: diagnostic
dallas:
- pin: GPIO23
globals:
- id: temp_max
type: float
restore_value: yes
initial_value: '28.5'
- id: temp_min
type: float
restore_value: yes
initial_value: '28.3'
number:
- platform: template
name: "Set max temp"
id: temp_max_set
optimistic: true
min_value: 28.0
max_value: 29.0
step: 0.1
on_value:
- globals.set:
id: temp_max
value: !lambda 'return id(temp_max_set).state;'
- platform: template
name: "Set min temp"
id: temp_min_set
optimistic: true
min_value: 28.0
max_value: 29.0
step: 0.1
on_value:
- globals.set:
id: temp_min
value: !lambda 'return id(temp_min_set).state;'
binary_sensor:
- platform: template
name: maxs
id: maxs
lambda: |-
if (id(temp).state >= id(temp_max)) {
return true;
} else {
return false;
}
on_state:
if:
condition:
binary_sensor.is_on: maxs
then:
- logger.log: "apaga reles"
- switch.turn_off: relay_2
- switch.turn_off: relay_3
- platform: template
id: mins
name: mins
lambda: |-
if (id(temp).state <= id(temp_min)) {
return true;
} else {
return false;
}
on_state:
if:
condition:
binary_sensor.is_on: mins
then:
- logger.log: "enciende reles"
- switch.turn_on: relay_2
- switch.turn_on: relay_3
sensor:
- platform: dallas
address: 0x630516b54fc2ff28
name: "Temperatura acuario_principal"
id: temp
filters:
- offset: 1.0
- platform: dht
pin: GPIO33
temperature:
name: "Temperatura Comedor"
humidity:
name: "Humedad Comedor"
update_interval: 60s
- platform: pvvx_mithermometer
mac_address: "A4:C1:38:7B:D2:35"
temperature:
name: "Temperatura cuarto principal"
accuracy_decimals: 1
humidity:
name: "Humedad cuarto principal"
accuracy_decimals: 0
battery_level:
name: "Nivel de Bateria cuarto principal"
switch:
- platform: gpio
name: "Luz sump"
id: "relay_1"
pin: GPIO27
inverted: true
restore_mode: ALWAYS_OFF
- platform: gpio
name: "Calefactor 1"
id: relay_2
pin: GPIO26
inverted: true
restore_mode: ALWAYS_OFF
- platform: gpio
name: "Calefactor 2"
id: relay_3
pin: GPIO25
inverted: true
restore_mode: ALWAYS_OFF
- platform: gpio
name: "Relay 4"
id: "relay_4"
pin: GPIO5
inverted: true
restore_mode: ALWAYS_OFF
- platform: gpio
name: "Bomba retorno"
id: "relay_5"
pin: GPIO18
inverted: true
restore_mode: ALWAYS_OFF
- platform: gpio
name: "Bomba mezclado"
id: "relay_6"
pin: GPIO19
inverted: true
restore_mode: ALWAYS_OFF
- platform: gpio
name: "Relay 7"
pin: GPIO21
inverted: true
restore_mode: ALWAYS_OFF
- platform: gpio
name: "Luz acuario"
#id: relay_8
pin: GPIO22
inverted: true
restore_mode: RESTORE_DEFAULT_OFF