From 1aaf186cae27074cf5549961ae3c1f70c17355b7 Mon Sep 17 00:00:00 2001 From: oogm Date: Sun, 29 May 2022 17:55:48 +0200 Subject: [PATCH] Add support for BP5758's sleep mode --- tasmota/xlgt_08_bp5758d.ino | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tasmota/xlgt_08_bp5758d.ino b/tasmota/xlgt_08_bp5758d.ino index e2104ddf2..5bded58d4 100644 --- a/tasmota/xlgt_08_bp5758d.ino +++ b/tasmota/xlgt_08_bp5758d.ino @@ -108,6 +108,13 @@ void Bp5758dStop(void) { bool Bp5758dSetChannels(void) { uint16_t *cur_col_10 = (uint16_t*)XdrvMailbox.command; + // If we receive 0 for all channels, we'll assume that the lightbulb is off, and activate BP5758d's sleep mode. + if (cur_col_10[0]==0 && cur_col_10[1]==0 && cur_col_10[2]==0 && cur_col_10[3]==0 && cur_col_10[4]==0) { + Bp5758dStart(BP5758D_ADDR_SLEEP); + Bp5758dStop(); + return true; + } + // Even though we could address changing channels only, in practice we observed that the lightbulb always sets all channels. Bp5758dStart(BP5758D_ADDR_OUT1_GL); // Brigtness values are transmitted as two bytes. The light-bulb accepts a 10-bit integer (0-1023) as an input value.