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

Update dependencies: queue 6.0.0, serialport 8.0.5, date-format 3.0.0… #90

Merged
merged 1 commit into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 50 additions & 5 deletions DeviceCommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Devices:
BLINDS_T12
BLINDS_T13
BLINDS_T14
BLINDS_T15 (not yet implemented in the RFXCOM firmware)
BLINDS_T15
BLINDS_T16

Commands:
Expand All @@ -45,6 +45,7 @@ Commands:
Blinds1.up()
Blinds1.venetianIncreaseAngle()
Blinds1.venetianDecreaseAngle()
Blinds1.toggleLightOnOff()

Camera1
-------
Expand All @@ -67,11 +68,12 @@ Chime1
---------

Devices:

BYRON_SX
BYRON_MP001
SELECT_PLUS
BYRON_BY
ENVIVO
ALFAWISE

Commands:

Expand All @@ -91,6 +93,31 @@ Commands:
Curtain1.stop()
Curtain1.program()

Edisio
------

Devices:

EDISIO_CONTROLLER

Commands:

Edisio.sitchOff()
Edisio.switchOn()
Edisio.toggleOnOff()
Edisio.setLevel()
Edisio.increaseLevel()
Edisio.decreaseLevel()
Edisio.toggleDimming()
Edisio.stopDimming()
Edisio.setColour()
Edisio.program()
Edisio.open()
Edisio.stop()
Edisio.close()
Edisio.sendContactNormal()
Edisio.sendContactAlert()

Fan
----

Expand All @@ -106,6 +133,8 @@ Devices:
FT1211R
FALMEC
LUCCI_AIR_DCII
ITHO_CVE_ECO_RFT
NOVY

Commands:

Expand All @@ -121,9 +150,11 @@ Commands:
Fan.toggleLightOnOff()
Fan.switchLightOn()
Fan.switchLightOff()
Fan.learn()
Fan.program()
Fan.confirm()
Fan.eraseAll()
Fan.standby()
Fan.resetFilter()

The Fan button names (subtype SEAV_TXS4 only) are *T1*, *T2*, *T3*, and *T4*

Expand Down Expand Up @@ -157,7 +188,21 @@ Commands:

HomeConfort.switchOn()
HomeConfort.switchOff()


HunterFan
---------

Devices:

HUNTER_FAN

Commands:

HunterFan.switchOff()
HunterFan.toggleLightOnOff()
HunterFan.setSpeed()
HunterFan.program()

Lighting1
---------

Expand Down Expand Up @@ -344,7 +389,7 @@ Commands:
Rfy.listRemotes()
Rfy.program()

Rfy.do()
Rfy.doCommand()

Security1
---------
Expand Down
58 changes: 39 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To install
npm install rfxcom
</pre>

Depends on serialport ^7.1.1 and queue ^5.0.0
Depends on serialport ^8.0.5, date-format ^3.0.0, and queue ^5.0.0

To Use
------
Expand Down Expand Up @@ -51,7 +51,6 @@ Sending Commands
Prototype transmitter objects are provided for almost all packet types (see the RFXCOM manual for details). The only
packet types which can be transmitted but are *not* currently supported are:

* 0x1C, Edisio (868 MHz devices only)
* 0x1D, Honeywell ActivLink (868 MHz devices only)
* 0x21, Security2
* 0x61, ASYNC port configuration (RFXtrx433XL only)
Expand All @@ -72,7 +71,7 @@ may contain.

LightwaveRf
-----------
LightwaveRf devices use the specialised Lighting5 transmitter, which itself uses an RfxCom object.
LightwaveRf devices use the Lighting5 transmitter:

<pre>
var rfxcom = require('rfxcom');
Expand All @@ -87,7 +86,7 @@ rfxtrx.initialise(function () {
});
</pre>

I've tested it with both LightwaveRf lights, and the relay switch.
It has been tested with both LightwaveRf lights, and the relay switch.

LightwaveRf lights get their identity from the remote used to pair, if you don't
have a remote, or if you want to specify the address manually, you can pair the
Expand All @@ -104,16 +103,17 @@ HomeEasy: the ones marketed in UK are of type 'AC', while those in the Netherlan
var rfxtrx = new rfxcom.RfxCom("/dev/ttyUSB0", {debug: true}),
lighting2 = new rfxcom.Lighting2(rfxtrx, rfxcom.lighting2.HOMEEASY_EU);

lighting2.switchOn("0xF09AC8AA/1");
lighting2.switchOff("0xF09AC8AA/1");
lighting2.switchOn("0x19AC8AA/1");
lighting2.switchOff("0x19AC8AA/1");
</pre>

