Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
timoschilling committed Jan 20, 2023
1 parent ede10c6 commit 12b8d40
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/shelly_switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
if (out_pm_ == nullptr) return;

// Power
power_char_ = new mgos::hap::UFloatCharacteristic(
(*iid)++, &kHAPCharacteristic_EveConsumption, 0, 65535, 1,
power_char_ = new mgos::hap::FloatCharacteristic(
(*iid)++, &kHAPCharacteristic_EveConsumption, 0.0f, 65535.0f, 0.1f,
[this](HAPAccessoryServerRef *,
const HAPUFloatCharacteristicReadRequest *, float *value) {
const HAPFloatCharacteristicReadRequest *, float *value) {
auto power = out_pm_->GetPowerW();
if (!power.ok()) return kHAPError_Busy;
*value = power.ValueOrDie();
Expand All @@ -380,13 +380,13 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
true /* supports_notification */, nullptr, "eve-power-consumption");
AddChar(power_char_);
// Energy
total_power_char_ = new mgos::hap::UFloatCharacteristic(
(*iid)++, &kHAPCharacteristic_EveTotalConsumption, 0, 65535, 1,
total_power_char_ = new mgos::hap::FloatCharacteristic(
(*iid)++, &kHAPCharacteristic_EveTotalConsumption, 0.0f, 65535.0f, 0.1f,
[this](HAPAccessoryServerRef *,
const HAPUFloatCharacteristicReadRequest *, float *value) {
const HAPFloatCharacteristicReadRequest *, float *value) {
auto energy = out_pm_->GetEnergyWH();
if (!energy.ok()) return kHAPError_Busy;
*value = energy.ValueOrDie() / 1000.0f;
*value = energy.ValueOrDie();
return kHAPError_None;
},
true /* supports_notification */, nullptr, "eve-total-power-consumption");
Expand Down

0 comments on commit 12b8d40

Please sign in to comment.