Skip to content

Commit

Permalink
Add optional sensors for control panel temperature and supply/exhaust
Browse files Browse the repository at this point in the history
fan speeds

These values are not available on all units so they're limited to MD
units for now

Closes #96, replaces #97
  • Loading branch information
Jalle19 committed Feb 7, 2024
1 parent db1807e commit f4fa24a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Add rudimentary way of differentiating between different automation types
* Disable "heating/cooling allowed" on legacy EDA units, fixes crash (https://github.com/Jalle19/eda-modbus-bridge/issues/105)
* Disable "eco" mode switch on older units (https://github.com/Jalle19/eda-modbus-bridge/issues/104)
* Add optional sensors for control panel temperature, supply fan speed and exhaust fan speed (https://github.com/Jalle19/eda-modbus-bridge/issues/96)

## 2.7.1

Expand Down
21 changes: 21 additions & 0 deletions app/homeassistant.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,27 @@ export const configureMqttDiscovery = async (modbusClient, mqttClient) => {
'Room temperature #3',
{ 'enabled_by_default': false }
),
// Optional sensors that are only guaranteed to work on MD automation units
'controlPanel1Temperature': createTemperatureSensorConfiguration(
configurationBase,
'controlPanel1Temperature',
'Control panel #1 temperature',
{ 'enabled_by_default': automationType === AUTOMATION_TYPE_MD }
),
'controlPanel2Temperature': createTemperatureSensorConfiguration(
configurationBase,
'controlPanel2Temperature',
'Control panel #2 temperature',
{ 'enabled_by_default': automationType === AUTOMATION_TYPE_MD }
),
'supplyFanSpeed': createSensorConfiguration(configurationBase, 'supplyFanSpeed', 'Supply fan speed', {
'unit_of_measurement': '%',
'enabled_by_default': automationType === AUTOMATION_TYPE_MD,
}),
'exhaustFanSpeed': createSensorConfiguration(configurationBase, 'exhaustFanSpeed', 'Exhaust fan speed', {
'unit_of_measurement': '%',
'enabled_by_default': automationType === AUTOMATION_TYPE_MD,
}),
}

// Configurable numbers
Expand Down
13 changes: 13 additions & 0 deletions app/modbus.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,19 @@ export const getReadings = async (modbusClient) => {
}
}

// Sensors that only work reliably on MD automation devices
const deviceInformation = await getDeviceInformation(modbusClient)
if (deviceInformation.automationType === AUTOMATION_TYPE_MD) {
result = await mutex.runExclusive(async () => tryReadHoldingRegisters(modbusClient, 1, 4))
readings = {
...readings,
'controlPanel1Temperature': parseTemperature(result.data[0]),
'controlPanel2Temperature': parseTemperature(result.data[1]),
'supplyFanSpeed': result.data[2],
'exhaustFanSpeed': result.data[3],
}
}

return readings
}

Expand Down

0 comments on commit f4fa24a

Please sign in to comment.