# How to change relay status when turn on/off

**URL:** <https://community.homey.app/t/how-to-change-relay-status-when-turn-on-off/43455>\
**Category:** Questions & Help\
**Created:** [February 22, 2021, 9:14am UTC](https://community.homey.app/t/how-to-change-relay-status-when-turn-on-off/43455 "2021-02-22T09:14:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![YI\_KUAN\_HSIN](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/yi_kuan_hsin/32/36104_2.png) [@YI\_KUAN\_HSIN](https://community.homey.app/u/YI_KUAN_HSIN)\
**Post date:** [February 22, 2021, 9:14am UTC](https://community.homey.app/t/how-to-change-relay-status-when-turn-on-off/43455/1 "2021-02-22T09:14:18Z")

</div>

Hello,  
I use [AN196](https://www.everspring.com/portfolio-item/11244/) to want to control two sets of relays by main node, or when two sets of relays change status can change main node status too, like this:

 ![S__21111096](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/b/3/b34bc43099f02a880e467d9d8d47daceef40fd14.jpeg)

My questions below:  
1.Using App to press one of relays can change main node, but press main node can’t change two sets of relays.  
2.Using device to turn on/off, only main node change status, two sets of relays not work, it’s difference problem with App.

My codes below:  
1.device.js:  
‘use strict’;

const {ZwaveDevice} = require(‘homey-zwavedriver’);

class MyZWaveDevice extends ZwaveDevice {  
async onNodeInit() {

```
    //relay 1 and 2
    this.registerCapability('onoff', 'BASIC', {
        report: 'SWITCH_BINARY_REPORT'
    });

    //group
    this.registerCapability('onoff', 'SWITCH_BINARY', {
    });
}

```

}

module.exports = MyZWaveDevice

2.app.json  
{  
“id”: “com.everspring”,  
“version”: “1.0.0”,  
“compatibility”: “\>=5.0.0”,  
“sdk”: 3,  
“name”: {  
“en”: “Everspring”  
},  
“description”: {  
“en”: “n”  
},  
“category”: [  
“lights”  
],  
“permissions”: ,  
“images”: {  
“large”: “/assets/images/large.png”,  
“small”: “/assets/images/small.png”  
},  
“author”: {  
“name”: “YI KUAN HSIN”,  
“email”: “[101797@everspring.com](mailto:101797@everspring.com)”  
},  
“drivers”: [  
{  
“id”: “AN196”,  
“name”: {  
“en”: “AN196”  
},  
“class”: “socket”,  
“capabilities”: [  
“onoff”  
],  
“images”: {  
“large”: “/drivers/AN196/assets/images/large.png”,  
“small”: “/drivers/AN196/assets/images/small.png”  
},  
“zwave”: {  
“manufacturerId”: 96,  
“productTypeId”: 4,  
“productId”: 14,  
“learnmode”: {  
“image”: “/drivers/AN196/assets/learnmode.svg”,  
“instruction”: {  
“en”: “Press the link key three times within 1.5 seconds to put the unit into inclusion mode.”  
}  
},  
“associationGroups”: [  
1  
],  
“associationGroupsOptions”: {  
“1”: {  
“hint”: {  
“en”: “Group”  
}  
},  
“2”: {  
“hint”: {  
“en”: “Relay 1”  
}  
},  
“3”: {  
“hint”: {  
“en”: “Relay 2”  
}  
}  
},  
“multiChannelNodes”: {  
“1”: {  
“class”: “socket”,  
“capabilities”: [  
“onoff”  
],  
“icon”: “/drivers/AN196/assets/icon.svg”,  
“name”: {  
“en”: “Relay 1”  
}  
},  
“2”: {  
“class”: “socket”,  
“capabilities”: [  
“onoff”  
],  
“icon”: “/drivers/AN196/assets/icon.svg”,  
“name”: {  
“en”: “Relay 2”  
}  
}  
},  
“defaultConfiguration”: [  
{  
“id”: 1,  
“size”: 1,  
“value”: 0  
},  
{  
“id”: 2,  
“size”: 1,  
“value”: 0  
},  
{  
“id”: 3,  
“size”: 4,  
“value”: 0  
},  
{  
“id”: 4,  
“size”: 4,  
“value”: 0  
},  
{  
“id”: 5,  
“size”: 1,  
“value”: 1  
},  
{  
“id”: 6,  
“size”: 1,  
“value”: 1  
}  
]  
}  
}  
]  
}

---

<div class="post-metadata">

**Author:** ![Edwin\_D](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/edwin_d/32/136417_2.png) [@Edwin\_D](https://community.homey.app/u/Edwin_D)\
**Post date:** [February 22, 2021, 8:38pm UTC](https://community.homey.app/t/how-to-change-relay-status-when-turn-on-off/43455/2 "2021-02-22T20:38:22Z")

</div>

I’m not sure I fully understand your question, but I think that if you create a virtual device with the [[App] Virtual Devices](https://community.homey.app/t/app-virtual-devices/1723) you can use flows to create the required behaviour for the virtual device.