Rfy (Somfy) Blinds
------------------
There is a specialised Rfy transmitter object. This supports three subtypes: 'RFY', 'RFYEXT'
and 'ASA', one of which must be supplied to the Rfy constructor. RFY support requires an RFXtrx433E. The 'RFY' and 'RFYEXT'
subtypes can control venetian blinds, but the command modes differ between EU and US supplied blinds motors. The mode
is specified by passing an options parameter to the constructor. The valid modes are `'EU'` and `'US'`: the default is `'EU'`.
and 'ASA', one of which must be supplied to the Rfy constructor. RFY support requires an RFXtrx433E or RFXtrx433XL.
The 'RFY' and 'RFYEXT' subtypes can control venetian blinds, but the command modes differ between EU and US
supplied blinds motors. The mode is specified by passing an options parameter to the constructor.
The valid modes are `'EU'` and `'US'`. The default is `'EU'`.
You can change the mode subsequently by calling the setOption() method with a new options parameter.

<pre>
Expand All @@ -126,27 +126,27 @@ You can change the mode subsequently by calling the setOption() method with a ne
if (!err) console.log('complete');
});
// The ID can be supplied as an array with address & unitcode elements (strings)
rfy.do(["0x10203", "1"], "down");
rfy.doCommand(["0x10203", "1"], "down");
// The eraseAll() and listRemotes() commands DO NOT take an ID parameter, all the others do
rfy.listRemotes();
rfy.eraseAll(callback);
</pre>

Supported commands include standard operations such as up(), down(), and stop(), as well
Supported commands include standard operations such as `up()`, `down()`, and `stop()`, as well
as the programming commands:
program(), erase(), eraseAll(), and listRemotes().
All other commands can be accessed using the do() command - see the
RfyCommands list in defines.js for the complete list of available commands.
`program()`, `erase()`, `eraseAll()`, and `listRemotes()`.
All other commands can be accessed using the `doCommand()` method - see the *Rfy* entry in DeviceCommands.md
for the complete list of available commands.

To 'pair' the RFX as a new remote control with a Somfy blind motor,
press and hold 'program' *on the existing Somfy remote controller* until the blind responds with a 'jog'
motion. Then send a program() command to the RFXtrx433E, with the ID parameter set to an address/unit code
motion. Then send a `program()` command to the RFXtrx433E, with the ID parameter set to an address/unit code
combination of your choice - this needs to be unique within the RFXtrx433E's list, but is otherwise
arbitrary. Limits for the address are 0x1 to 0xFFFFF; limits for the unitcode are 0x0 to 0x4 for RFY
subtype devices, 0x0 to 0xf for RFYEXT devices, and 0x1 to 0x5 for ASA devices.

To list all the remotes (of either RFY or ASA subtype) send a listRemotes() command; to erase a single
entry from the list, send erase(ID) where ID is the address/unitcode of the entry to erase; or eraseAll()
To list all the remotes (of either RFY or ASA subtype) send a `listRemotes()` command; to erase a single
entry from the list, send `erase(ID)` where ID is the address/unitcode of the entry to erase; or `eraseAll()`
to clear the list.

Transmitter
Expand Down Expand Up @@ -211,7 +211,7 @@ simulated remote control:
* idBytes: Address as an array of 3 bytes, e.g. [0x00, 0x01, 0x23]
* unitCode: Unit code as a byte, e.g. 0x02

This event is emitted approximately 10s after the `listRemotes()` command is given, as the only way to detect the end of
This event is emitted approximately 12s after the `listRemotes()` command is given, as the only way to detect the end of
the list is to wait for the response timeout - the RFXtrx433E does not send an 'end of list' packet.

"status"
Expand Down Expand Up @@ -315,6 +315,14 @@ Emitted when a message is received from an RFXCOM rfxsensor device.
----------
Emitted whan a message is received from an RFXCOM rfxmeter device.

"weather"
---------
Emitted when a message is received from a remote multi-function weather station

"solar"
-------
Emitted when a message is received from a remote insolation sensor

RfxCom received data events - remote controls
=============================================

Expand Down Expand Up @@ -352,10 +360,22 @@ Emitted when data arrives from Byron or similar doorbell pushbutton
---------
Emitted when a message arrives from a compatible type 1 blinds remote controller (only a few subtypes can be received)

"fan"
-----
Emitted when a message arrives from a supported type of fan remote control (not Hunter fans - see below)

"hunterfan"
-----------
Emitted when a message arrives from a Hunter fan remote control

"funkbus"
---------
Emitted when a message arrives from a FunkBus 'Gira' or 'Insta' remote control

"edisio"
--------
Emitted when a message arrives from an Edisio system remote control or wall switch

"camera1"
---------
Emitted when a message is received from an X10 Ninja Robocam camera mount remote control.
Expand Down Expand Up @@ -442,7 +462,7 @@ the package has been installed globally.
Enabled protocols: AC,LIGHTING4,OREGON
Disabled protocols: ARC,ATI,BLINDST0,BLINDST1,BLYSS,BYRONSX,FINEOFFSET,FS20,HIDEKI,HOMECONFORT,HOMEEASY,IMAGINTRONIX,KEELOQ,LACROSSE,LIGHTWAVERF,MEIANTECH,MERTIK,PROGUARD,RSL,RUBICSON,UNDECODED,VISONIC,X10

