Skip to content

Commit 2ca3159

Browse files
timoschillingmarkirb
authored andcommitted
tmp
1 parent fb3d013 commit 2ca3159

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
@@ -382,10 +382,10 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
382382
if (out_pm_ == nullptr) return;
383383

384384
// 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,
387387
[this](HAPAccessoryServerRef *,
388-
const HAPUFloatCharacteristicReadRequest *, float *value) {
388+
const HAPFloatCharacteristicReadRequest *, float *value) {
389389
auto power = out_pm_->GetPowerW();
390390
if (!power.ok()) return kHAPError_Busy;
391391
*value = power.ValueOrDie();
@@ -394,13 +394,13 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
394394
true /* supports_notification */, nullptr, "eve-power-consumption");
395395
AddChar(power_char_);
396396
// 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,
399399
[this](HAPAccessoryServerRef *,
400-
const HAPUFloatCharacteristicReadRequest *, float *value) {
400+
const HAPFloatCharacteristicReadRequest *, float *value) {
401401
auto energy = out_pm_->GetEnergyWH();
402402
if (!energy.ok()) return kHAPError_Busy;
403-
*value = energy.ValueOrDie() / 1000.0f;
403+
*value = energy.ValueOrDie();
404404
return kHAPError_None;
405405
},
406406
true /* supports_notification */, nullptr, "eve-total-power-consumption");

0 commit comments

Comments
 (0)