Modifying a default app or create a new app from existing app

I would like to create a customized version of the default thermostat app. the existing app does not have a tile for battery status, I would like to include that.

Does anyone know how I can get the code for the existing thermostat app or use that as a base to create new one?

thanks

What thermostat are you talking about? A tile for battery stats would be in the device-type, not the SmartApp.

Hmm interesting.
Am using the CT100. Will need to look a the code to see how to add a title. Any tips would be appreciated :smile:

Go into the IDE and select the DeviceType tab. Create a new DeviceType giving it a name. After pressing the “Create” button, you should see a button above the simulator on right where you can see current DeviceTypes. Pick whatever device your CT100 is in ST and it will show you the code you can import into your code as a base.

Not DeviceType, but SmartApp. Anyways as @scottinpollock indicated above I may have to end up modifying the device and not the app here.

What @Sticks18 told you is correct and aligns with what @scottinpollock told you, which is also correct.

Okay now I’m a little lost here :smile:
I understand that one can use the IDE to create custom devices using templates as @Sticks18 pointed out but I’m looking at adding titles so I guess what you’re saying is that @scottinpollock is the correct answer for that right?

The tiles are generated by the Device Type settings. That’s not a SmartApp.

Mobile App = The SmartThings program you run on your SmartPhone

SmartApp = An applet that is installed using the Mobile App. These are used to perform functions like: “When I open this door, turn on this light and off that light.”

Device Type = the code that resides on the SmartThings IDE that controls how a device functions within the ST ecosystem. Think of it like drivers for devices on your computer. These control what the Mobile App (and the ST Cloud) thinks your device can do and what information should be displayed with this device in the Mobile App.

@scottinpollock told you that you need to create a customised Device Type handler (rather than a SmartApp) to add a tile to show the battery status. When you’re looking at a device in the SmartThings application, you’re looking at the interface to a device, not a SmartApp. That interface is implemented in a Device Type handler.

@Sticks18 told you how to create a customised Device Type handler based upon the existing Device Type handler code.

As an analogy - in Windows you have applications like Word and you have device drivers such as one that lets Windows (and applications) talk to your printer. Word doesn’t understand your printer, the device driver does.
When you go into Devices and Printers to manage your printer, it’s getting and setting information via the printer driver.
When you want to print from Word, the Word application is getting information about the printer and sending information to the printer via the printer driver.
If you wanted to manage details about how much toner is in your printer, that code would be in the printer driver, not in Word.

So - The toner level is your battery level, Word is a SmartApp and the printer driver is a Device Type handler.

2 Likes

Nice metaphor @chuckles

Hey! Great minds think alike I guess. :smile:

Hehe - yep - snap! :slight_smile:

Got it thanks :smile:

So coming to the device type, if I include this code to create 2 tiles - why am I not seeing the 2 additional tiles?

    valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat") { // CT100 CUSTOMIZATION
		state "battery", label:'Battery ${currentValue}%', backgroundColor:"#ffffff" // CT100 CUSTOMIZATION
	} // CT100 CUSTOMIZATION
    valueTile("humidity", "device.humidity", inactiveLabel: false, decoration: "flat") { // CT100 CUSTOMIZATION
		state "humidity", label:'Humidity ${currentValue}%', backgroundColor:"#ffffff" // CT100 CUSTOMIZATION
	} // CT100 CUSTOMIZATION
    main "temperature"
	details(["temperature", "mode", "fanMode", "heatSliderControl", "heatingSetpoint", "coolSliderControl", "coolingSetpoint", "battery", "refresh", "configure"]) // CT100 CUSTOMIZATION

I haven’t looked at your code, sorry (it’s 05:18 Sunday morning and I’m still trying to get to sleep, but I’m in no mood to code just now… :-/ )

However, some procedural questions before we start blaming the code:

  1. Have you published your device handler for yourself ( “For me”) and
    it succeeded?
  2. Have you updated your devices to use your new Device Type handler
    rather than the stock Device Type handler? (Changing the namespace
    and name of the Device Type is the easiest way to keep track. In the
    IDE, on the “Devices” page, the Device Type name will appear against
    the device in the the “Type” column).

Wow you’re on a roll there buddy.

Yes I’ve been able to publish it. (didn’t see any error) and infact went one step ahead of refresh, removed the thermostat and repaired it and it detected it as my custom thermostat (different name) but still no custom tiles.