基于电流的 Cover
current_based Cover 平台允许您通过使用电流传感器检测完全打开和完全关闭状态来创建具有位置控制的 Cover。这在使用带有集成机械限位开关的电机时非常有用。在 Cover 操作期间,组件监视电流消耗以检测电机何时停止。
当请求完全打开或关闭时,相应的继电器将保持开启,直到电机消耗的电流低于一定量。需要在配置中指定电流大小。
可以指定打开和关闭持续时间,以允许 ESPHome 近似 Cover 的当前位置。
此类型的 Cover 还提供安全功能,如基于电流的障碍物检测和可配置的自动回滚,以及继电器故障检测:如果在相反操作电路中有电流流动(通常由焊接继电器引起),则操作取消。
WARNING
根据 Cover 和电机类型,障碍物可能在被检测到之前已经对 Cover 造成物理损坏。验证您的设置,确保电流消耗会在造成任何物理损坏之前足够增加以便检测。使用风险自负。
# 示例配置条目cover: - platform: current_based name: "Current Based Cover"
open_sensor: open_current_sensor open_moving_current_threshold: 0.5 open_obstacle_current_threshold: 0.8 open_duration: 12s open_action: - switch.turn_on: open_cover_switch
close_sensor: close_current_sensor close_moving_current_threshold: 0.5 close_obstacle_current_threshold: 0.8 close_duration: 10s close_action: - switch.turn_on: close_cover_switch
stop_action: - switch.turn_off: close_cover_switch - switch.turn_off: open_cover_switch
obstacle_rollback: 30% start_sensing_delay: 0.8s-
open_sensor (必填, ID): 打开电流传感器。
-
open_action (必填, 动作): 当远程请求打开 Cover 时应执行的动作。
-
open_duration (必填, 时间): Cover 从完全关闭状态打开所需的时间量。
-
open_moving_current_threshold (必填, float): 电机应消耗的电流量(安培),以认为 Cover 正在打开。
-
open_obstacle_current_threshold (必填, float): 电机应消耗的电流量(安培),以认为 Cover 在打开过程中被阻塞。
-
close_sensor (必填, ID): 关闭电流传感器。
-
close_action (可选, 动作): 当远程请求关闭 Cover 时应执行的动作。
-
close_duration (必填, 时间): Cover 从完全打开状态关闭所需的时间量。
-
close_moving_current_threshold (必填, float): 电机应消耗的电流量(安培),以认为 Cover 正在关闭。
-
close_obstacle_current_threshold (必填, float): 电机应消耗的电流量(安培),以认为 Cover 在关闭过程中被阻塞。
-
stop_action (必填, 动作): 应执行以停止 Cover 的动作。
-
max_duration (可选, 时间): Cover 应打开或关闭的最大持续时间。用于保护功能异常的电机集成限位开关。
-
start_sensing_delay (可选, 时间): 移动开始时电流检测将被禁用的时间量。电机可能需要一些时间才能达到其平均消耗量。较低的值可能因为第一次电流读数发生在电流上升期间而导致立即停止。默认为
500ms。 -
obstacle_rollback (可选, percentage): 检测到障碍物时 Cover 将执行的回滚百分比。默认为
10%。 -
malfunction_detection (可选, boolean): 启用以检测故障(通常是焊接继电器)。默认为
True。 -
malfunction_action (可选, 动作): 检测到继电器故障时应执行的动作。故障可能需要设备维护。您可以使用此动作通知其他系统有关此情况
-
Cover 的所有其他选项。
与 Shelly 2.5 配合使用
Section titled “与 Shelly 2.5 配合使用”Shelly 2.5 是此平台的完美硬件。它具有两个带电流监控的输出(得益于内置 ADE7953),外形非常小巧(39mm x 36mm x 17 mm)。它还具有 NTC 温度传感器。
这些设备通常运行温度较高(在 20ºC 室温下约 55Cº)。长期重负载(接近其额定限制)可能会使设备过热。 强烈建议使用 NTC 温度传感器监视设备温度,如果温度超过 90ºC 则关闭设备。此安全功能也存在于原始固件中。
WARNING
ADE7953 IRQ 线连接到 GPIO16。ADE7953 的 irq_pin 参数必须设置为 GPIO16 以防止设备过热(空闲时 >70ºC)。
配置示例:
esphome: name: Shelly 2.5
esp8266: board: esp01_1m restore_from_flash: true
i2c: sda: GPIO12 scl: GPIO14
sensor: - platform: ade7953_i2c irq_pin: GPIO16 voltage: name: Shelly 2.5 Mains Voltage internal: true filters: - throttle: 5s current_a: name: Shelly 2.5 Open Current id: open_current internal: true current_b: name: Shelly 2.5 Close Current id: close_current internal: true update_interval: 0.5s
# NTC 温度 - platform: ntc sensor: temp_resistance_reading name: Shelly 2.5 Temperature unit_of_measurement: "°C" accuracy_decimals: 1 calibration: b_constant: 3350 reference_resistance: 10kOhm reference_temperature: 298.15K on_value_range: above: 90 then: # 过热安全关闭 - switch.turn_on: _shutdown
- platform: resistance id: temp_resistance_reading sensor: temp_analog_reading configuration: DOWNSTREAM resistor: 32kOhm internal: true - platform: adc id: temp_analog_reading pin: A0 update_interval: 30s internal: true
binary_sensor: - platform: gpio pin: number: GPIO13 name: Shelly 2.5 Open Button on_press: then: cover.open: blind
- platform: gpio pin: number: GPIO5 name: Shelly 2.5 Close Button on_press: then: cover.close: blind
switch: - platform: shutdown id: _shutdown name: Shelly 2.5 Shutdown
- platform: gpio id: open_relay name: Shelly 2.5 Open Relay pin: GPIO15 restore_mode: RESTORE_DEFAULT_OFF interlock: &interlock [open_relay, close_relay] interlock_wait_time: 200ms
- platform: gpio id: close_relay name: Shelly 2.5 Close Relay pin: GPIO4 restore_mode: RESTORE_DEFAULT_OFF interlock: *interlock interlock_wait_time: 200ms
# 示例配置条目cover: - platform: current_based name: Blind id: blind
open_sensor: open_current open_moving_current_threshold: 0.5 open_duration: 12s open_action: - switch.turn_on: open_relay close_sensor: close_current close_moving_current_threshold: 0.5 close_duration: 10s close_action: - switch.turn_on: close_relay stop_action: - switch.turn_off: close_relay - switch.turn_off: open_relay obstacle_rollback: 30% start_sensing_delay: 0.8s malfunction_detection: true malfunction_action: then: - logger.log: "检测到故障。继电器焊接。"
status_led: pin: number: GPIO0 inverted: yes