Skip to content

Commit 12b8d40

Browse files
committed
tmp
1 parent ede10c6 commit 12b8d40

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/shelly_switch.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,10 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
368368
if (out_pm_ == nullptr) return;
369369

370370
// 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,
373373
[this](HAPAccessoryServerRef *,
374-
const HAPUFloatCharacteristicReadRequest *, float *value) {
374+
const HAPFloatCharacteristicReadRequest *, float *value) {
375375
auto power = out_pm_->GetPowerW();
376376
if (!power.ok()) return kHAPError_Busy;
377377
*value = power.ValueOrDie();
@@ -380,13 +380,13 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
380380
true /* supports_notification */, nullptr, "eve-power-consumption");
381381
AddChar(power_char_);
382382
// 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,
385385
[this](HAPAccessoryServerRef *,
386-
const HAPUFloatCharacteristicReadRequest *, float *value) {
386+
const HAPFloatCharacteristicReadRequest *, float *value) {
387387
auto energy = out_pm_->GetEnergyWH();
388388
if (!energy.ok()) return kHAPError_Busy;
389-
*value = energy.ValueOrDie() / 1000.0f;
389+
*value = energy.ValueOrDie();
390390
return kHAPError_None;
391391
},
392392
true /* supports_notification */, nullptr, "eve-total-power-consumption");

0 commit comments

Comments
 (0)