Skip to content

Commit

Permalink
Increase power reporting interval to 5+/-0.5 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
rojer committed Jul 26, 2022
1 parent 144a5db commit 7f8dc43
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/shelly_switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
true /* supports_notification */, nullptr, "eve-total-power-consumption");
AddChar(total_power_char_);

power_timer_.Reset(1000, MGOS_TIMER_REPEAT);
// Fuzz the interval a little bit to avoid many devices reporting at once.
power_timer_.Reset(mgos_rand_range(4500, 5500), MGOS_TIMER_REPEAT);
}

void ShellySwitch::PowerMeterTimerCB() {
Expand Down

0 comments on commit 7f8dc43

Please sign in to comment.