I have a use case for the Custom App which will automatically
create a Virtual Device and mirror Child Device to this Virtual Device.
The reason is:
It is impossible to easy swap failed or not needed Child Device
with another Child or Physical Device.
The proposed app will remove all this headache related to swapping
Child Devices.
I am already doing this with RM and sure still can use an RM but
(I think) the proposed Custom App should not be difficult to create
and may benefit near all HE users.
So, SW Gurus - is anybody willing to create this custom app?
A virtual device that such an app creates will be a child device of that app and will therefore not work with Swap Apps Device, either...
Rule Machine works because you're creating the device yourself, so they are not child devices of anything. Such an app could work if you made the user manually create the device first, I suppose, but I'm personally not interested in that effort (this would address a subset of cases for what is probably a rare occurrence for most users in the first place). Can't speak for anyone else. ![]()
For devices you can't use with Swap Apps Device, if you don't want to "manually" swap them (like we used to need to do for everything before this tool existed), here's a hint that can help make this easier: clone the app, and you'll be offered the ability to do device substitutions when you make the clone. Then, remove the original. In some cases, I think it's just easier to manually swap the device, but this could help if you have complicated apps where that seems like too much work.
For certain integrations, if you're swapping one child device of that app/driver with another, many of the parents rely on the DNI to match devices. So, you might be able to do some trickery there, or the parent app could offer some feature to help you (would be an interesting request for the developer). If this applies to your case, that's another way this issue may be able to be approached.
PS - Is there a reason you insert line breaks manually into all of your posts? The page styling from the forum will automatically wrap text (as most modern browsers do by default, too), and it makes it easier to read and quote the text if you don't.
Thank you for the clarification.
Well, and you are correct - the device must not be a Child Device.
If I got you right it looks like there is no way to create a Virtual Device automatically similar to whatever created manually? If this is a case that my idea is half broken.
I know about many (if not all) all tricks related to swapping devices. Unfortunately option "Swap App Device" from Settings dors not work for the Child Devices. I learned this in a hard way and started to use Virtual Device with correspondent RM rule. And the RM rules are using Virtual Devices instead of Chile Devices. This way if for whatever reason I need to swap Child Device it will be only one place in one rule instead of all that Cloning and/or going through many rules manually (I too lazy to do this).
I am OK to use the RM but since the RM does not allowed to nicely organized rules number of rules becomes enormously huge. That is why a Custom App which will handle mirroring all Child devices to their Virtual Clone still will be very helpful even if Virtual Device must be created manually.
At least it will be one single place to deal with all this mess.
I will be moving all my LAN Integrations from C8 back to C7. Unfortunately all these LAN Integrations (HADB, Ecowitt, HubDuino, etc.) are creating many Child Devices. As I mentioned, I will not use any Child Device directly. That is why I started to think about Custom App. But if this is not doable (too bad) I still will be using bunch of RM rules.
OK, how about Hub Variables?
Is it possible for the Custom App to create a Hub Variable and assign a Device Attribute to this newly created Hub Variable?
In many cases (if not all) this will be even better than using Virtual Device.
It "yes" this will do the job.
No, the hub variables API does not provide a way to create (or delete) variables, only read or update their values.
Well, still not good. But I will be OK to manually create Hub Variables. It looks like I have to manually create Hub Variables and/or Virtual Devices regardless how these will be updated.
Is it any simple template how to create Custom App which will updated already created Hub Variable with Device Attribute?
I started my journey with creating Hub Variables and associated RM rules.
I will need about 50+ sets. of these. Gladly I am not in rush with this effort (everything is 100% functional on my new C8). But I am trying to recreate my C7 in most efficient and easy manageable way. It looks like I will have to learn how to deal with Custom Apps and right now I have a drive to start this effort. It will be really helpful to see a very simple Custom App Template which will have everything what is absolutely required and a place where to put all custom code.
I know (and I actually checked) there are few Custom Apps Templates available. But because I am not a SW developer I have hard time to understand what exactly is an absolute must have portions of code and what is really custom.
Are you sure that this would all be easier than just swapping out devices in apps when Swap Apps Device isn't supported by that device and when cloning/importing, for whatever reason, isn't desired? 
One other thing to bear in mind, the mirrored device or variable will just that, a mirror of the data. You will want to make that clear, as for some people use of a child device may include running of custom commands, which will not be possible in the mirrored device.
Yes, I am sure because I already tried all these mentioned options before I started to use mirrored Virtual Devices. To my eyes this is the best option because if for any reason I have to swap Child Device I have to do this only in one place not even thinking where this device is used.
This is very good point.
But so far I did not use any Custom Commands (I think) and therefore did not step into this potential problem.
BTW, Easy maintainability is always my primary concern and goal for whatever things I am designing. (I am EE with long time experience and I know what maintainability is.)
For these reason (maintainability) I have many triggerless RM rules which I am using as subroutines.
The reason is - whenever the same code is used more than once it becomes subroutine.
This is specifically useful for dealing with Buttons. Button Controller is well organized in terms of easy seeing what button does what . I have many Buttons on different remotes doing exactly the same thing. And instead of multiplying the same code many times Button simply call a related RM rule.
Just as a point of interest I think the app should be called Change Device rather than Swap Device. Swap implies swapping one live device for another, which it plainly doesn’t do. Now, I can see a case for creating a virtual device (which I’ve had to do) when you swap a two devices over. Or am I doing something wrong…?
I am not sure what did you mean.
As I said, I am using mirroring of Child Devices either to Hub Variable or Virtual Device because at least in my case this is easiest way to swap Child Device with another Child Device or real Physical Device. Child Device which is used only once does not need mirrored Virtual Device. But as soon as Child Device is using more than once it immediately gets mirroring to Virtual Device or Hub Variable. I have too many Child Devices used in multiple RM rules. Now I am moving all LAN-based integrations back to C7 hub. All these LAN-based integrations producing only Child Devices. That is why I started to think about Custom App to handle this cases. It looks like this is not easy achievable. So, I will continue to use manually created Virtual Device and/or Hub Variable and associated RM rule for mirroring.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.