maxwellhadley / node-red-contrib-rfxcom

node-RED nodes to access an RFXtrx433 transceiver
BSD 2-Clause "Simplified" License
22 stars 13 forks source link

Set mode from Node-RED? #11

Closed njh closed 6 years ago

njh commented 7 years ago

Hello,

I have been meaning to start using your node type for years, having built a hacky exec/command line script early on. I made some time over this weekend to switch over and it is working great, thank you! I now have node-red-dashboard work with it and little slidey switches going backwards and forwards, even when I use a LightwaveRF remote :)

One annoyance is that I don't have a Windows computer, so enabling and disabling receive modes in my rfxtrx is a bit of a pain - I use virtual machine to do it. Do you think it would be reasonable to add this functionality to your node?

Couple of ideas:

  1. Allow selection of modes from within each input node (and then OR them all together at startup)
  2. Allow selection of modes from within the configuration node
  3. Have some kind of setup dialog somewhere, with a 'Write Settings' button, to avoid writing to flash too frequently.

Years ago I started writing a cross-platform 'manager' using express+node: https://github.com/njh/node-rfxtrx-manager

But I am not sure it is useful enough on its own, so stopped development. Particularly because updating the firmware still requires Windows.

nick.

maxwellhadley commented 7 years ago

I've always been a bit cautious about this idea as it would be easy for an over-enthusiastic flow to damage the non-volatile memory in the rfxtrx, which has a very limited number of write cycles. It ought to be possible to make a command-line nodejs program to read, set and save the enabled protocols, using the underlying node-rfxcom package (of which I am also a maintainer). I'll take a look when I get a chance, not sure when that will be. It doesn't solve the issue of updating firmware though - that still needs a Windows machine. Which could be a VM, I suppose?

njh commented 7 years ago

I agree it isn't would be dangerous to accidentally keep writing to the non-volatile memory. And it is true that the settings needs to be changed infrequently.

I have successfully updated the firmware before from a Windows Virtual Machine. It is just a bit of a pain to get setup. Microsoft provide a free copy of Windows for 90 days: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

maxwellhadley commented 6 years ago

I have just pushed a commit to the underlying https://github.com/rfxcom/node-rfxcom/tree/start-version-1, which among many other things adds scripts to find rfxcom devices and to list, enable & save the receive protocols. To use this branch from node-RED you will need the updated node https://github.com/maxwellhadley/node-red-contrib-rfxcom/tree/use-node-rfxcom-1.0.0. These are basic command line scripts, to be run from node-rfxcom's install directory.

The command:

npm run find-rfxcom

Will list all the RFXCOM devices that serialport can find, with basic information about each device - including, most importantly, the _deviceport name of each.

The commands:

npm run set-protocols -- --list device_port
npm run set-protocols -- --save device_port
npm run set-protocols -- [--enable protocol_list] [--disable protocol_list] [--save] device_port

will list, save, and change the enabled protocols. A protocol_list is a comma-separated list of protocol identifying strings, like AC,LIGHTING4,OREGON. You can have multiple --enable and --disable switches on the command line. UNIX-style -l, -s, -e, and -d switches also work.

If you could give these a whirl and let me know how you get on I'd be very grateful! Note nothing is yet published to npm.

maxwellhadley commented 6 years ago

The latest version of the RFXCOM user guide now has a section about how to run rfxmgr on Linux using mono - that may be useful.

maxwellhadley commented 6 years ago

The latest version of node-rfxcom now includes working versions of the scripts above. Please update to the latest node-red-contrib-rfxcom version 2.1.1