priority (可选,float):执行自定义初始化代码的优先级。较高的值意味着高优先级,因此您的代码也会更早地执行。请注意,这是 ESPHome 内部的值,任何更改都不会被标记为重大更改。默认值为 600。Priorities (您也可以使用它们之间的任何值):
800.0: This is where all hardware initialization of vital components is executed. For example setting switches to their initial state.
800.0:这是执行重要组件的所有硬件初始化的位置。例如,setting 会切换到它们的初始状态。
600.0: This is where most sensors are set up.
600.0:这是大多数传感器的设置位置。
250.0: At this priority, WiFi is initialized.
250.0:在此优先级下,WiFi 已初始化。
200.0: Network connections like MQTT/native API are set up at this priority.
200.0:MQTT/本机 API 等网络连接将按此优先级设置。
-100.0: At this priority, pretty much everything should already be initialized.
-100.0:在此优先级下,几乎所有内容都应该已经初始化。