Hi there I have a issue with compiling esphome yaml file
this is my current setup below there error. when I compile I get the error. I want to show pool pump and light is on or off.
thank you kindly guys.
Error.
/config/esphome/pool_controller.yaml: In lambda function:
/config/esphome/pool_controller.yaml:234:23: error: ‘class esphome::gpio::GPIOSwitch’ has no member named ‘has_state’
-
if (id(pool_light).has_state()) {*
-
^*
/config/esphome/pool_controller.yaml:235:85: warning: format ‘%f’ expects argument of type ‘double’, but argument 7 has type ‘int’ [-Wformat=]
-
it.printf(0, 60, id(font3), TextAlign::BASELINE_LEFT , "%.1f°", id(pool_light).state);*
-
^*
/config/esphome/pool_controller.yaml: In lambda function:
/config/esphome/pool_controller.yaml:245:22: error: ‘class esphome::gpio::GPIOSwitch’ has no member named ‘has_state’
-
if (id(pool_pump).has_state()) {*
-
^*
/config/esphome/pool_controller.yaml:246:84: warning: format ‘%f’ expects argument of type ‘double’, but argument 7 has type ‘int’ [-Wformat=]
-
it.printf(0, 60, id(font3), TextAlign::BASELINE_LEFT , "%.1f°", id(pool_pump).state);*
-
^*
My Config
esphome:
name: pool-controller
esp32:
board: esp32dev
framework:
type: arduino
wifi:
ssid: “”
password: “”
manual_ip:
static_ip: 192.168.0.76
gateway: 192.168.0.1
subnet: 255.255.255.0
dns1: 8.8.8.8
dns2: 1.1.1.1
mqtt:
broker: 192.168.0.160
username: Mark
password:
ota:
safe_mode: True
password:
Enable logging
logger:
Enable Home Assistant API
api:
password: ‘mkg661204’
web_server:
port: 80
text_sensor:
-
platform: version
name: “ESPHome Version Pool Controller”
dallas:
-
pin: GPIO13
update_interval: 10s
binary_sensor:
-
platform: gpio
pin:
number: GPIO26
mode: INPUT_PULLUP
inverted: True
name: “Pool Pump”
on_press:
- switch.toggle: pool_pump
-
platform: gpio
pin:
number: GPIO25
mode: INPUT_PULLUP
inverted: True
name: “Pool Light”
on_press:
- switch.toggle: pool_light
switch:
-
platform: gpio
pin: GPIO32
name: “Pool Pump”
id: pool_pump
-
platform: gpio
pin: GPIO33
name: “Pool Light”
id: pool_light
time:
-
platform: sntp
id: sntp_time
servers: 192.168.0.252
…
on_time:
Every morning on weekdays in summertime
-
seconds: 0
minutes: 00
hours: 09
days_of_week: 1,2,3,4,5,6,7
months: 1,2,3,4,10,11,12
then:
-
switch.turn_on: pool_pump
-
delay: 6 hours
-
switch.turn_off: pool_pump
-
Every morning on weekdays in wintertime
-
seconds: 0
minutes: 00
hours: 12
days_of_week: 1,2,3,4,5,6,7
months: 5,6,7,8,9
then:
-
switch.turn_on: pool_pump
-
delay: 60 minutes
-
switch.turn_off: pool_pump
-
-
sensor:
-
platform: wifi_signal
name: “WiFi Signal Pool Pump”
update_interval: 60s
-
platform: uptime
name: Uptime Sensor Pool Pump
-
platform: homeassistant
id: pool_temperature
entity_id: sensor.poolsense_temperature
internal: true
-
platform: dallas
address: 0xe63c67f6497c0628
name: “Pool Inlet Temperature”
id: pool_inlet_temperature
-
platform: dallas
address: 0x233cc1e38167d828
name: “Pool Return Temperature”
id: pool_return_temperature
-
platform: adc
name: “Pool Filter Pressure”
pin: GPIO33
id: pool_filter_pressure
update_interval: 60s
unit_of_measurement: “PSI”
accuracy_decimals: 2
attenuation: 11db
filters:
-
calibrate_linear:
-
0.5 → 0.0
-
2.5 → 30.0
-
-
font:
-
file: ‘arial.ttf’
id: font1
size: 12
-
file: ‘arial.ttf’
id: font2
size: 14
-
file: ‘arial.ttf’
id: font3
size: 16
-
file: ‘arial.ttf’
id: font4
size: 18
-
file: ‘arial.ttf’
id: font5
size: 20
-
file: ‘arial.ttf’
id: font6
size: 24
i2c:
sda: GPIO21
scl: GPIO22
display:
-
platform: ssd1306_i2c
model: “SSD1306 128x64”
address: 0x3C
id: oled1
pages:
-
id: page1
lambda: |-
// Print “Pool Information” in top center.
it.printf(64, 0, id(font3), TextAlign::TOP_CENTER, “Pool Information”);
// Print time in HH:MM:SS format
it.strftime(0, 60, id(font3), TextAlign::BASELINE_LEFT, “%Y-%m-%d %H:%M”, id(sntp_time).now());
-
id: page2
lambda: |-
// Print “Pool Temperature” in top center.
it.printf(64, 0, id(font2), TextAlign::TOP_CENTER, “Pool Temperature”);
// Print Pool Temperature (from homeassistant sensor)
if (id(pool_temperature).has_state()) {
it.printf(40, 60, id(font6), TextAlign::BASELINE_LEFT, “%.1f°”, id(pool_temperature).state);
}
-
id: page3
lambda: |-
// Print “Inlet Temperature” in top center.
it.printf(64, 0, id(font3), TextAlign::TOP_CENTER, “Inlet Temperature”);
// Print Pool Inlet Temperature
if (id(pool_inlet_temperature).has_state()) {
it.printf(40, 60, id(font6), TextAlign::BASELINE_LEFT , “%.1f°”, id(pool_inlet_temperature).state);
}
-
id: page4
lambda: |-
// Print “Return Temperature” in top center.
it.printf(64, 0, id(font2), TextAlign::TOP_CENTER, “Return Temperature”);
// Print Pool Return Temperature
if (id(pool_return_temperature).has_state()) {
it.printf(40, 60, id(font6), TextAlign::BASELINE_LEFT , “%.1f°”, id(pool_return_temperature).state);
}
-
id: page5
lambda: |-
// Print “Filter Pressure” in top center.
it.printf(64, 0, id(font3), TextAlign::TOP_CENTER, “Filter Pressure”);
// Print Pool Pump Pressure
if (id(pool_filter_pressure).has_state()) {
it.printf(40, 60, id(font6), TextAlign::BASELINE_LEFT , “%.1f°”, id(pool_filter_pressure).state);
}
-
id: page6
lambda: |-
// Print “Pool Light” in top center.
it.printf(64, 0, id(font3), TextAlign::TOP_CENTER, “Pool Light”);
// Print Pool Light
if (id(pool_light).has_state()) {
it.printf(0, 60, id(font3), TextAlign::BASELINE_LEFT , “%.1f°”, id(pool_light).state);
}
-
id: page7
lambda: |-
// Print “Pool Pump” in top center.
it.printf(64, 0, id(font3), TextAlign::TOP_CENTER, “Pool Pump”);
// Print Pool Pump
if (id(pool_pump).has_state()) {
it.printf(0, 60, id(font3), TextAlign::BASELINE_LEFT , “%.1f°”, id(pool_pump).state);
}
-
interval:
-
interval: 10s
then:
-
display.page.show_next: oled1
-
component.update: oled1
-