Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acknowledgeAlarm - Wrong timestamp #174

Closed
1 of 3 tasks
cdriks opened this issue Sep 27, 2022 · 1 comment
Closed
1 of 3 tasks

acknowledgeAlarm - Wrong timestamp #174

cdriks opened this issue Sep 27, 2022 · 1 comment

Comments

@cdriks
Copy link

cdriks commented Sep 27, 2022

Node Version: 0.0.1-beta.14

Node BACstack Version: 18.9.0

  • Bug Report
  • Feature Request
  • Question

Current Behaviour (Bug Report)

Hi,
The acknowledgeAlarm method doesn't work properly with the timestamps. I receive an error class 5 (services) and an error code 14 (invalid-time-stamp), or an error code 7 (inconsistent-parameters).

Steps to reproduce Issue (Bug Report)

If I send following acknowledge command :

client.acknowledgeAlarm('10.10.10.10', { type: 0, instance: 18 }, 2, 'BACnet', { value: new Date("2022-09-27 14:53:25.20"), type: 2 }, { value: new Date(), type: 2 }, { invokeId: 54 }, (err, value) => {
        console.log(err)
})

I can see into Wireshark following telegramm:

Building Automation and Control Network APDU\
    0000 .... = APDU Type: Confirmed-REQ (0)
    .... 0000 = PDU Flags: 0x0
    .111 .... = Max Response Segments accepted: Greater than 64 segments (7)
    .... 0101 = Size of Maximum ADPU accepted: Up to 1476 octets (fits in an ISO 8802-3 frame) (5)
    Invoke ID: 54
    Service Choice: acknowledgeAlarm (0)
    acknowledging Process Id: (Unsigned) 81001
    ObjectIdentifier: analog-input, 18
    event State Acknowledged:  offnormal (2)
    {[3]
    {[2]
    date time: 
        Date: August 27, 2022, (Day of Week = Tuesday)
        Time: 2:53:25.20 P.M. = 14:53:25.20
    }[2]
    }[3]
    acknowledgement Source: UTF-8 'BACnet'
    {[5]
    {[2]
    acknowledgement timestamp: 
        Date: August 27, 2022, (Day of Week = Tuesday)
        Time: 3:08:02.2 P.M. = 15:08:02.2
    }[2]
    }[5]

Where the timestamps are wrong : August instead of September.

If I try to "cheat", and manually change the month, the day of week is not correct anymore.

Suggested correction

asn1.js, line 316

Increment the month :

buffer.buffer[buffer.offset++] = value.getMonth() + 1;

Thanks in advance!

Cédric

@cdriks
Copy link
Author

cdriks commented Nov 3, 2022

PR made : #177

@cdriks cdriks closed this as completed Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant