Jalle19 / eda-modbus-bridge

An HTTP/MQTT bridge for Enervent EDA ventilation units
GNU General Public License v3.0
14 stars 3 forks source link

Startup fails reading coil 51 #105

Closed ssalmela closed 6 months ago

ssalmela commented 6 months ago

Looks like on my Pandion eco EDE (MB v1.97, display v2.01) the program fails to start as it gets stuck reading coil 51.

helmi 01 07:59:31 ubuntu node[7095]: 2024-02-01T07:59:31.252Z [main] info: Connecting to MQTT broker at mqtt://192.168.52.68:1883
helmi 01 07:59:31 ubuntu node[7095]: 2024-02-01T07:59:31.252Z [main] info: Using MQTT broker authentication
helmi 01 07:59:31 ubuntu node[7095]: 2024-02-01T07:59:31.306Z [http] info: Listening on http://0.0.0.0:8080
helmi 01 07:59:31 ubuntu node[7095]: 2024-02-01T07:59:31.312Z [main] info: Successfully connected to MQTT broker at mqtt://192.168.52.68:1883
helmi 01 07:59:31 ubuntu node[7095]: 2024-02-01T07:59:31.312Z [modbus] debug: Retrieving device information...
helmi 01 07:59:31 ubuntu node[7095]: 2024-02-01T07:59:31.313Z [modbus] debug: Reading coil address 16, length 1
helmi 01 07:59:31 ubuntu node[7095]: 2024-02-01T07:59:31.334Z [modbus] debug: Reading coil address 51, length 1
helmi 01 07:59:36 ubuntu node[7095]: 2024-02-01T07:59:36.335Z [modbus] error: Failed to read coil address 51, length 1
helmi 01 07:59:36 ubuntu node[7095]: 2024-02-01T07:59:36.336Z [main] error: An exception occurred: TransactionTimedOutError: Timed out

The device is originally from 2009 but the EDA board was replaced in 2019. If I understand the older Enervent documentation, this coil 51 is not documented.

ssalmela commented 6 months ago

If getDeviceInformation is replaced with setting static device info, the first MQTT messages are published, and process continues but stops again at coil 52.

helmi 01 08:33:29 ubuntu node[7134]: 2024-02-01T08:33:29.851Z [mqtt] debug: Publising device information...
helmi 01 08:33:29 ubuntu node[7134]: 2024-02-01T08:33:29.854Z [modbus] debug: Reading coil address 0, length 13
helmi 01 08:33:29 ubuntu node[7134]: 2024-02-01T08:33:29.873Z [modbus] debug: Reading coil address 40, length 1
helmi 01 08:33:29 ubuntu node[7134]: 2024-02-01T08:33:29.889Z [modbus] debug: Retrieving device readings...
helmi 01 08:33:29 ubuntu node[7134]: 2024-02-01T08:33:29.890Z [modbus] debug: Reading holding register address 6, length 8
helmi 01 08:33:29 ubuntu node[7134]: 2024-02-01T08:33:29.920Z [modbus] debug: Reading holding register address 29, length 7
helmi 01 08:33:29 ubuntu node[7134]: 2024-02-01T08:33:29.952Z [modbus] debug: Reading holding register address 47, length 3
helmi 01 08:33:29 ubuntu node[7134]: 2024-02-01T08:33:29.968Z [modbus] debug: Reading holding register address 56, length 1
helmi 01 08:33:29 ubuntu node[7134]: 2024-02-01T08:33:29.984Z [modbus] debug: Reading holding register address 50, length 4
helmi 01 08:33:30 ubuntu node[7134]: 2024-02-01T08:33:30.000Z [modbus] debug: Reading holding register address 104, length 6
helmi 01 08:33:30 ubuntu node[7134]: 2024-02-01T08:33:30.016Z [modbus] debug: Reading holding register address 23, length 6
helmi 01 08:33:30 ubuntu node[7134]: 2024-02-01T08:33:30.032Z [modbus] debug: Retrieving device settings...
helmi 01 08:33:30 ubuntu node[7134]: 2024-02-01T08:33:30.033Z [modbus] debug: Reading holding register address 57, length 1
helmi 01 08:33:30 ubuntu node[7134]: 2024-02-01T08:33:30.048Z [modbus] debug: Reading holding register address 100, length 4
helmi 01 08:33:30 ubuntu node[7134]: 2024-02-01T08:33:30.064Z [modbus] debug: Reading holding register address 135, length 1
helmi 01 08:33:30 ubuntu node[7134]: 2024-02-01T08:33:30.080Z [modbus] debug: Reading coil address 52, length 3
helmi 01 08:33:35 ubuntu node[7134]: 2024-02-01T08:33:35.080Z [modbus] error: **Failed to read coil address 52, length 3**
helmi 01 08:33:35 ubuntu node[7134]: 2024-02-01T08:33:35.081Z [main] error: An exception occurred: TransactionTimedOutError: Timed out
ssalmela commented 6 months ago

