Mirror App request

Is there a reason why Mirror cant work with any binary sensor. On/Off, Open/Close, Active/Inactive, etc? I would love to at least allow switches to mirror contact sensors so I can integrate virtual contacts sensors from Alexa to Hubitat without yet another RM rule. My rule list is getting so unwieldy that it would be nice to just tuck all the virtual sensor "mirror rules" off in the Mirror app.

2 Likes

At this time; I think the purpose of the app is to mirror fellow switches. It would be nice if we were given the option that you are proposing!

Thinking even further about the power of this app with my proposal, even buttons could be mirrored in a momentary switch like fashion. Though that may be an issue with the speed in which it "polls'?

I doubt it'll happen with Mirror but this should be too complex of an app to write. Unfortunately, I don't the time right now, but maybe in a few weeks...

Never mind, looks like it's already done:

1 Like

Are you trying to use a device as a contact sensor in Alexa (to trigger routines) but as a switch in Hubitat? If so, there are specialized custom virtual devices that do this already internally in the driver and you only need the one device.

3 Likes

I did not know that. Thats even less clutter. What virtual device is that?

This is the one i've been using for years.

/*
 * Virtual Contact Sensor with Switch
 *
 * Created by Stephan Hackett
 * 
 */

metadata {
    definition (name: "Virtual Contact Sensor with Switch", namespace: "stephack", author: "Stephan Hackett") {
		capability "Sensor"
        capability "Contact Sensor"
        capability "Switch"
		
		command "open"
		command "close"
    }
	preferences {
        input name: "reversed", type: "bool", title: "Reverse Action"
	}
}

def open(){
	sendEvent(name: "contact", value: "open")
	if(reversed) switchVal = "off"
	else switchVal = "on"
	sendEvent(name: "switch", value: switchVal)
}

def close(){
	sendEvent(name: "contact", value: "closed")
	if(reversed) switchVal = "on"
	else switchVal = "off"
	sendEvent(name: "switch", value: switchVal)
}

def on(){
    sendEvent(name: "switch", value: "on")
	if(reversed==true) contactVal = "closed"
	else contactVal = "open"
	sendEvent(name: "contact", value: contactVal)
}

def off(){
    sendEvent(name: "switch", value: "off")
	if(reversed==true) contactVal = "open"
	else contactVal = "closed"
	sendEvent(name: "contact", value: contactVal)
}

def installed(){
	initialize()
}

def updated(){
	initialize()
}

def initialize(){
	sendEvent(name: "switch", value: "off")
	sendEvent(name: "contact", value: "closed")
	
}

3 Likes

Here is one that has lots of options: [RELEASE] Virtual Switch Universal Device Type (uDTH) - good for Alexa, IFTTT, HSM, and other integrations

Here are some other ones I have used, but does not have a contact one : GitHub - joelwetzel/Hubitat-Miscellaneous-Drivers: A collection of small misc drivers that don't belong anywhere else

4 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.