Tablets as controllers

Has anyone successfully used an iPad or android tablet as a mounted “permanent” type remote for ST?
With a minimote being $60, and an off brand android tablet $90-$100, I’d love to wall mount a few with permanent power.

Has anyone done this?

2 Likes

I haven’t done this yet, but my project for this month is to mount an iPad as a permanent type remote, and rotating message board.

I have looked into it a little, and I didn’t know if I wanted to put the full blown ST app on that iPad, or use the web services to build a web page to control just the devices I want to give access to on there.

If you do anything it would be great to see how you do it. I’m planning to work on mine starting in the next few weeks.

I haven’t done the mount thing either, but I have done the web page control thing.

I wanted to have guest access to my ST devices, but not all of them. For example, I didn’t want guests to have access to my master bedroom lights. So I created a web interface that is hosted on a raspberry pi server to control main room lights and the thermostat. It also displays information from the thermostat. The server is not accessible from outside the local network so only people that I give access to my home network can use it.

This is probably the best solution for a mounted tablet because the app takes some time to load and the web page can always be up and ready.

That sounds like a good solution. What do your guests use to access the page, their own phones/tablets?

I’ve seen where a few people here have written their own HTML front end. Is there any documentation on that, or somewhere to get started?

Anything with a browser would work. There is some kind of documentation, but I always have a hard time finding it. I used an example to code mine, but it seemed to have disappeared with the old forums.

After looking around, I’ve found these mounts: http://www.vidabox.com/ipad-2-ipad-3-ipad-4-wall-mount-frame/ipad-2-3-4-on-wall-mount-frame-permanent-dock.html. The price isn’t horrible and it would look pretty good on the wall.

@baldeagle072 Did you find the code example that you used for your?

I would like to set mine up, and mount my iPad as a home remote, and digital display, but where is the example code for it.

I can’t find the original code, but here is the code I am using.

For the smartapp:

 /**
 *  App Endpoint API Access Example
 *
 *  Author: SmartThings
 */


// Automatically generated. Make future change here.
definition(
    name: "Endpoint with Thermostat",
    namespace: "",
    author: "baldeagle072@gmail.com",
    description: "endpoint with thermostat",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience%402x.png",
    oauth: true
)

preferences {
	section("Allow Endpoint to Control These Things...") {
		input "switches", "capability.switch", title: "Which Switches?", multiple: true
        input "locks", "capability.lock", title: "Which Locks?", multiple: true, required: no
        input "thermostats", "capability.thermostat", title: "Which Thermostat?", multiple: true
	}
}

mappings {

	path("/switches") {
		action: [
			GET: "listSwitches"
		]
	}
	path("/switches/:id") {
		action: [
			GET: "showSwitch"
		]
	}
	path("/switches/:id/:command") {
		action: [
			GET: "updateSwitch"
		]
	}
	path("/locks") {
		action: [
			GET: "listLocks"
		]
	}
	path("/locks/:id") {
		action: [
			GET: "showLock"
		]
	}
	path("/locks/:id/:command") {
		action: [
			GET: "updateLock"
		]
	}
	path("/thermostats") {
		action: [
			GET: "listThermostats"
		]
	}
	path("/thermostats/:id") {
		action: [
			GET: "showThermostat"
		]
	}
	//
	path("/thermostats/:id/:command/:temp") {
		action: [
			GET: "updateThermostat"
		]
	}    
    
}

def installed() {}

def updated() {}


//switches
def listSwitches() {
	switches.collect{device(it,"switch")}
}

def showSwitch() {
	show(switches, "switch")
}
void updateSwitch() {
	update(switches)
}

//locks
def listLocks() {
	locks.collect{device(it,"lock")}
}

def showLock() {
	show(locks, "lock")
}

void updateLock() {
	update(locks)
}


//thermostats
def listThermostats() {
	thermostats.collect{device(it,"thermostat")}
}

def showThermostat() {
	show(thermostats, "thermostat")
}

void updateThermostat() {
    
	def device = thermostats.find { it.id == params.id }
	def command = params.command
	def temp = params.temp
    
    log.debug "$command ${params.id} at $temp"

	if(command == 'heat')
	{
		device.setHeatingSetpoint(temp)
	}
	else if(command == 'cool')
	{
	  device.setCoolingSetpoint(temp)	
	}
    else if(command == 'on')
    {
    	device.setThermostatMode('heat')
    }
    else if(command == 'off')
    {
    	device.setThermostatMode('off')
    }
}

def deviceHandler(evt) {}

private void update(devices) {
	log.debug "update, request: params: ${params}, devices: $devices.id"
    
    
	//def command = request.JSON?.command
    def command = params.command
    //let's create a toggle option here
	if (command) 
    {
		def device = devices.find { it.id == params.id }
		if (!device) {
			httpError(404, "Device not found")
		} else {
        	if(command == "toggle")
       		{
            	if(device.currentValue('switch') == "on")
                  device.off();
                else
                  device.on();
       		}
       		else
       		{
				device."$command"()
            }
		}
	}
}

private show(devices, type) {
	def device = devices.find { it.id == params.id }
	if (!device) {
		httpError(404, "Device not found")
	}
	else {
		def attributeName = type == "motionSensor" ? "motion" : type
		def s = device.currentState(attributeName)
		[id: device.id, label: device.displayName, value: s?.value, temperature: device.currentValue('temperature'), setTemp: device.currentValue('heatingSetpoint'), mode: device.currentValue('thermostatMode'), unitTime: s?.date?.time, type: type]
	}
}


private device(it, type) {
	it ? [id: it.id, label: it.label, type: type] : null
}

For the webpage part, you can use this OAuth example. You can get the URLs from running the program. Than, if you use the URL without the command part, it returns a JSON object that you can pull data from (Like displaying the temperature from your thermostat)

1 Like

@baldeagle072 Do you have the sample code for your web interface that you are using to access the end points?

I was hoping to not have to build a web interface to access all of the different endpoints.

Thanks

Target has new (non retina) iPad mini’s marked down to $199 this week. I’m gonna grab one or two and wall mount them for touch screen controllers.

Should be a nice clean look.

4 Likes

what is the name of the wall mount? link?

The mount is made by Simple Wall Mount Co: iPad mini mount

You can usually find it $20 cheaper on ebay