rfxcom / node-rfxcom

Node.js client for talking to an RFXtrx433 device
MIT License
63 stars 46 forks source link

Any code sample for DIO Chacon switch? #109

Closed slesolliec closed 11 months ago

slesolliec commented 1 year ago

Hi and thanks for your work!

MacBook + RFXcom + node-rfxcom working: I receive temp/humidity signals from all my rooms every few seconds!!!

But is there any code sample for using a DIO Chacon switch connected to my heaters?

Here is the switch module: https://www.domadoo.fr/fr/peripheriques/585-dio-module-onoff-1000w-5411478547556.html

const rfxcom = require('rfxcom')
const rfxtrx = new rfxcom.RfxCom("/dev/tty.usbserial-A1QBWMO", {debug: true})

const mySwitch = new rfxcom.Lighting1(rfxtrx, rfxcom.lighting1.ARC)

// some stuff to connect to RFXcom

mySwitch.switchOn("0x666666/1", function(err, res, seqNum) {
    console.log('err=', err)
    console.log('res=', res)
    console.log('seqNum=', seqNum)
}

But I get a:

/Users/stephane/node/rfxcom/node_modules/rfxcom/lib/lighting1.js:35
            throw new Error("Invalid house code '" + parts[0] + "'");
            ^

Error: Invalid house code '0'
    at Lighting1._splitDeviceId (/Users/stephane/node/rfxcom/node_modules/rfxcom/lib/lighting1.js:35:19)
    at Lighting1._sendCommand (/Users/stephane/node/rfxcom/node_modules/rfxcom/lib/lighting1.js:52:29)
    at Lighting1.switchOn (/Users/stephane/node/rfxcom/node_modules/rfxcom/lib/lighting1.js:72:21)
    at Timeout._onTimeout (/Users/stephane/node/rfxcom/test.js:27:11)

I tried with the lightning2:

const mySwitch = new rfxcom.Lighting2(rfxtrx, rfxcom.lighting2.AC)

// some stuff to connect to RFXcom ...

mySwitch.switchOn("0x430010/1")

and the message gets sent, but the switch does not switch, although it is in pairing mode, waiting for its first command.

dio-module-onoff-1000w

maxwellhadley commented 1 year ago

This is a new module to me, so I'm not sure if this specific device is supported. The Lighting1 Chacon devices are the old types with switches, and expect an address in the form of 'house_code, unit_number', but what you describe seems to be the 'pairing' AC protocol of lighting2.

Do you have a remote control for this device? Have you tried listening for the "lighting2" event from the rfxtrx object, and seeing what happens in response to a button press? It may be that the ID number is out of range, for this particular device. Maybe try "0x01/1"?

If you don't get anywhere try contacting Rfxcom support directly

slesolliec commented 1 year ago

Thank you for your kind comment.

I bought myself a DIO remote control, looked at the messages, and I finally found out how to control my devices emulating the remote control:

const remote = new Lighting2(rfxtrx, rfxcom.lighting2.AC)
// 0x25072F is the prefix of my DIO remote control
const remotePrefix = "0x25072F/"

remote.switchOn(remotePrefix + 4)

The remote control has 16 channels, ... I just put 4 here as an example.

The advantage of investing 12€ in a separate control is also that I can switch the devices manually for testing, debugging, etc ...

I currently control 4 heaters and the bathroom vent (triggers as soon as humidity is above 70%) with that.

The whole code of my app is on github if anyone is interested: https://github.com/slesolliec/smart-home

Thank you again for that great package. My app wouldn't work without node-rfxccom !!!!

maxwellhadley commented 1 year ago

Glad you ere able to get it going! There should be an updated version published soon, with support for some more protocols & devices