diff --git a/libnymea-modbus/tools/README.md b/libnymea-modbus/tools/README.md index d2387d0..4ac0c0a 100644 --- a/libnymea-modbus/tools/README.md +++ b/libnymea-modbus/tools/README.md @@ -127,7 +127,7 @@ Depending on your device the amount of errors in a row can vary and can be speci In order to check if the device is reachable, a register can be defined by the developer as a test register. For this purpose the `checkReachableRegister` property has been introduced. The property describes the `id` of the register which will be used for testing the communication. The register should be mandatory on the device -and only one register in size to speed up things. During the check the response data will be ignored, only the communication will be tested. The register must be *readable* and be defined in the `registers` section of your JSON file. +and only one register in size to speed up things. During the check the response data will be ignored, only the communication will be tested. The register must be *readable* and be defined in the `registers` section of your JSON file or in a block. ## Endianness diff --git a/libnymea-modbus/tools/generate-connection.py b/libnymea-modbus/tools/generate-connection.py index b402923..257cd89 100644 --- a/libnymea-modbus/tools/generate-connection.py +++ b/libnymea-modbus/tools/generate-connection.py @@ -758,6 +758,18 @@ for registerDefinition in registerJson['registers']: registerExists = True break +if 'blocks' in registerJson: + for blockDefinition in registerJson['blocks']: + for registerDefinition in blockDefinition['registers']: + if registerDefinition['id'] == checkReachableRegister: + if not 'R' in registerDefinition['access']: + logger.warning('Error: The specified \"checkReachableRegister\" is not readable. Please select a manadtory readable register as checkReachableRegister.') + exit(1) + + checkReachableRegister = registerDefinition + registerExists = True + break + if not registerExists: logger.warning('Error: Could not find the given \"checkReachableRegister\". Please make sure the specified register matches the \"id\" of a defined register.') exit(1)