My Own Mirror App

Just throwing this out there if anyone is interested, or sees something bad with it.. I needed a 2 way mirroring. Ended up with the following which seems to work pretty good. (This is just the important part of the code.

preferences {
	section("Test Devices") {
        input "Switches", "capability.switch", required: true, multiple: true, title: "Switches To test"
   	}
}

def initialize() {
   subscribe(Switches,"switch",testHandler)
   unschedule()
}

def testHandler(evt){

    if (Switches.currentswitch[0] != Switches.currentswitch[1]) {
        if (evt.value == "on") {Switches.on()}
        if (evt.value == "off") {Switches.off()}
    }
}
1 Like

Not to discredit your app, sometimes home made apps are the best because they do ONLY what you want and nothing else. You know exactly what they will do.

But, in case you did not know, there is another fully fleshed out app that does two+ way bidirectional mirroring.

1 Like

I was not aware of that. So I will just delete this post, if I can.

1 Like

I think it will let you delete the main post yourself, although no harm in leaving it up. Someone else might be searching for mirroring and then find your code useful and/or the other app via this post.

2 Likes

I can't say I know enough about either your offering or the existing app @jtp10181 linked to , but I would suggest holding fire on deleting your post. Take your time to look at it and see if yours offers anything more or whether it could be modified to offer something different.

1 Like

That said, probably worth understanding if Hub Mesh could offer the same as what your driver can....

I looked at @jtp10181 app briefly. It is great, but probably overkill for what I needed. I just need a couple simple mirrors.

Basically it is the hub mesh issue that prompted this. I use hub mesh to a second hub to give me a second instance of Homekit integration. But the mesh items can't be used in Homekit. Thus I had to mirror them to virtual items to use them in Homekit. And I needed it to work in both directions.

3 Likes

FYI on an alternate approach: you can turn on HomeKit integration on both hubs and then join both of them to your Apple Home app. This distributes the load and also takes Hub Mesh out of the equation when using Home.app.

2 Likes

Not sure how that would work. I have the Homekit app on my main hub with quite a few devices. Which is mainly for me. I have a couple other folks who only need, or should have, access to a subset of those devices. Since I cannot have 2 instances of the Homekit integration on one hub, wish I could, I use the second hub with the Homekit integration for those other folks. But the actual devices are on the main hub and they have to mirror in both directions.

Yeah thats a different application that what most people have, which is two hubs both with devices on them so then you just put HK on both hubs to share all the devices to a single Home in HK.

If you have any sort of a dedicated server, NAS or SBC at your house you should check out the Homebridge integration. I think you can even run multiple instances of it from the same hub sending info to multiple child bridges. Speaking of which... I wanted to give my kids access to a few devices but I made them dashboards. I should just use a separate HB bridge and they can use Homekit.

The issue I was running into with dashboards. Not wanting them to use the HE app, so created links to the dashboards on their Home Screen. But I had to use 2 different links, one for local and one for remote. HomeKit automatically does that.

1 Like

Perhaps not the place to ask this. I have a RPI currently running my Channels DVR setup. Is it possible to Run Homebridge on the same unit simultaneously?

Should be able to handle it, you would have to check what you are currently at for CPU use and Free Mem. Depends on what RPi model as well.

In thinking about it, using Homebridge doesn't really add anything to what I have. Already have a second device, HE hub, to accomplish what I want. Replacing it with Homebridge still means 2 devices. And I probably understand the HE hub better than I would Homebridge.

FYI I had to dedicate one of my Homepods to work with the second hub Homekit integration. Got it stuck away in the basement so we don't try to ask it to turn on/off things. If we did, she kinda mouths off about no such device or somesuch. :slight_smile:

Ah, I got it now. You don't have any devices directly paired to the second hub. You're using Hub Mesh and the Homekit integration on it to basically do the same thing that HomeBridge does. Makes sense now.

1 Like

Exactly. The only purpose for the 2nd hub is to give me a second instance of HomeKit.