Support other relays and update status #3
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi gertst. This is my first ever pull request (!). As you know, I reported two issues...
Channels apart from Channel 1 were not being recognised for status and pushbutton events. We established that the original code was based on the VMB4RY relay. The protocols seem to be different for other relays. So, I have added in some code to check which relay it is. I have not looked at all the possible relays though as I am still very new to Velbus. I have added in the comments the relay protocols I have looked at.
Status was not always updated after a push button event, even with No.1 above. I have therefore moved the status update to the updateStatus function, and both the 'onSerialPacket' and 'input' events call this function to update.
Not sure if this is the correct way to do things. I think Velbus always sends a FA packet and the relay units respond with a FB packet. The velbus-relay.js does send an FA packet via the requestStatus() on deploy, but calling this after the input event only works occasionally, so this code is a bit of a workaround. I think there must be a better, more robust way, but I don't know enough of the Velbus protocols yet.