When also getSettings is replaced with hardcoded values, the program starts normally.

export const getSettings = async (modbusClient) => {
    logger.debug('Retrieving device settings...');

    // Example of hardcoded settings based on known device capabilities
    let settings = {
        // Heating installed, cooling not installed
        'coolingAllowed': false,
        'heatingAllowed': true,
    };

As a conclusion, this particular Pandion hardware cannot return parameters for getDeviceInformation or getSettings from coils 51 and 52.

Also all the write operations appear to fail as well.

helmi 01 10:48:14 ubuntu node[7336]: 2024-02-01T10:48:14.605Z [mqtt] info: Received ON on topic eda/mode/manualBoost/set
helmi 01 10:48:14 ubuntu node[7336]: 2024-02-01T10:48:14.606Z [mqtt] info: Updating mode manualBoost to true
helmi 01 10:48:14 ubuntu node[7336]: 2024-02-01T10:48:14.607Z [modbus] debug: Writing true to coil address 10
helmi 01 10:48:19 ubuntu node[7336]: 2024-02-01T10:48:19.610Z [modbus] error: Failed to write coil address 10, value true
helmi 01 10:48:19 ubuntu node[7336]: node:internal/process/promises:288
helmi 01 10:48:19 ubuntu node[7336]:             triggerUncaughtException(err, true /* fromPromise */);
helmi 01 10:48:19 ubuntu node[7336]:             ^
helmi 01 10:48:19 ubuntu node[7336]: [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting at handled with .catch(). The promise rejected with the reason "#<TransactionTimedOutError>".] {
helmi 01 10:48:19 ubuntu node[7336]:   code: 'ERR_UNHANDLED_REJECTION'
helmi 01 10:48:19 ubuntu node[7336]: }
helmi 01 10:48:19 ubuntu node[7336]: Node.js v18.19.0
helmi 01 10:48:19 ubuntu systemd[1]: eda-modbus-bridge.service: Main process exited, code=exited, status=1/FAILURE
helmi 01 10:48:19 ubuntu systemd[1]: eda-modbus-bridge.service: Failed with result 'exit-code'.
Jalle19 commented 6 months ago

Can you try an older version like 2.5.0?

ssalmela commented 6 months ago

Can you try an older version like 2.5.0?

That fixed the device and setting recognition, thanks! However, the writing of anything still fails. But this could be some kind of hardware limitation with this device as also some of the features like "away" and "long away" don't appear to activate through the EDA wall panel.

helmi 01 11:56:13 ubuntu systemd[1]: Started HTTP bridge for Enervent ventilation units with EDA automation.
helmi 01 11:56:13 ubuntu node[1443]: 2024-02-01T11:56:13.924Z [main] info: Opening serial connection to /dev/ttyUSB0, slave ID 1
helmi 01 11:56:13 ubuntu node[1443]: 2024-02-01T11:56:13.937Z [main] info: Connecting to MQTT broker at mqtt://192.168.52.68:1883
helmi 01 11:56:13 ubuntu node[1443]: 2024-02-01T11:56:13.937Z [main] info: Using MQTT broker authentication
helmi 01 11:56:13 ubuntu node[1443]: 2024-02-01T11:56:13.974Z [http] info: Listening on http://0.0.0.0:8080
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.010Z [main] info: Successfully connected to MQTT broker at mqtt://192.168.52.68:1883
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.109Z [main] info: MQTT scheduler started, will publish readings every 10 seconds
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.110Z [mqtt] info: Subscribing to topic(s) eda/mode/+/set
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.112Z [mqtt] info: Subscribing to topic(s) eda/settings/+/set
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.204Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "freshAirTemperature"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.205Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "supplyAirTemperature"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.205Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "supplyAirTemperatureAfterHeatRecovery"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.205Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "exhaustAirTemperature"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.206Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "wasteAirTemperature"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.206Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "exhaustAirHumidity"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.206Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "mean48HourExhaustHumidity"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.207Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "heatRecoverySupplySide"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.207Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "heatRecoveryExhaustSide"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.207Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "cascadeSp"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.207Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "cascadeP"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.207Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "cascadeI"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.208Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "overPressureTimeLeft"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.208Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "ventilationLevelTarget"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.208Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for sensor "ventilationLevelActual"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.208Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for number "overPressureDelay"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.209Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for number "awayVentilationLevel"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.209Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for number "awayTemperatureReduction"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.209Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for number "longAwayVentilationLevel"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.209Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for number "longAwayTemperatureReduction"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.210Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for number "temperatureTarget"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.210Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for switch "away"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.210Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for switch "longAway"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.210Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for switch "overPressure"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.211Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for switch "maxHeating"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.211Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for switch "maxCooling"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.211Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for switch "manualBoost"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.211Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for switch "summerNightCooling"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.211Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for switch "eco"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.212Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "TE5SupplyAirAfterHRCold"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.212Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "TE10SupplyAirAfterHeaterCold"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.212Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "TE10SupplyAirAfterHeaterHot"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.212Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "TE20RoomTempHot"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.213Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "TE30ExtractAirCold"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.214Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "TE30ExtractAirHot"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.214Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "HPError"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.214Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "EHError"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.215Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "ReturnWaterCold"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.215Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "HRError"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.215Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "CoolingError"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.216Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "EmergencyStop"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.216Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "FireRisk"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.216Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "ServiceReminder"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.216Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "EHPDA"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.217Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "SupplyFilterDirty"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.218Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "ExtractFilterDirty"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.218Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "SupplyFanPressureError"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.218Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "ExtractFanPressureError"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.219Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "normal"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.219Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "maxCooling"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.219Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "maxHeating"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.220Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "emergencyStop"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.220Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "stop"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.220Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "away"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.220Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "longAway"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.221Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "temperatureBoost"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.221Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "co2Boost"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.221Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "humidityBoost"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.222Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "manualBoost"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.222Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "overPressure"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.222Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "cookerHood"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.222Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "centralVacuumCleaner"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.223Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "heaterCooldown"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.223Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "summerNightCooling"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.223Z [homeassistant] info: Publishing Home Assistant auto-discovery configuration for binary_sensor "defrosting"...
helmi 01 11:56:14 ubuntu node[1443]: 2024-02-01T11:56:14.224Z [main] info: Finished configuration Home Assistant MQTT discovery
helmi 01 11:56:22 ubuntu node[1443]: 2024-02-01T11:56:22.175Z [mqtt] info: Received ON on topic eda/mode/manualBoost/set
helmi 01 11:56:22 ubuntu node[1443]: 2024-02-01T11:56:22.176Z [mqtt] info: Updating mode manualBoost to ON
helmi 01 11:56:27 ubuntu node[1443]: 2024-02-01T11:56:27.180Z [modbus] error: Failed to write coil address 10, value true
helmi 01 11:56:27 ubuntu node[1443]: node:internal/process/promises:288
helmi 01 11:56:27 ubuntu node[1443]:             triggerUncaughtException(err, true /* fromPromise */);
helmi 01 11:56:27 ubuntu node[1443]:             ^
helmi 01 11:56:27 ubuntu node[1443]: [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<TransactionTimedOutError>".] {
helmi 01 11:56:27 ubuntu node[1443]:   code: 'ERR_UNHANDLED_REJECTION'
helmi 01 11:56:27 ubuntu node[1443]: }
helmi 01 11:56:27 ubuntu node[1443]: Node.js v18.19.0
helmi 01 11:56:27 ubuntu systemd[1]: eda-modbus-bridge.service: Main process exited, code=exited, status=1/FAILURE
helmi 01 11:56:27 ubuntu systemd[1]: eda-modbus-bridge.service: Failed with result 'exit-code'.
Jalle19 commented 6 months ago

Okay, I'll try to fix the startup issue. https://github.com/Jalle19/eda-modbus-bridge/issues/104#issuecomment-1917709559 here version 2.01 is referred to as "wanha" (😅), and apparently these really refuse to answer to undocumented registers.

Very strange that the unit is read-only, I have not encountered that before. Can you verify that the device is configured to use Modbus address 1, not 0 (see https://github.com/Jalle19/eda-modbus-bridge/blob/master/docs/CONNECTION.md#troubleshooting)?

ssalmela commented 6 months ago

image

image

Pretty strange they installed an older firmware to new replacement motherboard in 2020, when end of sales was already four years earlier 😳

Jalle19 commented 6 months ago

FWIW, in an e-mail conversation I had with Enervent we tried solving the same problem you're having (modes cannot be changed via Modbus) and in that case the problem was the Modbus address was set to 0, both on the unit itself and by specifying --modbusSlave 0. Are you sure you're running it with --modbusSlave 1 (or without that switch at all, defaulting to 1)?

Jalle19 commented 6 months ago

Nevermind, I see in your logs that you're using slave 1:

main] info: Opening serial connection to /dev/ttyUSB0, slave ID 1

ssalmela commented 6 months ago

I have sent an email to Enervent, asking what could cause the read-only behaviour and if firmware upgrade would be possible.

ssalmela commented 6 months ago

Removing my earlier comment due to error in mboll logics. Apologies again for confusion.

ssalmela commented 6 months ago

@Jalle19 sorry for the confusion earlier. Regardless of the mistakes earlier, I think I have found the reason for issues with this legacy device.

It doesn't appear to handle reading or writing single coil correctly, but if you do it for multiple, it works:

samuli@ubuntu:/opt/eda-modbus-bridge-samuli$ mbpoll /dev/ttyUSB0 -m rtu -b 19200 -P none -a 1 -r 1 -t 0 -c 4 -1 -o 2
mbpoll 1.0-0 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright © 2015-2019 Pascal JEAN, https://github.com/epsilonrt/mbpoll
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'mbpoll -w' for details.

Protocol configuration: Modbus RTU
Slave configuration...: address = [1]
                        start reference = 1, count = 4
Communication.........: /dev/ttyUSB0,      19200-8N1
                        t/o 2.00 s, poll rate 1000 ms
Data type.............: discrete output (coil)

-- Polling slave 1...
[1]:    0
[2]:    0
[3]:    0
[4]:    0

samuli@ubuntu:/opt/eda-modbus-bridge-samuli$ mbpoll /dev/ttyUSB0 -m rtu -b 19200 -P none -a 1 -r 1 -t 0x -1 -o 2 0 0 0 1
mbpoll 1.0-0 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright © 2015-2019 Pascal JEAN, https://github.com/epsilonrt/mbpoll
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'mbpoll -w' for details.

Protocol configuration: Modbus RTU
Slave configuration...: address = [1]
                        start reference = 1, count = 4
Communication.........: /dev/ttyUSB0,      19200-8N1
                        t/o 2.00 s, poll rate 1000 ms
Data type.............: discrete output (coil)

Written 4 references.

samuli@ubuntu:/opt/eda-modbus-bridge-samuli$ mbpoll /dev/ttyUSB0 -m rtu -b 19200 -P none -a 1 -r 1 -t 0 -c 4 -1 -o 2
mbpoll 1.0-0 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright © 2015-2019 Pascal JEAN, https://github.com/epsilonrt/mbpoll
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'mbpoll -w' for details.

Protocol configuration: Modbus RTU
Slave configuration...: address = [1]
                        start reference = 1, count = 4
Communication.........: /dev/ttyUSB0,      19200-8N1
                        t/o 2.00 s, poll rate 1000 ms
Data type.............: discrete output (coil)

-- Polling slave 1...
[1]:    0
[2]:    0
[3]:    0
[4]:    1

samuli@ubuntu:/opt/eda-modbus-bridge-samuli$ mbpoll /dev/ttyUSB0 -m rtu -b 19200 -P none -a 1 -r 4 -t 5 -1 -o 2 0
mbpoll: Illegal function: 5 ! Try -h for help.

Even the coil 51 can be read if I read all the 72 coils in one go:

samuli@ubuntu:/opt/eda-modbus-bridge-samuli$ mbpoll /dev/ttyUSB0 -m rtu -b 19200 -P none -a 1 -r 1 -t 0 -c 72 -1 -o 2
mbpoll 1.0-0 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright © 2015-2019 Pascal JEAN, https://github.com/epsilonrt/mbpoll
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'mbpoll -w' for details.

Protocol configuration: Modbus RTU
Slave configuration...: address = [1]
                        start reference = 1, count = 72
Communication.........: /dev/ttyUSB0,      19200-8N1
                        t/o 2.00 s, poll rate 1000 ms
Data type.............: discrete output (coil)

-- Polling slave 1...
[1]:    0
[2]:    0
[3]:    0
[4]:    1
[5]:    0
[6]:    0
[7]:    0
[8]:    0
[9]:    1
[10]:   0
[11]:   0
[12]:   0
[13]:   0
[14]:   1
[15]:   0
[16]:   0
[17]:   1
[18]:   1
[19]:   1
[20]:   0
[21]:   1
[22]:   0
[23]:   1
[24]:   0
[25]:   0
[26]:   0
[27]:   0
[28]:   0
[29]:   0
[30]:   0
[31]:   0
[32]:   0
[33]:   0
[34]:   1
[35]:   0
[36]:   0
[37]:   0
[38]:   0
[39]:   1
[40]:   1
[41]:   0
[42]:   0
[43]:   0
[44]:   0
[45]:   0
[46]:   1
[47]:   0
[48]:   0
[49]:   1
[50]:   1
[51]:   0
[52]:   0
[53]:   0
[54]:   1
[55]:   1
[56]:   0
[57]:   1
[58]:   0
[59]:   0
[60]:   0
[61]:   0
[62]:   0
[63]:   0
[64]:   0
[65]:   1
[66]:   1
[67]:   1
[68]:   0
[69]:   1
[70]:   1
[71]:   1
[72]:   1
ssalmela commented 6 months ago

Confirmed: writing for this device is possible if all the coils [0...n] are written in one command.

So, the only way I have found how toggle manual boost on is to read values of 11 first coils, inverting value of coil 11 and writing all 11 immediatelly. Not elegant but works:

toggle_manual_boost_sh.txt

./toggle_manual_boost.sh
Before: 0 0 0 0 0 0 0 0 1 0 0
Protocol configuration: Modbus RTU
Slave configuration...: address = [1]
                        start reference = 1, count = 11
Communication.........: /dev/ttyUSB0,      19200-8N1
                        t/o 2.00 s, poll rate 1000 ms
Data type.............: discrete output (coil)

Written 11 references.

After: 0 0 0 0 0 0 0 0 1 0 1
Jalle19 commented 6 months ago

Very strange. I would still try another RS-485 adapter, could be that it behaves differently. I've had great success with Waveshare.

ssalmela commented 6 months ago

Yes, perhaps they have implemented incorrectly the single registry read/write function on this one:

ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC

However, good to recognize that someone on Älykoti-facebook group mentioned that some of these devices don't accept single entries.

Jalle19 commented 6 months ago
DEVLINKS: >-
  /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AG0KBDA8-if00-port0
  /dev/serial/by-path/pci-0000:02:00.0-usb-0:2.1:1.0-port0
DEVNAME: /dev/ttyUSB0
DEVPATH: >-
  /devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.1/2-2.1:1.0/ttyUSB0/tty/ttyUSB0
ID_BUS: usb
ID_MODEL: FT232R_USB_UART
ID_MODEL_ENC: FT232R\x20USB\x20UART
ID_MODEL_ID: '6001'
ID_PATH: pci-0000:02:00.0-usb-0:2.1:1.0
ID_PATH_TAG: pci-0000_02_00_0-usb-0_2_1_1_0
ID_REVISION: '0600'
ID_SERIAL: FTDI_FT232R_USB_UART_AG0KBDA8
ID_SERIAL_SHORT: AG0KBDA8
ID_TYPE: generic
ID_USB_DRIVER: ftdi_sio
ID_USB_INTERFACES: ':ffffff:'
ID_USB_INTERFACE_NUM: '00'
ID_USB_MODEL: FT232R_USB_UART
ID_USB_MODEL_ENC: FT232R\x20USB\x20UART
ID_USB_MODEL_ID: '6001'
ID_USB_REVISION: '0600'
ID_USB_SERIAL: FTDI_FT232R_USB_UART_AG0KBDA8
ID_USB_SERIAL_SHORT: AG0KBDA8
ID_USB_TYPE: generic
ID_USB_VENDOR: FTDI
ID_USB_VENDOR_ENC: FTDI
ID_USB_VENDOR_ID: '0403'
ID_VENDOR: FTDI
ID_VENDOR_ENC: FTDI
ID_VENDOR_ID: '0403'
MAJOR: '188'
MINOR: '0'
SUBSYSTEM: tty
TAGS: ':systemd:'
USEC_INITIALIZED: '5425468'

This is what Home Assistant says about mine

ssalmela commented 6 months ago

The same manufacturer and even the same model. Either my device is faulty, or my Enervent device is just very picky in functions that it accepts.

At least the mode settings (which are in the first coils) could be implemented with the logic I wrote, but as temperature setting is in holding register #136 it is a bit extreme to write all values before that.

ssalmela commented 6 months ago

New finding! The reading can be done in segments, probably writing as well. Just like the individual reading was possible for coils 1, 9, 17, 25... I can also read multiple if I start from those - but not in between!

samuli@ubuntu:/opt/eda-modbus-bridge-samuli$ mbpoll /dev/ttyUSB0 -m rtu -b 19200 -P none -a 1 -r 8 -c 8 -t 0 -1 -o 2
mbpoll 1.0-0 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright © 2015-2019 Pascal JEAN, https://github.com/epsilonrt/mbpoll
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'mbpoll -w' for details.

Protocol configuration: Modbus RTU
Slave configuration...: address = [1]
                        start reference = 8, count = 8
Communication.........: /dev/ttyUSB0,      19200-8N1
                        t/o 2.00 s, poll rate 1000 ms
Data type.............: discrete output (coil)

-- Polling slave 1...
Read discrete output (coil) failed: **Connection timed out**

samuli@ubuntu:/opt/eda-modbus-bridge-samuli$ mbpoll /dev/ttyUSB0 -m rtu -b 19200 -P none -a 1 -r 9 -c 8 -t 0 -1 -o 2
mbpoll 1.0-0 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright © 2015-2019 Pascal JEAN, https://github.com/epsilonrt/mbpoll
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'mbpoll -w' for details.

Protocol configuration: Modbus RTU
Slave configuration...: address = [1]
                        start reference = 9, count = 8
Communication.........: /dev/ttyUSB0,      19200-8N1
                        t/o 2.00 s, poll rate 1000 ms
Data type.............: discrete output (coil)

-- Polling slave 1...
**[9]:    1
[10]:   0
[11]:   0
[12]:   0
[13]:   0
[14]:   0
[15]:   0
[16]:   0**

samuli@ubuntu:/opt/eda-modbus-bridge-samuli$ mbpoll /dev/ttyUSB0 -m rtu -b 19200 -P none -a 1 -r 10 -c 8 -t 0 -1 -o 2
mbpoll 1.0-0 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright © 2015-2019 Pascal JEAN, https://github.com/epsilonrt/mbpoll
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type 'mbpoll -w' for details.

Protocol configuration: Modbus RTU
Slave configuration...: address = [1]
                        start reference = 10, count = 8
Communication.........: /dev/ttyUSB0,      19200-8N1
                        t/o 2.00 s, poll rate 1000 ms
Data type.............: discrete output (coil)

-- Polling slave 1...
Read discrete output (coil) failed: **Connection timed out**