From b35f5097848b94e14f45816ddfd8036057dcb770 Mon Sep 17 00:00:00 2001 From: Jan Harkes Date: Tue, 16 Nov 2021 03:16:43 -0500 Subject: [PATCH] Allow for subsecond sampling of hmc5883l (#2735) --- esphome/components/hmc5883l/sensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/hmc5883l/sensor.py b/esphome/components/hmc5883l/sensor.py index 73e7472dcf..9d8701079e 100644 --- a/esphome/components/hmc5883l/sensor.py +++ b/esphome/components/hmc5883l/sensor.py @@ -114,8 +114,8 @@ CONFIG_SCHEMA = ( def auto_data_rate(config): - interval_sec = config[CONF_UPDATE_INTERVAL].seconds - interval_hz = 1.0 / interval_sec + interval_msec = config[CONF_UPDATE_INTERVAL].total_milliseconds + interval_hz = 1000.0 / interval_msec for datarate in sorted(HMC5883LDatarates.keys()): if float(datarate) >= interval_hz: return HMC5883LDatarates[datarate]