@@ -384,8 +384,8 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
384
384
// Power
385
385
power_char_ = new mgos::hap::FloatCharacteristic (
386
386
(*iid)++, &kHAPCharacteristic_EveConsumption , 0 .0f , 65535 .0f , 0 .1f ,
387
- [this ](HAPAccessoryServerRef *,
388
- const HAPFloatCharacteristicReadRequest *, float *value) {
387
+ [this ](HAPAccessoryServerRef *, const HAPFloatCharacteristicReadRequest *,
388
+ float *value) {
389
389
auto power = out_pm_->GetPowerW ();
390
390
if (!power.ok ()) return kHAPError_Busy ;
391
391
*value = power.ValueOrDie ();
@@ -396,8 +396,8 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
396
396
// Energy
397
397
total_power_char_ = new mgos::hap::FloatCharacteristic (
398
398
(*iid)++, &kHAPCharacteristic_EveTotalConsumption , 0 .0f , 65535 .0f , 0 .1f ,
399
- [this ](HAPAccessoryServerRef *,
400
- const HAPFloatCharacteristicReadRequest *, float *value) {
399
+ [this ](HAPAccessoryServerRef *, const HAPFloatCharacteristicReadRequest *,
400
+ float *value) {
401
401
auto energy = out_pm_->GetEnergyWH ();
402
402
if (!energy.ok ()) return kHAPError_Busy ;
403
403
*value = energy.ValueOrDie () / 1000 .0f ;
@@ -414,15 +414,15 @@ void ShellySwitch::PowerMeterTimerCB() {
414
414
auto current_power = out_pm_->GetPowerW ();
415
415
auto current_total_power = out_pm_->GetEnergyWH ();
416
416
417
- // if (current_power.ok() && current_power.ValueOrDie() != last_power_) {
418
- // last_power_ = current_power.ValueOrDie();
417
+ if (current_power.ok () && current_power.ValueOrDie () != last_power_) {
418
+ last_power_ = current_power.ValueOrDie ();
419
419
power_char_->RaiseEvent ();
420
- // }
421
- // if (current_total_power.ok() &&
422
- // current_total_power.ValueOrDie() != last_total_power_) {
423
- // last_total_power_ = current_total_power.ValueOrDie();
420
+ }
421
+ if (current_total_power.ok () &&
422
+ current_total_power.ValueOrDie () != last_total_power_) {
423
+ last_total_power_ = current_total_power.ValueOrDie ();
424
424
total_power_char_->RaiseEvent ();
425
- // }
425
+ }
426
426
}
427
427
428
428
} // namespace shelly
0 commit comments