Skip to content

Commit

Permalink
Merge branch 'master' into improve-pm
Browse files Browse the repository at this point in the history
  • Loading branch information
timoschilling committed Jan 21, 2023
2 parents 12b8d40 + f6ac761 commit 068e18c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
13 changes: 12 additions & 1 deletion fs_src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -726,8 +726,19 @@ function updateComponent(cd) {
if (cd.type == Component_Type.kLightBulb) {
if (cd.bulb_type == LightBulbController_BulbType.kCCT) {
headText = "CCT";
if (lastInfo.model == "ShellyRGBW2") {
if (cd.id == 1) {
headText += " R/G";
} else {
headText += " B/W";
}
}
} else if (cd.bulb_type == LightBulbController_BulbType.kRGBW) {
headText = "RGB";
if (lastInfo.sys_mode == 4) {
headText = "RGBW";
} else {
headText = "RGB";
}
} else {
headText = "Light";
}
Expand Down
8 changes: 4 additions & 4 deletions src/shelly_switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
// Power
power_char_ = new mgos::hap::FloatCharacteristic(
(*iid)++, &kHAPCharacteristic_EveConsumption, 0.0f, 65535.0f, 0.1f,
[this](HAPAccessoryServerRef *,
const HAPFloatCharacteristicReadRequest *, float *value) {
[this](HAPAccessoryServerRef *, const HAPFloatCharacteristicReadRequest *,
float *value) {
auto power = out_pm_->GetPowerW();
if (!power.ok()) return kHAPError_Busy;
*value = power.ValueOrDie();
Expand All @@ -382,8 +382,8 @@ void ShellySwitch::AddPowerMeter(uint16_t *iid) {
// Energy
total_power_char_ = new mgos::hap::FloatCharacteristic(
(*iid)++, &kHAPCharacteristic_EveTotalConsumption, 0.0f, 65535.0f, 0.1f,
[this](HAPAccessoryServerRef *,
const HAPFloatCharacteristicReadRequest *, float *value) {
[this](HAPAccessoryServerRef *, const HAPFloatCharacteristicReadRequest *,
float *value) {
auto energy = out_pm_->GetEnergyWH();
if (!energy.ok()) return kHAPError_Busy;
*value = energy.ValueOrDie();
Expand Down

0 comments on commit 068e18c

Please sign in to comment.