Skip to content

Commit

Permalink
add support for legacy heat action for climate device with hvac_mode=…
Browse files Browse the repository at this point in the history
…heat_cool
  • Loading branch information
nielsfaber committed Dec 23, 2022
1 parent b93c841 commit 12565a8
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/standard-configuration/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { levelVariable } from '../data/variables/level_variable';
import { listAttribute, numericAttribute } from './attribute';
import { VariableConfig } from './variables';
import { computeSupportedFeatures } from '../data/entities/compute_supported_features';
import { isDefined } from '../helpers';

export type ActionItem = {
supported_feature?: number | ((stateObj?: HassEntity) => number);
Expand Down Expand Up @@ -83,6 +84,22 @@ export const actionList: Record<string, Record<string, ActionItem>> = {
},
condition: stateObj => listAttribute(stateObj, 'hvac_modes').includes('heat'),
},
_heat: {
service: 'set_temperature',
service_data: {
hvac_mode: 'heat_cool',
},
variables: {
temperature: {
template: temperatureVariable,
},
},
condition: stateObj =>
listAttribute(stateObj, 'hvac_modes').includes('heat_cool') &&
isDefined(numericAttribute(stateObj, 'temperature')) &&
!isDefined(numericAttribute(stateObj, 'target_temp_low')) &&
!isDefined(numericAttribute(stateObj, 'target_temp_high')),
},
cool: {
service: 'set_temperature',
service_data: {
Expand All @@ -108,7 +125,10 @@ export const actionList: Record<string, Record<string, ActionItem>> = {
template: temperatureVariable,
},
},
condition: stateObj => listAttribute(stateObj, 'hvac_modes').includes('heat_cool'),
condition: stateObj =>
listAttribute(stateObj, 'hvac_modes').includes('heat_cool') &&
isDefined(numericAttribute(stateObj, 'target_temp_low')) &&
isDefined(numericAttribute(stateObj, 'target_temp_high')),
},
set_mode: {
service: 'set_hvac_mode',
Expand Down

0 comments on commit 12565a8

Please sign in to comment.