From 71accc73c1422376de63714c453aad880ae070ce Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 15 Nov 2020 16:21:44 +0100 Subject: [PATCH] Fix shelly dimmer energy monitor detection --- tasmota/xdrv_45_shelly_dimmer.ino | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tasmota/xdrv_45_shelly_dimmer.ino b/tasmota/xdrv_45_shelly_dimmer.ino index 09dd73e60..bfdc3b455 100644 --- a/tasmota/xdrv_45_shelly_dimmer.ino +++ b/tasmota/xdrv_45_shelly_dimmer.ino @@ -819,17 +819,17 @@ void CmndShdWarmupTime(void) \*********************************************************************************************/ #ifdef USE_ENERGY_SENSOR -bool Xnrg31(uint8_t function) -{ +bool Xnrg31(uint8_t function) { bool result = false; - if (function == FUNC_PRE_INIT) - { + if (Shd.present) { + if (FUNC_PRE_INIT == function) { #ifndef SHELLY_VOLTAGE_MON - Energy.current_available = false; - Energy.voltage_available = false; + Energy.current_available = false; + Energy.voltage_available = false; #endif // SHELLY_VOLTAGE_MON - TasmotaGlobal.energy_driver = XNRG_31; + TasmotaGlobal.energy_driver = XNRG_31; + } } return result; }