Url command to dim lights - roomie remote


(K) #1

I am working to integrate smartthings into http://www.roomieremote.com. The goal is to control my lights inside the roomie app. I am about to invest in zwave dimmers and already have phillips hue. Roomie allows to run a URL commands in the background. That is the only way I’ve been able to figure out how to get it to talk to ST. I have managed to get a light to turn on and off using this method. Here is where I struggle:

  1. Is there a way to us the ST end pointer to dim the lights instead of (on, off, toggle)
  2. Can I create a virtual switch that I call using the end pointer, and then that virtual switch essentially dims the lights (several dimmers or zigbee light bulbs) I need to the desired levels. Kind of like creating a macro?
  3. Is there a better way to go about this?

I am not very technical compared to some of you, I know just about enough to get me in trouble. Hope you guys can help.


(Geko) #2

Yes, dimmers implement “Switch Level” capability – see https://graph.api.smartthings.com/ide/doc/capabilities, which provides setLevel(number, number) command.

Can I create a virtual switch that I call using the end pointer, and then that virtual switch essentially dims the lights (several dimmers or zigbee light bulbs) I need to the desired levels. Kind of like creating a macro?

Yes, but it’s more elegant to use “Hello Home” actions, which is SmartThings equivalent of scenes.

Is there a better way to go about this?

See above.


(K) #3

I like the hello home idea - how do I activate it using a url?


(Geko) #4

There’re many threads on this subject. Search for it. Here’s one for example:


(Convinced ST will never be unbroken…) #5

Why two numbers???


(Geko) #6

I vaguely remember reading somewhere that second arg is an optional ramp rate. Don’t quote me though :slight_smile:


(Convinced ST will never be unbroken…) #7

Gotta love the docs!


(K) #8

Quick update and more questions. I got the virtual switch to trigger the big switch smart app which is calling a hello home action that turns off some lights and dims others. However, I actually need to dim my lights to about 1% (or the lowest setting) currently hello home doesn’t allow anything below 10%.

I’ve tried to figure out how to get the virtual switch to essentially do this directly, but it’s just a bit over my head. Can someone please show me the code I need to insert into the virtual switch to dim a specific dimmer to a predetermined brightness when the switch turns on and turn off the dimmer when the virtual switch turns off? I would greatly appreciate it.

Here is the code for the virtual switch.

/**
 *  Virtual Switch
 *
 *  Copyright 2014 Juan Risso
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 */
metadata {
        definition (name: "Virtual Switch", namespace: "juano2310", author: "Juan Risso") {
        capability "Switch"
        capability "Refresh"        
    }

	// simulator metadata
	simulator {
	}

	// UI tile definitions
	tiles {
		standardTile("button", "device.switch", width: 2, height: 2, canChangeIcon: true) {
			state "off", label: 'Off', action: "switch.on", icon: "st.Kids.kid10", backgroundColor: "#ffffff", nextState: "on"
			state "on", label: 'On', action: "switch.off", icon: "st.Kids.kid10", backgroundColor: "#FFA500", nextState: "off"
		}
		standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") {
			state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
		}        
		main "button"
		details(["button", "refresh"])
	}
}

def parse(String description) {
}

def on() {
	sendEvent(name: "switch", value: "on")
}

def off() {
	sendEvent(name: "switch", value: "off")
}