Multiple http:// buttons

Hi,
Does anyone have, or can anyone create a tile for the Samsung smartthings app, that has a number of momentary buttons that send http: commands?
I have a pi running apache, that in turn is controlling some shutters and blinds.
need 5 or 6 buttons on the same device / tile though.
Any suggestions?
many thanks
ANdy

Hello @andysmith13,
Configuring more than one button in the same device card/tile is not available yet, but there are two alternatives:

  1. Create a multi-component device (Picture 1)

In the generated event of the button, you can identify the source component. Below, you will find a code snippet of the SmartThings Schema example.

const connector = new SchemaConnector()
    .enableEventLogging(2)
    .discoveryHandler((accessToken, response) => {
      const d1 = response.addDevice('st-schema-MultButton', 'ST schema MultButton', 'deviceProfileID')
      d1.manufacturerName('xxxx');
      d1.modelName('xxxx');
    })
    .stateRefreshHandler((accessToken, response) => {

      let d1 = response.addDevice('st-schema-MultButton')
      let main = d1.addComponent('main');
      main.addState('st.momentary')
      
      let comp2 = d1.addComponent('compone');
      comp2.addState('st.momentary')
      //...
    })
    .commandHandler((accessToken, response, devices) => {
      for (const device of devices) {
        for (const cmd of device.commands) {
          if (cmd.component === 'main' && cmd.command === 'push') {
            //HTTP request
          } 
        }
      }
    });
  1. Create a custom capability with a List display type (Picture 2)

You would select the option you want and receive a command with its argument to use it as a condition to make the HTTP request.
For more information about this option, you should see this post.
The function to create new capability presentations is being fixed and will be available as soon as possible, so you could take this option as a future enhancement.
The capability presentation to get an element similar to my example is:

"detailView": [
        {
            "label": "List Element",
            "displayType": "list",
            "list": {
                "state": {
                    "value": "listElement.value",
                    "alternatives": [
                        {
                            "key": "off",
                            "value": "Off",
                            "type": "inactive"
                        },
                        {
                            "key": "on",
                            "value": "On",
                            "type": "active"
                        },
                        {
                            "key": "autoOff",
                            "value": "Auto Off",
                            "type": "inactive"
                        }
                    ]
                },
                "command": {
                    "name": "setListElement",
                    "alternatives": [
                        {
                            "key": "off",
                            "value": "Off",
                            "type": "inactive"
                        },
                        {
                            "key": "on",
                            "value": "On",
                            "type": "active"
                        },
                        {
                            "key": "autoOff",
                            "value": "Auto Off",
                            "type": "inactive"
                        }
                    ]
                }
            }
        }
    ]

thanks for this. the single button i am using (and it works fine), is the code below.

Is there a simple way to have say 6 of these buttons together?

thanks so much.
andy

/*

import groovy.json.JsonSlurper

metadata {
definition (name: “HTTP Button”, namespace: “sc”, author: “SC”) {
capability “Actuator”
capability “Switch”
capability “Momentary”
capability “Sensor”
}

preferences {
	input("DeviceIP", "string", title:"Device IP Address", description: "Please enter your device's IP Address", required: true, displayDuringSetup: true)
	input("DevicePort", "string", title:"Device Port", description: "Empty assumes port 80.", required: false, displayDuringSetup: true)
	input("DevicePathOn", "string", title:"URL Path", description: "Rest of the URL, include forward slash.", displayDuringSetup: true)
	//input("DevicePathOff", "string", title:"URL Path for OFF", description: "Rest of the URL, include forward slash.", displayDuringSetup: true)
	input(name: "DevicePostGet", type: "enum", title: "POST or GET", options: ["POST","GET"], defaultValue: "POST", required: false, displayDuringSetup: true)
	section() {
		input("HTTPAuth", "bool", title:"Requires User Auth?", description: "Choose if the HTTP requires basic authentication", defaultValue: false, required: true, displayDuringSetup: true)
		input("HTTPUser", "string", title:"HTTP User", description: "Enter your basic username", required: false, displayDuringSetup: true)
		input("HTTPPassword", "string", title:"HTTP Password", description: "Enter your basic password", required: false, displayDuringSetup: true)
	}
}


// simulator metadata
simulator {
}

// UI tile definitions
tiles {
	standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
		state "off", label: 'Push', action: "momentary.push", backgroundColor: "#ffffff", nextState: "on"
		state "on", label: 'Push', action: "momentary.push", backgroundColor: "#53a7c0"
	}
	main "switch"
	details "switch"
}

}

def parse(String description) {
log.debug(description)
}

def on() {
push()
}

def off() {
push()
}

def push() {
log.debug “—Sending command— ${DevicePathOn}”
sendEvent(name: “switch”, value: “on”, isStateChange: true, display: false)
sendEvent(name: “switch”, value: “off”, isStateChange: true, display: false)
sendEvent(name: “momentary”, value: “pushed”, isStateChange: true)
runCmd(DevicePathOn)
}

def runCmd(String varCommand) {
def host = DeviceIP
def LocalDevicePort = ‘’
if (DevicePort==null) { LocalDevicePort = “80” } else { LocalDevicePort = DevicePort }

def userpassascii = "${HTTPUser}:${HTTPPassword}"
def userpass = "Basic " + userpassascii.encodeAsBase64().toString()

log.debug "The device id configured is: $device.deviceNetworkId"

def path = varCommand
log.debug "path is: $path"
//log.debug "Uses which method: $DevicePostGet"
def body = "" 
//log.debug "body is: $body"

def headers = [:] 
headers.put("HOST", "$host:$LocalDevicePort")
headers.put("Content-Type", "application/x-www-form-urlencoded")
if (HTTPAuth) {
	headers.put("Authorization", userpass)
}
log.debug "The Header is $headers"
def method = "POST"
try {
	if (DevicePostGet.toUpperCase() == "GET") {
		method = "GET"
		}
	}
catch (Exception e) {
	settings.DevicePostGet = "POST"
	log.debug e
	log.debug "You must not have set the preference for the DevicePOSTGET option"
}
log.debug "The method is $method"
try {
	def hubAction = new physicalgraph.device.HubAction(
		method: method,
		path: path,
		body: body,
		headers: headers
		)
	log.debug hubAction
	return hubAction
}
catch (Exception e) {
	log.debug "Hit Exception $e on $hubAction"
}

//sendEvent
if (varCommand == "off"){
	sendEvent(name: "switch", value: "off")
    log.debug "Executing OFF"
} else {
	sendEvent(name: "switch", value: "on")
    log.debug "Executing ON"
}

}