You will need to pass the device port - in this case `/dev/cu.usbserial-A1R1A6A` - to `rfxcom` to control the device.
You will need to pass the device port - in this case `/dev/tty.usbserial-A1R1A6A` - to `rfxcom` to control the device.
*set-protocols* also uses the device port to locate the RFXCOM device to program.

`npm run set-protocols -- --list device_port` will print the same information as *find-rfxcom*, for the specified device.
Expand Down
4 changes: 2 additions & 2 deletions bin/find-rfxcom.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ rfxcom.RfxCom.list(function (err, ports) {
} else {
ports.forEach(port => {
let device = {};
device.rfxtrx = new rfxcom.RfxCom(port.comName);
device.message = " " + port.comName + (port.pnpId !== undefined ? " (" + port.pnpId + ")" : "");
device.rfxtrx = new rfxcom.RfxCom(port.path);
device.message = " " + port.path + (port.pnpId !== undefined ? " (" + port.pnpId + ")" : "");
device.rfxtrx.on("status", evt => {
if (headerPrinted === false) {
console.log("Devices found at:");
Expand Down
19 changes: 19 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
Version 2.1.0
-------------
Support for RFX firmware 1040

- Add support for newly added subtypes in multiple packet types
- Add support for Edisio & HunterFan packet types
- Add support for Weather & Solar packet types
- Add fan receive handler

Update to latest Serialport (>8.0.0) and Queue (>6.0.0)
Debug log timestamps now include milliseconds
Correct the errors in the code samples in Readme.MD

Bug fixes:

- Correct the handling of RSSI in weight packet receive handler
- Correct the allowable address ranges in several places
- Fix handling of device type number in FunkBus receive handler

Version 2.0.2
-------------
Change the way security1 device addreses are processed in the receive handler, to ensure they are compatible with the
Expand Down
20 changes: 13 additions & 7 deletions lib/blinds1.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ class Blinds1 extends Transmitter {
throw new Error("Invalid unit code " + parts[1]);
}
unitCode = unitCode - 1;
} else if (this.isSubtype(["BLINDS_T9", "BLINDS_T10"])) {
} else if (this.isSubtype(["BLINDS_T9", "BLINDS_T16"])) {
if (unitCode > 6) {
throw new Error("Invalid unit code " + parts[1]);
}
} else if (this.isSubtype("BLINDS_T12")) {
} else if (this.isSubtype(["BLINDS_T12", "BLINDS_T15"])) {
if (unitCode === 0) {
unitCode = 0x0f;
} else if (unitCode > 15) {
Expand All @@ -75,7 +75,7 @@ class Blinds1 extends Transmitter {
id = RfxCom.stringToBytes(parts[0], 3);
}
if ((id.value === 0) ||
((this.isSubtype(["BLINDS_T0", "BLINDS_T1", "BLINDS_T12", "BLINDS_T13", "BLINDS_T16"])) && id.value > 0xffff) ||
((this.isSubtype(["BLINDS_T0", "BLINDS_T1", "BLINDS_T12", "BLINDS_T13", "BLINDS_T15", "BLINDS_T16"])) && id.value > 0xffff) ||
((this.isSubtype(["BLINDS_T2", "BLINDS_T3", "BLINDS_T4", "BLINDS_T5", "BLINDS_T10", "BLINDS_T11", "BLINDS_T14"])) && id.value > 0xffffff) ||
((this.isSubtype(["BLINDS_T6", "BLINDS_T7"])) && id.value > 0xfffffff) ||
((this.isSubtype("BLINDS_T8")) && id.value > 0xfff) ||
Expand All @@ -91,10 +91,6 @@ class Blinds1 extends Transmitter {
_sendCommand(deviceId, command, callback) {
const device = this._splitDeviceId(deviceId);
let buffer = [device.idBytes[0], device.idBytes[1], device.idBytes[2], device.unitCode, command, 0];

if (this.isSubtype("BLINDS_T15")) {
throw new Error("Subtype BLINDS_T15 not yet implemented")
}
if (this.isSubtype("BLINDS_T6") || this.isSubtype("BLINDS_T7") || this.isSubtype("BLINDS_T9")) {
buffer[3] = buffer[3] | device.idBytes[3];
}
Expand Down Expand Up @@ -219,6 +215,16 @@ class Blinds1 extends Transmitter {
}
};

/*
* T6 Light command
*/
toggleLightOnOff(deviceId, callback) {
if (this.isSubtype("BLINDS_T6")) {
return this._sendCommand(deviceId, 0x05, callback);
} else {
throw new Error("Device does not support toggleLightOnOff()");
}
};
}

module.exports = Blinds1;
Loading