积分传感器
integration 传感器是一个辅助传感器,可以对其他传感器的值进行时间积分。例如,这对于将水流量传感器(单位 m^3/s)的值随时间积分(结果单位为 m^3)很有用。
此组件可以被视为 每日总能量 的更通用版本。
# 示例配置条目sensor: - platform: integration name: "每日总能量" sensor: my_flow_meter time_unit: min
# 要积分的传感器,可以是任何功率传感器 - platform: pulse_counter # ... id: my_flow_meter-
sensor (必需, ID): 要随时间积分的传感器的 ID。
-
time_unit (必需, 字符串): 积分使用的时间单位,可选值为
ms、s、min、h或d。 -
integration_method (可选, 字符串): 要使用的积分方法。可选值为
trapezoid、left或right。默认为trapezoid。 -
restore (可选, 布尔值): 是否在设备上存储中间结果,以便在断电或重启时可以恢复该值。 警告:此选项可能会磨损您的闪存。默认为
false。 -
传感器的所有其他选项。
sensor.integration.reset 动作
Section titled “sensor.integration.reset 动作”此 动作 允许您将积分传感器的值重置为零。例如,这可以用于在午夜通过基于时间的自动化将积分传感器重置为零。
on_...: - sensor.integration.reset: my_integration_sensor