Adding a single switch template for a device

I dunno if I am just dense or what, but I can’t figure out how to just add a switch tile for a device on a page? Does everything have to be in a group to use them?

You can place a single switch but you would not be using a device browser, tile, Groups, etc… just place the switch in a grid and bind it to the device you want to use.

Guess that’s where I am lost. What do you mean by “place the switch in a grid”? I have the grid but I can’t drag and drop the switch from devices onto it.

I think he means drop a new “Toggle Switch” or “Button” from the “Controls” bar. Once it’s on your page you can set the Bindings to work with your device.

Here’s a video that goes over how to configure a ToggleSwitch. In the video, Brian creates a Mute switch. For your standard Switch, substitute Muted/Unmuted with On/Off.

Templates are primarily targeted for Group use & DeviceBrowsers. That’s where they are the most helpful. You can also use a PageBrowser to load a template page but that I don’t know that I would use that for your scenario. If all you are wanting is a single button or switch, just add the control directly.

It’s not that I just want the one switch, I just wanted to know how. I am a pretty competent person and a programmer, but figuring this out is eluding me for some reason.
So, how do most people set up their groups?

Groups are in the Explorer pane. Drop a DeviceBrowser control onto your page. Then set the Group property on the DeviceBrowser to the name of your Group that’s shown in Explorer.

You can also use a PageBrowser. But many of the default Tile Templates have Clicked events on the Tile object & those do not currently fire in a PageBrowser. So linking the SwitchTile.xaml file to a PageBrowser will not work without some modifications by you.

Try all 3 approaches: DeviceBrowser, PageBrowser, Direct placement of ToggleSwitch or Button

Should a group contain everything you want on a page in a device browser?

The Group should contain everything you want to display in the DeviceBrowser. The page itself as a whole, can display anything. There are no limitations.

another question, with something like netatmo that has many capabilities, how can I show the c02 measurement, or any individual capabilities on the same page with the default temperature?

You can add additional Labels to the templates. Just set the Text binding to a value of @Device.ATTRIBUTE_NAME. The CO2 attribute name is CarbonDioxide.

The only reason I didn’t include those on the default tile was that I thought it didn’t look as nice. A little too busy for my taste & it didn’t follow the same format as other tiles. I did include them on the Details page though so when you click the tile you should see the other readings. Again, you yourself are free to edit any of those XAML files in the Templates folder.

OK, but if I want to use the c02 template in a device browser, is that possible?

The DeviceBrowser will use whatever template has been assigned to the Device in the Explorer. You can change the TileTemplate for any of those Devices.

Sorry for being pain. Since I can only add the device once per group, sounds like there can only be 1 tile for that device in the device browser? and will default to whatever tile I set it to? If I want c02, I either have to add it to an existing tile or create something new?
Also, are the details set to popup automatically on click? If so, they are not for me in the emulator.

Copy & paste the device object in the explorer. I’m not talking about the entire Netatmo integration, but rather the individual WeatherStation device object itself. For your duplicate device, assign it the CO2 tile. Then you should be able to add both devices to the same Group.

If you are using a DeviceBrowser, clicking most tiles should open the Details page. I say “most” because it really depends on the device. The WeatherStationTile should open the Details page. If you look at the Tile Clicked action, it calls OpenDetails.

No worries. I do accept PayPal donations in case you want to buy me a coffee:)

If I can get this to a useable state for me, I will for sure donate. I did buy the iOS app also. Prolly get the Android as well.

Ya, I have all that for the event trigger, yet nothing happens.

What you have should work then. Send me your project & I’ll take a look. My email is support@thehomeremote.com

You’ve got IsHitTestVisible unchecked on the DeviceBrowser. That means the entire control is going to respond to any click or touch events. You should check that property.

ahhh, thank you. Should start an FAQ section with some stuff in here.

anything I am doing wrong as to why the layout doesn’t match the emulator?

image