add test2 (sensor testor)

This commit is contained in:
2025-04-06 10:25:12 +00:00
parent f4bfea74dc
commit ca81719305

176
esptest2.yaml Normal file
View File

@@ -0,0 +1,176 @@
esphome:
name: esptest2
platform: ESP32
board: esp-wrover-kit
logger:
api:
password: !secret api_secret
ota:
platform: esphome
password: !secret ota_key
wifi:
ssid: !secret wireless_ssid
password: !secret wireless_key
domain: !secret wireless_domain
ap:
ssid: "ESPtest2_Fallback"
password: !secret ap_secret
captive_portal:
web_server:
port: 80
time:
- platform: sntp
id: sntp_time
servers:
- 193.190.198.10
# timezone: "Europe/Brussels"
on_time_sync:
then:
- logger.log: "NTP : Synchronized sntp clock"
mqtt:
broker: domotic.home.cabestan.be
username: espsalon
password: !secret mqtt_espsalon
i2c:
sda: 21
scl: 22
scan: true
frequency: 300kHz
id: bus_a
font:
- file: "fonts/Roboto/Roboto-Black.ttf"
id: my_font_16
size: 16
- file: "fonts/Roboto/Roboto-Black.ttf"
id: my_font_14
size: 14
- file: "fonts/materialdesignicons-webfont.ttf"
id: icons_14
size: 14
glyphs:
- "\U000F050F" # mdi-home-thermometer
- "\U000F058E" # mdi-water-percent
- "\U000F015F" # mdi-cloud
- "\U000F1252" # mdi-home-lightbulb-outline
- "\U000F0A60" # mdi-ip-network
globals:
- id: global_32
type: int
restore_value: no
initial_value: '0'
- id: global_33
type: int
restore_value: no
initial_value: '0'
- id: global_25
type: int
restore_value: no
initial_value: '0'
- id: global_26
type: int
restore_value: no
initial_value: '0'
- id: global_27
type: int
restore_value: no
initial_value: '0'
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
external_vcc: False
id: saloon_display
rotation: 90
# lambda: |-
# it.print(0, 0, id(my_font_16), "Hello World!");
pages:
- id: page1
lambda: |-
it.strftime( 32, 0, id(my_font_16), TextAlign::TOP_CENTER , "%H:%M:%S" , id(sntp_time).now() );
it.printf( 0, 25, id(my_font_14), TextAlign::TOP_LEFT , "v1:");
it.printf( 32, 25, id(my_font_14), TextAlign::TOP_LEFT , "%d" , id(binary_32).state );
it.printf( 0, 45, id(my_font_14), TextAlign::TOP_LEFT , "v2:");
it.printf( 32, 45, id(my_font_14), TextAlign::TOP_LEFT , "%d" , id(binary_33).state );
it.printf( 0, 65, id(my_font_14), TextAlign::TOP_LEFT , "v3:");
it.printf( 32, 65, id(my_font_14), TextAlign::TOP_LEFT , "%d" , id(binary_25).state );
it.printf( 0, 85, id(my_font_14), TextAlign::TOP_LEFT , "v4:");
it.printf( 32, 85, id(my_font_14), TextAlign::TOP_LEFT , "%d" , id(binary_26).state );
it.printf( 0, 105, id(my_font_14), TextAlign::TOP_LEFT , "v5");
it.printf( 32, 105, id(my_font_14), TextAlign::TOP_LEFT , "%d" , id(binary_27).state );
# it.printf( 18, 105, id(my_font_14), TextAlign::TOP_LEFT , "%s" , id(nw_connected).state );
sensor:
- platform: esp32_hall
name: "ESP32 Hall Sensor"
update_interval: 3s
- platform: adc
pin: GPIO36
name: analog hall sensor
update_interval: 3s
binary_sensor:
- platform: gpio
pin:
number: 32
inverted: true
mode:
input: true
pullup: true
name: "binary_32"
id: binary_32
- platform: gpio
pin:
number: 33
inverted: true
mode:
input: true
pullup: true
name: "binary_33"
id: binary_33
- platform: gpio
pin:
number: 25
inverted: true
mode:
input: true
pullup: true
name: "binary_25"
id: binary_25
- platform: gpio
pin:
number: 26
inverted: true
mode:
input: true
pullup: true
name: "binary_26"
id: binary_26
- platform: gpio
pin:
number: 27
inverted: true
mode:
input: true
pullup: true
name: "binary_27"
id: binary_27