Skip to content

Commit

Permalink
[fixup] don't expose cooling
Browse files Browse the repository at this point in the history
  • Loading branch information
Jalle19 committed Feb 3, 2024
1 parent c5242bb commit 1bccecb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
16 changes: 12 additions & 4 deletions app/homeassistant.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -268,22 +268,30 @@ export const configureMqttDiscovery = async (modbusClient, mqttClient) => {
'awayCoolingAllowed': createSettingSwitchConfiguration(
configurationBase,
'awayCoolingAllowed',
'Cooling allowed (away mode)'
'Cooling allowed (away mode)',
// Not supported by some units
{ 'enabled_by_default': automationType !== AUTOMATION_TYPE_LEGACY_EDA }
),
'awayHeatingAllowed': createSettingSwitchConfiguration(
configurationBase,
'awayHeatingAllowed',
'Heating allowed (away mode)'
'Heating allowed (away mode)',
// Not supported by some units
{ 'enabled_by_default': automationType !== AUTOMATION_TYPE_LEGACY_EDA }
),
'longAwayCoolingAllowed': createSettingSwitchConfiguration(
configurationBase,
'longAwayCoolingAllowed',
'Cooling allowed (long away mode)'
'Cooling allowed (long away mode)',
// Not supported by some units
{ 'enabled_by_default': automationType !== AUTOMATION_TYPE_LEGACY_EDA }
),
'longAwayHeatingAllowed': createSettingSwitchConfiguration(
configurationBase,
'longAwayHeatingAllowed',
'Heating allowed (long away mode)'
'Heating allowed (long away mode)',
// Not supported by some units
{ 'enabled_by_default': automationType !== AUTOMATION_TYPE_LEGACY_EDA }
),
}

Expand Down
21 changes: 10 additions & 11 deletions app/modbus.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ export const getSettings = async (modbusClient) => {
'temperatureTarget': parseTemperature(result.data[0]),
}

// Heating/cooling/heat recovery enabled in normal mode (not available on some devices)
// Heating/cooling/heat recovery enabled in normal/away/long away modes (not available on some devices).
// Note that the register order is swapped when querying register 18-21 compared to 52-55.
const deviceInformation = await getDeviceInformation(modbusClient)
if (deviceInformation.automationType !== AUTOMATION_TYPE_LEGACY_EDA) {
result = await mutex.runExclusive(async () => tryReadCoils(modbusClient, 52, 3))
Expand All @@ -205,17 +206,15 @@ export const getSettings = async (modbusClient) => {
'coolingAllowed': result.data[0],
'heatingAllowed': result.data[2],
}
}

// Heating/cooling/heat recovery enabled in away/long away modes. Note that the register order is swapped
// when querying register 18-21 compared to 52-55.
result = await mutex.runExclusive(async () => tryReadCoils(modbusClient, 18, 4))
settings = {
...settings,
'awayCoolingAllowed': result.data[1],
'awayHeatingAllowed': result.data[0],
'longAwayCoolingAllowed': result.data[3],
'longAwayHeatingAllowed': result.data[2],
result = await mutex.runExclusive(async () => tryReadCoils(modbusClient, 18, 4))
settings = {
...settings,
'awayCoolingAllowed': result.data[1],
'awayHeatingAllowed': result.data[0],
'longAwayCoolingAllowed': result.data[3],
'longAwayHeatingAllowed': result.data[2],
}
}

return settings
Expand Down

0 comments on commit 1bccecb

Please sign in to comment.