@@ -382,10 +382,10 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
382
382
if (out_pm_ == nullptr ) return ;
383
383
384
384
// Power
385
- power_char_ = new mgos::hap::UFloatCharacteristic (
386
- (*iid)++, &kHAPCharacteristic_EveConsumption , 0 , 65535 , 1 ,
385
+ power_char_ = new mgos::hap::FloatCharacteristic (
386
+ (*iid)++, &kHAPCharacteristic_EveConsumption , 0 . 0f , 65535 . 0f , 0 . 1f ,
387
387
[this ](HAPAccessoryServerRef *,
388
- const HAPUFloatCharacteristicReadRequest *, float *value) {
388
+ const HAPFloatCharacteristicReadRequest *, float *value) {
389
389
auto power = out_pm_->GetPowerW ();
390
390
if (!power.ok ()) return kHAPError_Busy ;
391
391
*value = power.ValueOrDie ();
@@ -394,13 +394,13 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
394
394
true /* supports_notification */ , nullptr , " eve-power-consumption" );
395
395
AddChar (power_char_);
396
396
// Energy
397
- total_power_char_ = new mgos::hap::UFloatCharacteristic (
398
- (*iid)++, &kHAPCharacteristic_EveTotalConsumption , 0 , 65535 , 1 ,
397
+ total_power_char_ = new mgos::hap::FloatCharacteristic (
398
+ (*iid)++, &kHAPCharacteristic_EveTotalConsumption , 0 . 0f , 65535 . 0f , 0 . 1f ,
399
399
[this ](HAPAccessoryServerRef *,
400
- const HAPUFloatCharacteristicReadRequest *, float *value) {
400
+ const HAPFloatCharacteristicReadRequest *, float *value) {
401
401
auto energy = out_pm_->GetEnergyWH ();
402
402
if (!energy.ok ()) return kHAPError_Busy ;
403
- *value = energy.ValueOrDie () / 1000 . 0f ;
403
+ *value = energy.ValueOrDie ();
404
404
return kHAPError_None ;
405
405
},
406
406
true /* supports_notification */ , nullptr , " eve-total-power-consumption" );
0 commit comments