Skip to content

Commit

Permalink
Make sure backward-compatibility works for Modbus registers
Browse files Browse the repository at this point in the history
  • Loading branch information
Jalle19 committed Aug 29, 2024
1 parent 4980bd4 commit a2bb1c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/config.sample.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ circuits:
address: 10.112.4.250
port: 502
unit: 100
register: h@866/int16
register: h@866/int16 # same as just 866
filters:
clamp: positive

Expand Down
9 changes: 9 additions & 0 deletions tests/modbus/register.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ import { ModbusRegister, parseRegisterDefinition, RegisterType } from '../../src

test('parse valid register definitions works', () => {
const definitions: { raw: string; parsed: ModbusRegister }[] = [
// Backward compatibility and sane default
{
'raw': '866',
'parsed': {
registerType: RegisterType.HOLDING_REGISTER,
address: 866,
dataType: 'int16',
}
},
{
'raw': 'i@32000/float',
'parsed': {
Expand Down

0 comments on commit a2bb1c9

Please sign in to comment.