Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow uart0/1/2 as ids in config #4446

Merged
merged 3 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions esphome/config_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@
"open",
"setup",
"loop",
"uart0",
"uart1",
"uart2",
]


Expand Down
28 changes: 14 additions & 14 deletions tests/test1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ mqtt:
id: ${roomname}_lights
relative_brightness: 5%
- uart.write:
id: uart0
id: uart_0
data: Hello World
- uart.write:
id: uart0
id: uart_0
data: [0x00, 0x20, 0x30]
- uart.write:
id: uart0
id: uart_0
data: !lambda |-
return {};
on_connect:
Expand Down Expand Up @@ -199,7 +199,7 @@ uart:
number: GPIO23
inverted: true
baud_rate: 115200
id: uart0
id: uart_0
parity: NONE
data_bits: 8
stop_bits: 1
Expand Down Expand Up @@ -790,7 +790,7 @@ sensor:
reference_resistance: 430 Ω
rtd_nominal_resistance: 100 Ω
- platform: mhz19
uart_id: uart0
uart_id: uart_0
co2:
name: MH-Z19 CO2 Value
temperature:
Expand Down Expand Up @@ -930,7 +930,7 @@ sensor:
name: Pulse Width
pin: GPIO12
- platform: sm300d2
uart_id: uart0
uart_id: uart_0
co2:
name: SM300D2 CO2 Value
formaldehyde:
Expand Down Expand Up @@ -1122,7 +1122,7 @@ sensor:
root["key"] = id(the_sensor).state;
root["greeting"] = "Hello World";
- platform: sds011
uart_id: uart0
uart_id: uart_0
pm_2_5:
name: SDS011 PM2.5
pm_10_0:
Expand Down Expand Up @@ -2094,7 +2094,7 @@ climate:
on_state:
logger.log: State changed!
id: midea_unit
uart_id: uart0
uart_id: uart_0
name: Midea Climate
transmitter_id:
period: 1s
Expand Down Expand Up @@ -2419,15 +2419,15 @@ switch:
id: my_switch
state: !lambda "return false;"
- platform: uart
uart_id: uart0
uart_id: uart_0
name: UART String Output
data: DataToSend
- platform: uart
uart_id: uart0
uart_id: uart_0
name: UART Bytes Output
data: [0xDE, 0xAD, 0xBE, 0xEF]
- platform: uart
uart_id: uart0
uart_id: uart_0
name: UART Recurring Output
data: [0xDE, 0xAD, 0xBE, 0xEF]
send_every: 1s
Expand Down Expand Up @@ -2775,7 +2775,7 @@ pn532_i2c:
i2c_id: i2c_bus

rdm6300:
uart_id: uart0
uart_id: uart_0

rc522_spi:
cs_pin: GPIO23
Expand Down Expand Up @@ -2804,7 +2804,7 @@ mcp4728:
i2c_id: i2c_bus

gps:
uart_id: uart0
uart_id: uart_0

time:
- platform: sntp
Expand Down Expand Up @@ -3124,7 +3124,7 @@ canbus:

teleinfo:
id: myteleinfo
uart_id: uart0
uart_id: uart_0
update_interval: 60s
historical_mode: true

Expand Down
74 changes: 37 additions & 37 deletions tests/test3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,66 +216,66 @@ wifi:
password: "password1"

uart:
- id: uart1
- id: uart_1
tx_pin:
number: GPIO1
inverted: true
rx_pin: GPIO3
baud_rate: 115200
- id: uart2
- id: uart_2
tx_pin: GPIO4
rx_pin: GPIO5
baud_rate: 9600
- id: uart3
- id: uart_3
tx_pin: GPIO4
rx_pin: GPIO5
baud_rate: 4800
- id: uart4
- id: uart_4
tx_pin: GPIO4
rx_pin: GPIO5
baud_rate: 9600
- id: uart5
- id: uart_5
tx_pin: GPIO4
rx_pin: GPIO5
baud_rate: 9600
- id: uart6
- id: uart_6
tx_pin: GPIO4
rx_pin: GPIO5
baud_rate: 9600
- id: uart7
- id: uart_7
tx_pin: GPIO4
rx_pin: GPIO5
baud_rate: 38400
- id: uart8
- id: uart_8
tx_pin: GPIO4
rx_pin: GPIO5
baud_rate: 4800
parity: NONE
stop_bits: 2
# Specifically added for testing debug with no options at all.
debug:
- id: uart9
- id: uart_9
tx_pin: GPIO4
rx_pin: GPIO5
baud_rate: 9600
- id: uart10
- id: uart_10
tx_pin: GPIO4
rx_pin: GPIO5
baud_rate: 9600
- id: uart11
- id: uart_11
tx_pin: GPIO4
rx_pin: GPIO5
baud_rate: 9600
- id: uart12
- id: uart_12
tx_pin: GPIO4
rx_pin: GPIO5
baud_rate: 9600

modbus:
uart_id: uart1
uart_id: uart_1

vbus:
uart_id: uart4
uart_id: uart_4

ota:
safe_mode: true
Expand Down Expand Up @@ -337,14 +337,14 @@ sensor:

