@@ -368,10 +368,10 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
368
368
if (out_pm_ == nullptr ) return ;
369
369
370
370
// Power
371
- power_char_ = new mgos::hap::UFloatCharacteristic (
372
- (*iid)++, &kHAPCharacteristic_EveConsumption , 0 , 65535 , 1 ,
371
+ power_char_ = new mgos::hap::FloatCharacteristic (
372
+ (*iid)++, &kHAPCharacteristic_EveConsumption , 0 . 0f , 65535 . 0f , 0 . 1f ,
373
373
[this ](HAPAccessoryServerRef *,
374
- const HAPUFloatCharacteristicReadRequest *, float *value) {
374
+ const HAPFloatCharacteristicReadRequest *, float *value) {
375
375
auto power = out_pm_->GetPowerW ();
376
376
if (!power.ok ()) return kHAPError_Busy ;
377
377
*value = power.ValueOrDie ();
@@ -380,13 +380,13 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
380
380
true /* supports_notification */ , nullptr , " eve-power-consumption" );
381
381
AddChar (power_char_);
382
382
// Energy
383
- total_power_char_ = new mgos::hap::UFloatCharacteristic (
384
- (*iid)++, &kHAPCharacteristic_EveTotalConsumption , 0 , 65535 , 1 ,
383
+ total_power_char_ = new mgos::hap::FloatCharacteristic (
384
+ (*iid)++, &kHAPCharacteristic_EveTotalConsumption , 0 . 0f , 65535 . 0f , 0 . 1f ,
385
385
[this ](HAPAccessoryServerRef *,
386
- const HAPUFloatCharacteristicReadRequest *, float *value) {
386
+ const HAPFloatCharacteristicReadRequest *, float *value) {
387
387
auto energy = out_pm_->GetEnergyWH ();
388
388
if (!energy.ok ()) return kHAPError_Busy ;
389
- *value = energy.ValueOrDie () / 1000 . 0f ;
389
+ *value = energy.ValueOrDie ();
390
390
return kHAPError_None ;
391
391
},
392
392
true /* supports_notification */ , nullptr , " eve-total-power-consumption" );
0 commit comments