SmartThings Community

Newbie to Smartthings - Philips Dynalite help needed

project_lighting

#1

I have had Smartthings for a week now. I couldn’t wait any longer for 2.0 and being in Europe it will be 2016 anyway

I have Wemo connected, IFTTT, Nest thermostat, Nest protects, Smarttiles setup, Logitech Harmony, the smarting sensors and a few fake buttons so that my harmony remote can also trigger TO IFTTT and then onto Smappee compatible plugs. The long process to get the garden lights into the Harmony.

The main thing missing from my harmony remote (Although now in the smarttiles app by putting a url into “link to other dashboards”) is my Philips Dynalite lighting system, the Antumbra control panel was a big thing for me and the fact that I work for Philips too.

So what I would like to do, or happy to pay someone to help me / do the necessaries is to create a new smart device type and literally have it’s on as firing off http://192.168.0.121/SetDyNet.cgi?a=1&p=1 and similar for the off command, p=4 in that instance. this system doesn’t have a nice REST API like many of the examples of the internet but instead uses something a bit archaic Dynalite documentation.

Tips/thoughts/help/pointing me in the right direction appreciated.
Writing code has so far been beyond me!


Will it work with my existing philips dynalite
IFTTT and SmartThings (UK accounts)
(Tim Slagle) #2

Hey @thedezza

I’m gonna look into this for you.


#3

Tim thank you very much


#4

Guys I got basic on/off working with Tim’s help.

Now I have had someone help do a fuller solution in the device type with dimming control, which works on his v2 (uk) hub, works on my uk v2 hub, but not on my v1 (us) hub regardless of public or private IP address and port being used, can anyone see as to why it could be? Are these differences in how to write a device type dependant on which hub type there is?

metadata {
definition (name: “Dynalite Dimmer PS1”, namespace: “smartthings”, author: “PS”) {
capability "Switch Level"
capability "Actuator"
capability "Switch"
capability "Refresh"
capability “Sensor”
}

preferences {

  section("IP Address Settings") {

    input "IPAddress", "string", title:"IP Address", description: "IP Address of gateway", required: true
    input "IPPort", "string", title:"Port", description: "Port", required: true
}

section("Dynet Settings") {

    input "DynetArea", "number", title:"Area", description: "Area of channel", required: true
    input "DynetChannel", "number", title:"Channel", description: "Channel Number", required: true
    input "DynetFade", "number", title:"Fade Time", description: "Fade time ms", required: true
}

}

simulator {
    // status messages
}

tiles(scale: 2) {
    multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
        tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
            attributeState "on", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#79b821"
            attributeState "off", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff"
        }
        tileAttribute ("device.level", key: "SLIDER_CONTROL") {
            attributeState "level", action:"switch level.setLevel"
        }

    }

    standardTile("refresh", "device.power", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
        state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
    }

    main "switch"
    details(["switch","refresh"])
}

}

// Parse incoming device messages to generate events
def parse(String description) {
log.debug “Parse description $description”

}

def parseDescriptionAsMap(description) {
(description - “read attr - “).split(”,”).inject([:]) { map, param ->
def nameAndValue = param.split(":")
map += [(nameAndValue[0].trim()):nameAndValue[1].trim()]
}
}

// Commands to device
def on() {
sendEvent(name: “switch”, value: “on”)
sendpreset(3,1);

}

def off() {
sendEvent(name: “switch”, value: “off”)
sendpreset(3,4);

}

private getIPAddress() {
settings.IPAddress
}

def setLevel(value) {
log.trace “setLevel($value)”

//this updates the level of the icon
sendEvent(name: "level", value: value)

if(value > 0){
 sendEvent(name: "switch", value: "on")
}else{
  sendEvent(name: "switch", value: "off")
}

sendchannellevel(3, 1, value);

}

def sendpreset(area, preset){

     def ipaddress = settings.IPAddress + ":" + settings.IPPort;
    def path = "/SetDyNet.cgi?a=" + settings.DynetArea + "&c=255&p=" + preset
    def hubAction = new physicalgraph.device.HubAction(
    method: "GET",
    path: path,
    headers: [HOST:ipaddress],
)

}

def sendchannellevel(area, channel, level){

 def ipaddress = settings.IPAddress + ":" + settings.IPPort;
def path = "/SetDyNet.cgi?a=" + settings.DynetArea + "&c=" + settings.DynetChannel + "&l=" + level
def hubAction = new physicalgraph.device.HubAction(
    method: "GET",
    path: path,
    headers: [HOST:ipaddress],
)

}

def getchannellevel(area, channel, level){

  def ipaddress = settings.IPAddress + ":" + settings.IPPort;
def path = "/GetDyNet.cgi?a=" + settings.DynetArea + "&c=" + settings.DynetChannel
def hubAction = new physicalgraph.device.HubAction(
    method: "GET",
    path: path,
    headers: [HOST:ipaddress],
)

}

def refresh() {

}


#5

Clutching at straws, but anyone able to see why it won’t work on v1 hub, but does on v2?