esphome/tests/test4.yaml
Jesse Hills ef832becf1
Create base touchscreen component and refactor ektf2232 (#3083)
Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>
2022-01-26 16:26:46 +13:00

564 lines
15 KiB
YAML

esphome:
name: $devicename
platform: ESP32
board: nodemcu-32s
build_path: build/test4
substitutions:
devicename: test-4
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO25
clk_mode: GPIO0_IN
phy_addr: 0
power_pin: GPIO25
manual_ip:
static_ip: 192.168.178.56
gateway: 192.168.178.1
subnet: 255.255.255.0
domain: .local
api:
i2c:
sda: 21
scl: 22
scan: False
spi:
clk_pin: GPIO21
mosi_pin: GPIO22
miso_pin: GPIO23
uart:
tx_pin: GPIO22
rx_pin: GPIO23
baud_rate: 115200
ota:
safe_mode: True
port: 3286
logger:
level: DEBUG
web_server:
ota: false
auth:
username: admin
password: admin
include_internal: true
time:
- platform: sntp
id: sntp_time
tuya:
time_id: sntp_time
pipsolar:
id: inverter0
sx1509:
- id: sx1509_hub
address: 0x3E
mcp3204:
cs_pin: GPIO23
sensor:
- platform: homeassistant
entity_id: sensor.hello_world
id: ha_hello_world
- platform: tuya
id: tuya_sensor
sensor_datapoint: 1
- platform: pipsolar
pipsolar_id: inverter0
grid_rating_voltage:
id: inverter0_grid_rating_voltage
name: inverter0_grid_rating_voltage
grid_rating_current:
id: inverter0_grid_rating_current
name: inverter0_grid_rating_current
ac_output_rating_voltage:
id: inverter0_ac_output_rating_voltage
name: inverter0_ac_output_rating_voltage
ac_output_rating_frequency:
id: inverter0_ac_output_rating_frequency
name: inverter0_ac_output_rating_frequency
ac_output_rating_current:
id: inverter0_ac_output_rating_current
name: inverter0_ac_output_rating_current
ac_output_rating_apparent_power:
id: inverter0_ac_output_rating_apparent_power
name: inverter0_ac_output_rating_apparent_power
ac_output_rating_active_power:
id: inverter0_ac_output_rating_active_power
name: inverter0_ac_output_rating_active_power
battery_rating_voltage:
id: inverter0_battery_rating_voltage
name: inverter0_battery_rating_voltage
battery_recharge_voltage:
id: inverter0_battery_recharge_voltage
name: inverter0_battery_recharge_voltage
battery_under_voltage:
id: inverter0_battery_under_voltage
name: inverter0_battery_under_voltage
battery_bulk_voltage:
id: inverter0_battery_bulk_voltage
name: inverter0_battery_bulk_voltage
battery_float_voltage:
id: inverter0_battery_float_voltage
name: inverter0_battery_float_voltage
battery_type:
id: inverter0_battery_type
name: inverter0_battery_type
current_max_ac_charging_current:
id: inverter0_current_max_ac_charging_current
name: inverter0_current_max_ac_charging_current
current_max_charging_current:
id: inverter0_current_max_charging_current
name: inverter0_current_max_charging_current
input_voltage_range:
id: inverter0_input_voltage_range
name: inverter0_input_voltage_range
output_source_priority:
id: inverter0_output_source_priority
name: inverter0_output_source_priority
charger_source_priority:
id: inverter0_charger_source_priority
name: inverter0_charger_source_priority
parallel_max_num:
id: inverter0_parallel_max_num
name: inverter0_parallel_max_num
machine_type:
id: inverter0_machine_type
name: inverter0_machine_type
topology:
id: inverter0_topology
name: inverter0_topology
output_mode:
id: inverter0_output_mode
name: inverter0_output_mode
battery_redischarge_voltage:
id: inverter0_battery_redischarge_voltage
name: inverter0_battery_redischarge_voltage
pv_ok_condition_for_parallel:
id: inverter0_pv_ok_condition_for_parallel
name: inverter0_pv_ok_condition_for_parallel
pv_power_balance:
id: inverter0_pv_power_balance
name: inverter0_pv_power_balance
grid_voltage:
id: inverter0_grid_voltage
name: inverter0_grid_voltage
grid_frequency:
id: inverter0_grid_frequency
name: inverter0_grid_frequency
ac_output_voltage:
id: inverter0_ac_output_voltage
name: inverter0_ac_output_voltage
ac_output_frequency:
id: inverter0_ac_output_frequency
name: inverter0_ac_output_frequency
ac_output_apparent_power:
id: inverter0_ac_output_apparent_power
name: inverter0_ac_output_apparent_power
ac_output_active_power:
id: inverter0_ac_output_active_power
name: inverter0_ac_output_active_power
output_load_percent:
id: inverter0_output_load_percent
name: inverter0_output_load_percent
bus_voltage:
id: inverter0_bus_voltage
name: inverter0_bus_voltage
battery_voltage:
id: inverter0_battery_voltage
name: inverter0_battery_voltage
battery_charging_current:
id: inverter0_battery_charging_current
name: inverter0_battery_charging_current
battery_capacity_percent:
id: inverter0_battery_capacity_percent
name: inverter0_battery_capacity_percent
inverter_heat_sink_temperature:
id: inverter0_inverter_heat_sink_temperature
name: inverter0_inverter_heat_sink_temperature
pv_input_current_for_battery:
id: inverter0_pv_input_current_for_battery
name: inverter0_pv_input_current_for_battery
pv_input_voltage:
id: inverter0_pv_input_voltage
name: inverter0_pv_input_voltage
battery_voltage_scc:
id: inverter0_battery_voltage_scc
name: inverter0_battery_voltage_scc
battery_discharge_current:
id: inverter0_battery_discharge_current
name: inverter0_battery_discharge_current
battery_voltage_offset_for_fans_on:
id: inverter0_battery_voltage_offset_for_fans_on
name: inverter0_battery_voltage_offset_for_fans_on
eeprom_version:
id: inverter0_eeprom_version
name: inverter0_eeprom_version
pv_charging_power:
id: inverter0_pv_charging_power
name: inverter0_pv_charging_power
- platform: "hrxl_maxsonar_wr"
name: "Rainwater Tank Level"
filters:
- sliding_window_moving_average:
window_size: 12
send_every: 12
- or:
- throttle: "20min"
- delta: 0.02
- platform: mcp3204
name: "MCP3204 Pin 1"
number: 1
#
# platform sensor.apds9960 requires component apds9960
#
# - platform: apds9960
# type: proximity
# name: APDS9960 Proximity
# - platform: apds9960
# type: clear
# name: APDS9960 Clear
# - platform: apds9960
# type: red
# name: APDS9960 Red
# - platform: apds9960
# type: green
# name: APDS9960 Green
# - platform: apds9960
# type: blue
# name: APDS9960 Blue
binary_sensor:
- platform: tuya
id: tuya_binary_sensor
sensor_datapoint: 1
- platform: pipsolar
pipsolar_id: inverter0
add_sbu_priority_version:
id: inverter0_add_sbu_priority_version
name: inverter0_add_sbu_priority_version
configuration_status:
id: inverter0_configuration_status
name: inverter0_configuration_status
scc_firmware_version:
id: inverter0_scc_firmware_version
name: inverter0_scc_firmware_version
load_status:
id: inverter0_load_status
name: inverter0_load_status
battery_voltage_to_steady_while_charging:
id: inverter0_battery_voltage_to_steady_while_charging
name: inverter0_battery_voltage_to_steady_while_charging
charging_status:
id: inverter0_charging_status
name: inverter0_charging_status
scc_charging_status:
id: inverter0_scc_charging_status
name: inverter0_scc_charging_status
ac_charging_status:
id: inverter0_ac_charging_status
name: inverter0_ac_charging_status
charging_to_floating_mode:
id: inverter0_charging_to_floating_mode
name: inverter0_charging_to_floating_mode
switch_on:
id: inverter0_switch_on
name: inverter0_switch_on
dustproof_installed:
id: inverter0_dustproof_installed
name: inverter0_dustproof_installed
silence_buzzer_open_buzzer:
id: inverter0_silence_buzzer_open_buzzer
name: inverter0_silence_buzzer_open_buzzer
overload_bypass_function:
id: inverter0_overload_bypass_function
name: inverter0_overload_bypass_function
lcd_escape_to_default:
id: inverter0_lcd_escape_to_default
name: inverter0_lcd_escape_to_default
overload_restart_function:
id: inverter0_overload_restart_function
name: inverter0_overload_restart_function
over_temperature_restart_function:
id: inverter0_over_temperature_restart_function
name: inverter0_over_temperature_restart_function
backlight_on:
id: inverter0_backlight_on
name: inverter0_backlight_on
- platform: template
id: ar1
lambda: 'return {};'
filters:
- autorepeat:
- delay: 2s
time_off: 100ms
time_on: 900ms
- delay: 4s
time_off: 100ms
time_on: 400ms
on_state:
then:
- lambda: 'ESP_LOGI("ar1:", "%d", x);'
- platform: xpt2046
xpt2046_id: xpt_touchscreen
id: touch_key0
x_min: 80
x_max: 160
y_min: 106
y_max: 212
on_state:
- lambda: 'ESP_LOGI("main", "key0: %s", (x ? "touch" : "release"));'
- platform: gpio
name: GPIO SX1509 test
pin:
sx1509: sx1509_hub
number: 3
- platform: touchscreen
id: touch_key1
x_min: 0
x_max: 100
y_min: 0
y_max: 100
on_press:
- logger.log: "Touched"
climate:
- platform: tuya
id: tuya_climate
switch_datapoint: 1
target_temperature_datapoint: 3
current_temperature_multiplier: 0.5
target_temperature_multiplier: 0.5
switch:
- platform: tuya
id: tuya_switch
switch_datapoint: 1
- platform: pipsolar
pipsolar_id: inverter0
output_source_priority_utility:
name: inverter0_output_source_priority_utility
output_source_priority_solar:
name: inverter0_output_source_priority_solar
output_source_priority_battery:
name: inverter0_output_source_priority_battery
input_voltage_range:
name: inverter0_input_voltage_range
pv_ok_condition_for_parallel:
name: inverter0_pv_ok_condition_for_parallel
pv_power_balance:
name: inverter0_pv_power_balance
light:
- platform: fastled_clockless
id: led_matrix_32x8
name: "led_matrix_32x8"
chipset: WS2812B
pin: GPIO15
num_leds: 256
rgb_order: GRB
default_transition_length: 0s
color_correct: [50%, 50%, 50%]
- platform: tuya
id: tuya_light
switch_datapoint: 1
dimmer_datapoint: 2
min_value_datapoint: 3
color_temperature_datapoint: 4
min_value: 1
max_value: 100
cold_white_color_temperature: 153 mireds
warm_white_color_temperature: 500 mireds
gamma_correct: 1
cover:
- platform: tuya
id: tuya_cover
position_datapoint: 2
display:
- platform: addressable_light
id: led_matrix_32x8_display
addressable_light_id: led_matrix_32x8
width: 32
height: 8
pixel_mapper: |-
if (x % 2 == 0) {
return (x * 8) + y;
}
return (x * 8) + (7 - y);
lambda: |-
Color red = Color(0xFF0000);
Color green = Color(0x00FF00);
Color blue = Color(0x0000FF);
it.rectangle(0, 0, it.get_width(), it.get_height(), red);
it.rectangle(1, 1, it.get_width()-2, it.get_height()-2, green);
it.rectangle(2, 2, it.get_width()-4, it.get_height()-4, blue);
it.rectangle(3, 3, it.get_width()-6, it.get_height()-6, red);
rotation: 0°
update_interval: 16ms
- platform: waveshare_epaper
cs_pin: GPIO23
dc_pin: GPIO23
busy_pin: GPIO23
reset_pin: GPIO23
model: 2.13in-ttgo-b1
full_update_every: 30
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: waveshare_epaper
cs_pin: GPIO23
dc_pin: GPIO23
busy_pin: GPIO23
reset_pin: GPIO23
model: 2.90in
full_update_every: 30
reset_duration: 200ms
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: waveshare_epaper
cs_pin: GPIO23
dc_pin: GPIO23
busy_pin: GPIO23
reset_pin: GPIO23
model: 2.90inv2
full_update_every: 30
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height());
- platform: inkplate6
id: inkplate_display
greyscale: false
partial_updating: false
update_interval: 60s
ckv_pin: GPIO1
sph_pin: GPIO1
gmod_pin: GPIO1
gpio0_enable_pin: GPIO1
oe_pin: GPIO1
spv_pin: GPIO1
powerup_pin: GPIO1
wakeup_pin: GPIO1
vcom_pin: GPIO1
number:
- platform: tuya
id: tuya_number
number_datapoint: 102
min_value: 0
max_value: 17
step: 1
text_sensor:
- platform: pipsolar
pipsolar_id: inverter0
device_mode:
id: inverter0_device_mode
name: inverter0_device_mode
last_qpigs:
id: inverter0_last_qpigs
name: inverter0_last_qpigs
last_qpiri:
id: inverter0_last_qpiri
name: inverter0_last_qpiri
last_qmod:
id: inverter0_last_qmod
name: inverter0_last_qmod
last_qflag:
id: inverter0_last_qflag
name: inverter0_last_qflag
output:
- platform: pipsolar
pipsolar_id: inverter0
battery_recharge_voltage:
id: inverter0_battery_recharge_voltage_out
esp32_camera:
name: ESP-32 Camera
data_pins: [GPIO17, GPIO35, GPIO34, GPIO5, GPIO39, GPIO18, GPIO36, GPIO19]
vsync_pin: GPIO22
href_pin: GPIO26
pixel_clock_pin: GPIO21
external_clock:
pin: GPIO27
frequency: 20MHz
i2c_pins:
sda: GPIO25
scl: GPIO23
reset_pin: GPIO15
power_down_pin: GPIO1
resolution: 640x480
jpeg_quality: 10
esp32_camera_web_server:
- port: 8080
mode: stream
- port: 8081
mode: snapshot
external_components:
- source: github://esphome/esphome@dev
refresh: 1d
components: ["bh1750"]
- source: ../esphome/components
components: ["sntp"]
xpt2046:
id: xpt_touchscreen
cs_pin: 17
irq_pin: 16
update_interval: 50ms
report_interval: 1s
threshold: 400
dimension_x: 240
dimension_y: 320
calibration_x_min: 3860
calibration_x_max: 280
calibration_y_min: 340
calibration_y_max: 3860
swap_x_y: False
on_state:
- lambda: |-
ESP_LOGI("main", "args x=%d, y=%d, touched=%s", x, y, (touched ? "touch" : "release"));
ESP_LOGI("main", "member x=%d, y=%d, touched=%d, x_raw=%d, y_raw=%d, z_raw=%d",
id(xpt_touchscreen).x,
id(xpt_touchscreen).y,
(int) id(xpt_touchscreen).touched,
id(xpt_touchscreen).x_raw,
id(xpt_touchscreen).y_raw,
id(xpt_touchscreen).z_raw
);
button:
- platform: restart
name: Restart Button
- platform: safe_mode
name: Safe Mode Button
- platform: shutdown
name: Shutdown Button
touchscreen:
- platform: ektf2232
interrupt_pin: GPIO36
rts_pin: GPIO5
display: inkplate_display
on_touch:
- logger.log:
format: Touch at (%d, %d)
args: ["touch.x", "touch.y"]