IFTTT to conrol Fibaro relay switch?

I am using a Fibaro Relay Switch (1x2.5kW, FGS-212) to control the garagedoor opener. I created a custom device handler (using code from this community) for the Fibaro switch. I can perfectly control the switch from the smartthings mobile app using this device handler.

I now want to use IFTTT to create a logic to open the garage door when I ask my phone (Cortana) to open the door. When I check the event log I can see: APP_COMMAND On but it is not followed by Device command On and therefore the Switch is not operated.

How should I translate the APP_COMMAND into a Device command?

I resolved it by introducing a virtual switch with an app. Thanks to this thread:

1 Like

Hi @gebla, would you be able to share your custom device handler for the FGS-212. I tried using the the one for FGS-222 but seems like the hub can’t find it.

The 222 is a multi-endpoint switch (dual relay). You have to use a device handler specifically meant for multi endpoint devices. See the following:

Sorry if I didn’t make it clear, I bought a FGS-212, and looking for the handler of it.

A quick update, ST actually added the relay but I didn’t notice it until I saw there’s a multi channel zwave device.

I’m able to turn the test bulb on/off using the multi channel device :smiley:

I’m using the device handler of FGD-222

1 Like

I added the device as a generic single relay (you can change the device inside the IDE). I am also using below app to ensure I can control the switch on IFTT:

/**

  • Virtual / Physical Switch Sync (i.e. Enerwave ZWN-RSM2 Adapter, Monoprice Dual Relay, Philio PAN04, Aeon SmartStrip)
  • Copyright 2016 Eric Maycock (erocm123)
  • Note: Use a “Simulated Switch” from the IDE for best results
  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.

*/
definition(
name: “Virtual / Physical Switch Sync”,
namespace: “erocm123”,
author: “Eric Maycock”,
description: “Keeps multi switch devices like the Aeon Smartstrip, Monoprice Dual Relay, and Philio PAN04 in sync with their virtual switches”,
category: “My Apps”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)

preferences {
page(name: “numberPage”, nextPage: “setupPage”)
page(name: “setupPage”)
}

def numberPage() {
dynamicPage(name: “numberPage”, install: false, uninstall: true) {
section {
input “vNumber”, “number”, title:“Number of virtual switches”, description: 2, defaultValue: 2 , required: true
}
section([title:“Available Options”, mobileOnly:true]) {
label title:“Assign a name for your app (optional)”, required:false
}
}

}

def setupPage() {
dynamicPage(name: “setupPage”, install: true, uninstall: true) {
section {
input “physical”, “capability.switch”, title: “Which Physical Switch?”, multiple: false, required: true
for (int i = 1; i <= vNumber; i++){
input “virtual${i}”, “capability.switch”, title: “Virtual Switch to link to Switch ${i}?”, multiple: false, required: true
}
}
}
}

def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}

def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}

def initialize() {
log.debug "Initializing Virtual / Physical Switch Sync v 1.0"
for (int i = 1; i <= vNumber; i++){
subscribe(physical, “switch${i}”, physicalHandler)
subscribeToCommand(settings[“virtual${i}”], “on”, virtualHandler)
subscribeToCommand(settings[“virtual${i}”], “off”, virtualHandler)
subscribe(physical, “power${i}”, powerHandler)
subscribe(physical, “energy${i}”, energyHandler)
}
}

def virtualHandler(evt) {
log.debug “virtualHandler called with event: deviceId ${evt.deviceId} name:${evt.name} source:${evt.source} value:${evt.value} isStateChange: ${evt.isStateChange()} isPhysical: ${evt.isPhysical()} isDigital: ${evt.isDigital()} data: ${evt.data} device: ${evt.device}“
for (int i = 1; i <= vNumber; i++){
if (evt.deviceId == settings[“virtual${i}”].id) {
physical.”${evt.value}${i}”()
}
}
}

def physicalHandler(evt) {
log.debug “physicalHandler called with event: name:${evt.name} source:${evt.source} value:${evt.value} isStateChange: ${evt.isStateChange()} isPhysical: ${evt.isPhysical()} isDigital: ${evt.isDigital()} data: ${evt.data} device: ${evt.device}“
for (int i = 1; i <= vNumber; i++){
if (evt.name == “switch${i}”) {
try {
sendEvent(settings[“virtual${i}”], [name:“switch”, value:”$evt.value”, type:“physical”])
} catch (e) {
log.trace “Caught error: Likely caused by not using my specialized Simulated Switches"
log.trace e
settings[“virtual${i}”].”${evt.value}Physical"()
}
}
}
}

def powerHandler(evt) {
log.debug “powerHandler called with event: name:${evt.name} source:${evt.source} value:${evt.value} isStateChange: ${evt.isStateChange()} isPhysical: ${evt.isPhysical()} isDigital: ${evt.isDigital()} data: ${evt.data} device: ${evt.device}“
for (int i = 1; i <= vNumber; i++){
if (evt.name == “power${i}”) {
sendEvent(settings[“virtual${i}”], [name:“power”, value:”$evt.value”])
}
}
}

def energyHandler(evt) {
log.debug “energyHandler called with event: name:${evt.name} source:${evt.source} value:${evt.value} isStateChange: ${evt.isStateChange()} isPhysical: ${evt.isPhysical()} isDigital: ${evt.isDigital()} data: ${evt.data} device: ${evt.device}“
for (int i = 1; i <= vNumber; i++){
if (evt.name == “energy${i}”) {
sendEvent(settings[“virtual${i}”], [name:“energy”, value:”$evt.value”])
}
}
}