Xento / node-milight-rf24

This module can communicate with an Arduino with the sketch from https://github.com/henryk/openmili to communicate with milight/limitlessled/etc. 2.4GHz LED Bulbs.
GNU General Public License v2.0
9 stars 2 forks source link

Upgrade to serialport@6 #4

Open mwittig opened 5 years ago

mwittig commented 5 years ago

Are you still maintaining this? As part of pimatic we are looking at supporting node v8 and node v10 setups while keeping compatibility with node v4 for now. For this reason a migration to serialport v6 ist required as earlier raise build error with node v8 and 10 while v7 of seriaport no longer supports node v4. Are you in the position to work on this? I am happy to assist as some code changes may be required.

Xento commented 5 years ago

I don't have much time right now. Maybe you could make a PR with the required changes.

mwittig commented 5 years ago

Well, I'll see what I can do. Do you have a chance to test it? I don't have the equipment to test it right now.

mwittig commented 5 years ago

So far, I have done the necessary changes, but I have no means to test it. For the reader-side I had to do some guess work. Serialport@6 requires a Parser instance for handling the data to be read. From what I saw in the code my assumption is the protocol is ascii messaging with cr-lf delimiters. Thus, I have chosen the Delimiter parser with { delimiter: '\r\n', encoding: 'ascii' }. See also https://serialport.io/docs/en/guide-about#parsers for details.

Before I create a PR perhaps you can trial my fork?! This would be great https://github.com/mwittig/node-milight-rf24

Xento commented 5 years ago

I'm sorry I don't use this type of hardware any more.

https://serialport.io/docs/en/api-stream#data I think this should be the same as in the old version when you don't use a parser.

The parser with \r\n could work but then you have to adjust the data.length if in the data event because I think \r\n will be stripped of and the string will be shorter.

I'm using this https://github.com/sidoh/esp8266_milight_hub with openhab 2 and mqtt.