- platform: hydreon_rgxx
model: RG 9
uart_id: uart6
uart_id: uart_6
id: hydreon_rg9
moisture:
name: hydreon_rain
id: hydreon_rain
- platform: hydreon_rgxx
model: RG_15
uart_id: uart6
uart_id: uart_6
acc:
name: hydreon_acc
event_acc:
Expand All @@ -369,7 +369,7 @@ sensor:
value: 100.0

- platform: bl0939
uart_id: uart8
uart_id: uart_8
voltage:
name: BL0939 Voltage
current_1:
Expand All @@ -387,7 +387,7 @@ sensor:
energy_total:
name: BL0939 Total energy
- platform: bl0940
uart_id: uart3
uart_id: uart_3
voltage:
name: BL0940 Voltage
current:
Expand All @@ -401,7 +401,7 @@ sensor:
external_temperature:
name: BL0940 External temperature
- platform: bl0942
uart_id: uart3
uart_id: uart_3
voltage:
name: BL0942 Voltage
current:
Expand All @@ -413,7 +413,7 @@ sensor:
frequency:
name: BL0942 Frequency
- platform: pzem004t
uart_id: uart3
uart_id: uart_3
voltage:
name: PZEM004T Voltage
current:
Expand Down Expand Up @@ -446,7 +446,7 @@ sensor:
name: PZEMDC Energy

- platform: pmsx003
uart_id: uart9
uart_id: uart_9
type: PMSX003
pm_1_0:
name: PM 1.0 Concentration
Expand Down Expand Up @@ -474,7 +474,7 @@ sensor:
name: Particulate Count >10.0um
update_interval: 30s
- platform: pmsx003
uart_id: uart5
uart_id: uart_5
type: PMS5003T
pm_1_0:
name: PM 1.0 Concentration
Expand All @@ -501,7 +501,7 @@ sensor:
humidity:
name: PMS Humidity
- platform: pmsx003
uart_id: uart6
uart_id: uart_6
type: PMS5003ST
pm_1_0:
name: PM 1.0 Concentration
Expand Down Expand Up @@ -534,7 +534,7 @@ sensor:
formaldehyde:
name: PMS Formaldehyde Concentration
- platform: cse7761
uart_id: uart7
uart_id: uart_7
voltage:
name: CSE7761 Voltage
current_1:
Expand All @@ -546,7 +546,7 @@ sensor:
active_power_2:
name: CSE7761 Active Power 2
- platform: cse7766
uart_id: uart3
uart_id: uart_3
voltage:
name: CSE7766 Voltage
current:
Expand Down Expand Up @@ -637,7 +637,7 @@ sensor:
component_id: 2
wave_channel_id: 1
- platform: smt100
uart_id: uart10
uart_id: uart_10
counts:
name: Counts
dielectric_constant:
Expand Down Expand Up @@ -925,7 +925,7 @@ climate:
- horizontal
- both
update_interval: 10s
uart_id: uart12
uart_id: uart_12

sprinkler:
- id: yard_sprinkler_ctrlr
Expand Down Expand Up @@ -996,15 +996,15 @@ light:
effects:
- wled:
- adalight:
uart_id: uart3
uart_id: uart_3
- e131:
universe: 1
- platform: hbridge
name: Icicle Lights
pin_a: out
pin_b: out2
- platform: sonoff_d1
uart_id: uart2
uart_id: uart_2
use_rm433_remote: false
name: Sonoff D1 Dimmer
id: d1_light
Expand All @@ -1019,10 +1019,10 @@ light:
name: "Shelly Dimmer Current"
max_brightness: 500
firmware: "51.6"
uart_id: uart11
uart_id: uart_11

sim800l:
uart_id: uart4
uart_id: uart_4
on_sms_received:
- lambda: |-
std::string str;
Expand All @@ -1035,7 +1035,7 @@ sim800l:
recipient: "+1234"

dfplayer:
uart_id: uart5
uart_id: uart_5
on_finished_playback:
then:
if:
Expand All @@ -1049,7 +1049,7 @@ tm1651:
dio_pin: D5

rf_bridge:
uart_id: uart5
uart_id: uart_5
on_code_received:
- lambda: |-
uint32_t test;
Expand Down Expand Up @@ -1083,7 +1083,7 @@ rf_bridge:

display:
- platform: nextion
uart_id: uart1
uart_id: uart_1
tft_url: http://esphome.io/default35.tft
update_interval: 5s
on_sleep:
Expand Down Expand Up @@ -1128,19 +1128,19 @@ fingerprint_grow:
event: esphome.${device_name}_fingerprint_grow_enrollment_failed
data:
finger_id: !lambda "return finger_id;"
uart_id: uart6
uart_id: uart_6

dsmr:
decryption_key: 00112233445566778899aabbccddeeff
uart_id: uart6
uart_id: uart_6
max_telegram_length: 1000
request_pin: D5
request_interval: 20s
receive_timeout: 100ms

daly_bms:
update_interval: 20s
uart_id: uart1
uart_id: uart_1

qr_code:
- id: homepage_qr
Expand Down