Skip to content

Commit

Permalink
Display HVAC power
Browse files Browse the repository at this point in the history
fix #837
  • Loading branch information
fracz committed Jul 18, 2024
1 parent 334013c commit 05c61c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ public function getState(IODeviceChannel $channel): array {
if (count($values) !== 7) {
throw new SuplaServerIsDownException();
}
[, $modeId, $tempHeat, $tempCool, $flags, $tempMain, $humidityMain] = $values;
[$isOn, $modeId, $tempHeat, $tempCool, $flags, $tempMain, $humidityMain] = $values;
return [
'heating' => HvacIpcValueFlags::HEATING()->isOn($flags),
'cooling' => HvacIpcValueFlags::COOLING()->isOn($flags),
'partially' => $isOn >= 2 ? $isOn - 1 : 0,
'manual' => !HvacIpcValueFlags::WEEKLY_SCHEDULE()->isOn($flags),
'countdownTimer' => HvacIpcValueFlags::COUNTDOWN_TIMER()->isOn($flags),
'thermometerError' => HvacIpcValueFlags::THERMOMETER_ERROR()->isOn($flags),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ public function stateExamples() {
['VALUE:0,1,2,3,384,0,0', ['thermometerError' => true, 'clockError' => true]],
['VALUE:0,1,2,3,512,0,0', ['forcedOffBySensor' => true]],
['VALUE:0,1,2,3,2048,0,0', ['weeklyScheduleTemporalOverride' => true]],
['VALUE:0,1,2,3,2048,0,0', ['partially' => 0]],
['VALUE:1,1,2,3,2048,0,0', ['partially' => 0]],
['VALUE:2,1,2,3,2048,0,0', ['partially' => 1]],
['VALUE:41,1,2,3,2048,0,0', ['partially' => 40]],
];
}

Expand Down
3 changes: 3 additions & 0 deletions src/frontend/src/channels/channel-state-table-hvac.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
<fa icon="clock" fixed-width/>
</span>
</div>
<div v-if="state.mode !== 'OFF' && state.partially" class="small">
{{ $t('Power: {percent}%', {percent: state.partially}) }}
</div>
</div>
</template>

Expand Down

0 comments on commit 05c61c4

Please sign in to comment.