CoRE - Get peer assistance here with setting up Pistons

CoRE does not support wildcards. webCoRE supports contains(haystack, needle) and it even supports regular expressions in the needle.

after selecting the simulated contact for the action, select as the first task to “wait”
 then as the second task to open contact sensor.

ahhh, webCoRE, not CoRE.

Is there a tool to migrate my existing CoRE pistons to webCoRE, or is it a manual, rewrite-them-all sort of thing?

You have to rebuild them. However, it’s much quicker to build Pistons in webCoRE once you get the hang of it.

2 Likes

Need help making a piston, and not sure whare to start. Below is my install and the problem needing solving.

I have a ZigBee White Color Temperature Bulb installed on a switched circuit. If someone accidentally turns off the switch the light shows offline in IOS app. If I use the App to change the color of the lamp it goes back online. I would like a piston to somehow adjust that slider for color every few minutes to avoid it going offline. The reason is that when the switch comes back on it doesn’t go to the daylight setting, which means I have to use the app to get it back to daylight.

I am unable to remove the switch do to code, and can’t block it from turning off for the same reasons. So a Piston that would by time change the color of the lamp would solve the problem. Any help would be appreciated.

Hey there - as anyone made a piston (perhaps integrated with IFTTT) whereby the receipt of an email (with a particular subject line/content) will program a new lock code into a Schlage BE469 (or similar). Think it would be possible? (sorry - I’m new to CoRE)


Essentially I’m hoping to automate a vacation rental lock. My VR software automatically generates and sends the renter a lock code
but right now, I have to program the code into the lock (through @rboy 's app). I was hoping I could just bcc myself on that auto-email, and have IFTTT/CoRE extract the info from the email and program the lock.

Maybe I’m asking too much?

I’m not familiar with roby’s app but it sounds like it would be possible depending on a few things. Extracting the info from the email may be the most difficult part.

@LCSteve suggested using a custom DTH, and a WeBCoRe Piston which I did and so far so good.
/**

  • Osram Lightify RGBW A19/BR30 US version (HA) DTH rev 6/6/2017
  • by gkl_sf
  • set default color/level code by ranga
  • To set default initial (power-on) color/level:
    • set your preferred color/level
    • wait for few seconds, then tap the Set Default tile
    • wait 3-5 minutes for the process to complete (do NOT switch off or change any settings during this time)
    • the main (on/off) tile will turn orange with “WAIT” status during this period; if it does not reset after 3-5 minutes, tap the refresh tile
    • after that, you can try switching power off and on to see if the new color/level is set correctly
    • may need to upgrade firmware (via ST OTA) for this to work
  • 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.
  • Parts copyright 2015 SmartThings

**/

metadata {
definition (name: “Osram RGBW”, namespace: “gkl-sf”, author: “gkl_sf”) {

    capability "Actuator"
    capability "Color Control"
    capability "Color Temperature"
    capability "Configuration"
    capability "Polling"
    capability "Refresh"
    capability "Switch"
    capability "Switch Level"
    
    command "temp2700"
    command "temp3000"
    command "temp6500"
    
    command "setHue360", ["number"]

    command "pulseOn"
    command "pulseOff"
    
    command "blinkOn"
    command "blinkOff"
    
    command "loopOn"
    command "loopOff"
    
    command "setDefaultColor"
    
    fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 RGBW", deviceJoinName: "Osram Lightify A19 RGBW"
    fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY BR RGBW", deviceJoinName: "Osram Lightify LED BR30 RGBW"
}

preferences {            
   input(
         "switchTransition",
         "number",
         title: "Dim duration for On/Off",
         range: "0..10",
         description: "0-10 seconds",
         defaultValue: 2,
         required: false,
         displayDuringSetup: true
        )
   input(
         "levelTransition",
         "number",
         title: "Dim duration for level change",
         range: "0..10",
         description: "0-10 seconds",
         defaultValue: 4,
         required: false,
         displayDuringSetup: true
        )
   input(
         "colorTransition",
         "number",
         title: "Time to transition color",
         range: "0..10",
         description: "0-10 seconds",
         defaultValue: 2,
         required: false,
         displayDuringSetup: true
        )             
   input(
         "pulseDuration",
         "number",
         title: "Pulse dim up/down duration",
         range: "1..10",
         description: "1-10 seconds",
         defaultValue: 4,
         required: false,
         displayDuringSetup: true
        )
   input(
         "loopRate",
         "number",
         title: "Color loop rate in steps per second",
         range: "1..20",
         description: "range 1-25",
         defaultValue: 5,
         required: false,
         displayDuringSetup: true
        )           
}       

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:"off", icon:"st.lights.philips.hue-single", backgroundColor:"#79b821", nextState:"turningOff"
            attributeState "off", label:'${name}', action:"on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
            attributeState "turningOn", label:'Turning...', action:"on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
            attributeState "turningOff", label:'Turning...', action:"off", icon:"st.lights.philips.hue-single", backgroundColor:"#79b821", nextState:"turningOff"
            attributeState "wait", label:'Wait...', icon:"st.lights.philips.hue-single", backgroundColor:"#ffa81e"                
        }           
        tileAttribute ("device.level", key: "SLIDER_CONTROL") {
            attributeState "level", action:"setLevel"
        }
        tileAttribute ("device.color", key: "COLOR_CONTROL") {
            attributeState "color", action:"setColor"
        }
    }
                   
    controlTile("hueSliderControl", "device.hue", "slider", width: 4, height: 2, range: "(0..360)") {
        state "hue", action: "setHue360"
    }
    valueTile("hue", "device.hue", width: 2, height: 2) {
        state "hue", label:'Hue\n${currentValue}°',
        backgroundColors:[
                [value: 0, color: "ff0000"],
                [value: 8, color: "ff3800"],
                [value: 21, color: "ff6700"],
                [value: 27, color: "ffbf00"],
                [value: 41, color: "ffff00"],
                [value: 55, color: "dfff00"],
                [value: 95, color: "00ff00"],
                [value: 125, color: "00ff6f"],
                [value: 137, color: "00ffff"],
                [value: 165, color: "007fff"],
                [value: 206, color: "0000ff"],
                [value: 246, color: "8f00ff"],
                [value: 276, color: "ff00ff"],
                [value: 316, color: "ff007f"],
                [value: 341, color: "ffc0cb"],
                [value: 351, color: "dc143c"],
                [value: 357, color: "ff0000"],
                [value: 360, color: "ff0000"]                    
	    ]               
    }

    valueTile("saturation", "device.saturation", width: 3, height: 1) {
        state "saturation", label:'Saturation ${currentValue}%'
    }        
    valueTile("colorName", "device.colorName", width: 3, height: 1) {
        state "colorName", label:'${currentValue}'  
    }         
    
    
    controlTile("colorTempSliderControl", "device.colorTemperature", "slider", width: 4, height: 2, range:"(2700..6500)") {
        state "colorTemp", action:"color temperature.setColorTemperature"
    }
    valueTile("colorTemp", "device.colorTemperature", width: 2, height: 2) {
        state "colorTemp", label: 'Temp\n${currentValue} K'           
    }

    standardTile("temp2700", "device.temp2700", decoration: "flat", width: 2, height: 2) {
        state "default", label:'Incandescent', action: "temp2700", icon: "st.Lighting.light13"
    }        
    standardTile("temp3000", "device.temp3000", decoration: "flat", width: 2, height: 2) {
        state "default", label:'Halogen', action: "temp3000", icon: "st.lights.philips.hue-single"
    }
    standardTile("temp6500", "device.temp6500", decoration: "flat", width: 2, height: 2) {
        state "default", label:'Daylight', action: "temp6500", icon: "st.Weather.weather14"
    }         
            
    standardTile("pulse", "device.pulse", decoration: "flat", width: 2, height: 2) {
        state "off", label:'Pulse', action: "pulseOn", icon: "st.Lighting.light11", backgroundColor:"#ffffff"
        state "on", label:'Pulse', action: "pulseOff", icon: "st.Lighting.light11", backgroundColor:"#dcdcdc"
    }
    standardTile("blink", "device.blink", decoration: "flat", width: 2, height: 2) {
        state "off", label:'Blink', action: "blinkOn", icon: "st.Lighting.light11", backgroundColor:"#ffffff"
        state "on", label:'Blink', action: "blinkOff", icon: "st.Lighting.light11", backgroundColor:"#dcdcdc"
    }        
    standardTile("colorLoop", "device.colorLoop", decoration: "flat", width: 2, height: 2) {
        state "off", label:'Color Loop', action: "loopOn", icon: "st.Kids.kids2", backgroundColor:"#ffffff"
        state "on", label:'Color Loop', action: "loopOff", icon: "st.Kids.kids2", backgroundColor:"#dcdcdc"
    }
   
    standardTile("refresh", "device.refresh", decoration: "flat", width: 2, height: 2) {
        state "refresh", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
    }
    
    standardTile("configure", "device.configure", decoration: "flat", height: 2, width: 2) {
		state "configure", label:'', action:"configure", icon:"st.secondary.configure"
	}

    standardTile("defaultColor", "device.defaultColor", decoration: "flat", width: 2, height: 2) {
        state "default", label:'Set Default', action: "setDefaultColor", icon: "st.Lighting.light13"
    }        
    
    main(["switch"])
    details(["switch", "hueSliderControl", "hue", "saturation", "colorName", "colorTempSliderControl", "colorTemp", "temp2700", "temp3000", "temp6500", "pulse", "blink", "colorLoop", "refresh", "configure", "defaultColor"])
}

}

private getON_OFF_CLUSTER() { 6 }
private getLEVEL_CONTROL_CLUSTER() { 8 }
private getCOLOR_CONTROL_CLUSTER() { 0x0300 }

private getHUE_COMMAND() { 0 }
private getSATURATION_COMMAND() { 3 }
private getHUE_SATURATION_COMMAND() { 6 }

private getATTRIBUTE_HUE() { 0 }
private getATTRIBUTE_SATURATION() { 1 }
private getATTRIBUTE_COLOR_TEMPERATURE() { 7 }
private getATTRIBUTE_COLOR_MODE() { 8 }

private getDEFAULT_LEVEL_TRANSITION() {“2800”} //4 secs (little endian)
private getDEFAULT_COLOR_TRANSITION() {“1400”} //2 secs (little endian)
private getDEFAULT_PULSE_DURATION() {“2800”} //4 secs (little endian)
private getDEFAULT_LOOP_RATE() {“05”} //5 steps per sec

def parse(String description) {

def result = zigbee.getEvent(description)
def cmds = []

if (result) {
    cmds << createEvent(result)
    
    if (device.currentValue("pulse") == "on" && result.name == "level") {
        if (!state.pulseDuration) state.pulseDuration = DEFAULT_PULSE_DURATION
        if (result.value == 5) cmds << new physicalgraph.device.HubAction("st cmd 0x${device.deviceNetworkId} ${endpointId} 8 4 {fb ${state.pulseDuration}}")
        else if (result.value == 99) cmds << new physicalgraph.device.HubAction("st cmd 0x${device.deviceNetworkId} ${endpointId} 8 4 {0d ${state.pulseDuration}}")            
    }
    else if (result.name == "colorTemperature") {
        if (device.currentValue("colorMode") == "W") {
            def tempName = getTempName(result.value)
            cmds << createEvent(name: "colorName", value: tempName, displayed: false)
        }    
    }
}        
else {
    def zigbeeMap = zigbee.parseDescriptionAsMap(description)
    if (zigbeeMap?.clusterInt == COLOR_CONTROL_CLUSTER && device.currentValue("switch") == "on") {        
        if (zigbeeMap.attrInt == ATTRIBUTE_HUE) {
            def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 254 * 360)
            def colorName = getColorName(hueValue)
            cmds << createEvent(name: "hue", value: hueValue, displayed: false)
            cmds << createEvent(name: "colorName", value: colorName, displayed: false)
        }            
        else if (zigbeeMap.attrInt == ATTRIBUTE_SATURATION) {
            def saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 254 * 100)
            cmds << createEvent(name: "saturation", value: saturationValue, displayed: false)
        }
        else if (zigbeeMap.attrInt == ATTRIBUTE_COLOR_MODE) {
            if (zigbeeMap.value == "00") {
                cmds << createEvent(name: "colorMode", value: "RGB", displayed: false)
            }
            else if (zigbeeMap.value == "02") {
                cmds << createEvent(name: "colorMode", value: "W", displayed: false)
            }
        }               
    }
    else if (zigbeeMap?.clusterInt == 0x8021) {
        log.debug "*** received Configure Reporting response: ${zigbeeMap.data}"
    }
    else { log.debug "*** unparsed response: ${zigbeeMap}" }
}

return cmds

}

def updated() {

if (state.updatedTime) {
    if ((state.updatedTime + 5000) > now()) return null
}
state.updatedTime = now()

log.debug "--- Updated with: ${settings}"

String switchTransition
if (settings.switchTransition) {
    switchTransition = hex((settings.switchTransition * 10),4) //OnOffTransitionTime in 1/10th sec (big endian)
}
else {
    switchTransition = "0014" //2 seconds (big endian)
}    

if (settings.levelTransition) {
    state.levelTransition = swapEndianHex(hex((settings.levelTransition * 10),4))
}
else {
    state.levelTransition = "2800" //4 seconds
}    

if (settings.colorTransition) {
    state.colorTransition = swapEndianHex(hex((settings.colorTransition * 10),4))
}
else {
    state.colorTransition = "1400" //2 seconds
}

if (settings.pulseDuration) {
    state.pulseDuration = swapEndianHex(hex((settings.pulseDuration * 10),4))
}
else {
    state.pulseDuration = "2800" //4 seconds
}    

if (settings.loopRate) {
    state.loopRate = hex((settings.loopRate),2)
}
else {
    state.loopRate = "05"
}

return new physicalgraph.device.HubAction("st wattr 0x${device.deviceNetworkId} ${endpointId} 8 0x0010 0x21 {${switchTransition}}")  // on/off dim duration  

}

def refresh() {
[
“st rattr 0x${device.deviceNetworkId} ${endpointId} 6 0”, “delay 500”, //on-off
“st rattr 0x${device.deviceNetworkId} ${endpointId} 8 0”, “delay 500”, //level
“st rattr 0x${device.deviceNetworkId} ${endpointId} 0x0300 0”, “delay 500”, //hue
“st rattr 0x${device.deviceNetworkId} ${endpointId} 0x0300 1”, “delay 500”, //sat
“st rattr 0x${device.deviceNetworkId} ${endpointId} 0x0300 7”, “delay 500”, //color temp
“st rattr 0x${device.deviceNetworkId} ${endpointId} 0x0300 8” //color mode
]
}

def configure() {
zigbee.onOffConfig() +
zigbee.levelConfig() +
zigbee.colorTemperatureConfig() +
[
//hue
“zcl global send-me-a-report 0x0300 0 0x20 1 3600 {01}”, “delay 500”,
“send 0x${device.deviceNetworkId} ${endpointId} 1”, “delay 1000”,

    //saturation
    "zcl global send-me-a-report 0x0300 1 0x20 1 3600 {01}", "delay 500",
    "send 0x${device.deviceNetworkId} ${endpointId} 1", "delay 1500",

    //color mode
    "zcl global send-me-a-report 0x0300 8 0x30 1 3600 {}", "delay 500",
    "send 0x${device.deviceNetworkId} ${endpointId} 1", "delay 1500",        
    
    "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0x0300 {${device.zigbeeId}} {}", "delay 500"
] +
zigbee.writeAttribute(LEVEL_CONTROL_CLUSTER, 0x0010, 0x21, "0014") //OnOffTransitionTime in 1/10th sec, set to 2 sec, note big endian

}

def on() {
zigbee.on()
}

def off() {
pulseOff()
zigbee.off()
}

def setColorTemperature(value) {
def cmds =
cmds << sendEvent(name: “colorMode”, value: “W”, displayed: false)
cmds << zigbee.setColorTemperature(value)
cmds
}

def setLevel(value, duration = settings.levelTransition) { //duration in seconds
if (value == 0) off()
else zigbee.setLevel(value,duration)
}

def setColor(value) {
if (!state.colorTransition) state.colorTransition = DEFAULT_COLOR_TRANSITION
def cmds =
if (device.currentValue(“switch”) == “off”) {
cmds << zigbee.on()
cmds << “delay 500”
}
def scaledHueValue = zigbee.convertToHexString(Math.round(value.hue * 0xfe / 100), 2)
def scaledSatValue = zigbee.convertToHexString(Math.round(value.saturation * 0xfe / 100), 2)
cmds << sendEvent(name: “saturation”, value: value.saturation, displayed: false)
cmds << sendEvent(name: “colorMode”, value: “RGB”, displayed: false)
cmds << zigbee.command(COLOR_CONTROL_CLUSTER, HUE_SATURATION_COMMAND, scaledHueValue, scaledSatValue, state.colorTransition)
cmds
}

def setHue(value) { //accepts hue values 0-100, doesn’t change saturation
def cmds =
if (!state.colorTransition) state.colorTransition = DEFAULT_COLOR_TRANSITION
def scaledHueValue = zigbee.convertToHexString(Math.round(value * 0xfe / 100), 2)
cmds << sendEvent(name: “colorMode”, value: “RGB”, displayed: false)
cmds << zigbee.command(COLOR_CONTROL_CLUSTER, HUE_COMMAND, scaledHueValue, “00”, state.colorTransition)
cmds
}

def setHue360(value) { //accepts hue values 0-360 and sets saturation to 100%
if (!state.colorTransition) state.colorTransition = DEFAULT_COLOR_TRANSITION
def scaledHueValue = zigbee.convertToHexString(Math.round(value * 0xfe / 360), 2)
def cmds =
cmds << sendEvent(name: “saturation”, value: 100, displayed: false)
cmds << sendEvent(name: “colorMode”, value: “RGB”, displayed: false)
cmds << zigbee.command(COLOR_CONTROL_CLUSTER, HUE_SATURATION_COMMAND, scaledHueValue, “fe”, state.colorTransition)
cmds
}

def setSaturation(value) {
if (!state.colorTransition) state.colorTransition = DEFAULT_COLOR_TRANSITION
def scaledSatValue = zigbee.convertToHexString(Math.round(value * 0xfe / 100), 2)
def cmds =
cmds << sendEvent(name: “saturation”, value: value, displayed: false)
cmds << sendEvent(name: “colorMode”, value: “RGB”, displayed: false)
cmds << zigbee.command(COLOR_CONTROL_CLUSTER, SATURATION_COMMAND, scaledSatValue, state.colorTransition)
cmds
}

def loopOn() {
if (!state.loopRate) state.loopRate = DEFAULT_LOOP_RATE
def cmds =
cmds << zigbee.command(COLOR_CONTROL_CLUSTER, SATURATION_COMMAND, “fe”, “1400”) //set saturation to 100% over 2 sec
cmds << sendEvent(name: “colorLoop”, value: “on”, descriptionText: “Color Loop started”, displayed: true, isChange: true)
cmds << sendEvent(name: “colorMode”, value: “RGB”, displayed: false)
cmds << zigbee.command(COLOR_CONTROL_CLUSTER, 0x01, “01”, state.loopRate) //move hue command is 0x01, up is “01”, rate is steps per sec
cmds
}

def loopOff() {
def cmds =
cmds << sendEvent(name: “colorLoop”, value: “off”, descriptionText: “Color Loop stopped”, displayed: true, isChange: true)
cmds << zigbee.command(COLOR_CONTROL_CLUSTER, 0x01, “00”) //move hue command is 0x01, stop is “00”
cmds
}

def pulseOn() {
def cmds =
cmds << sendEvent(name: “pulse”, value: “on”, descriptionText: “Pulse mode set to On”, displayed: true, isChange: true)
cmds << zigbee.setLevel(95,0) //in case the level is already 99, since level needs to change to initiate the pulse cycling
cmds << “delay 100”
cmds << zigbee.setLevel(99,0)
cmds
}

def pulseOff() {
sendEvent(name: “pulse”, value: “off”, descriptionText: “Pulse mode set to Off”, displayed: true, isChange: true)
}

def blinkOn() {
def cmds =
cmds << sendEvent(name: “blink”, value: “on”, descriptionText: “Blink mode set to On”, displayed: true, isChange: true)
cmds << zigbee.command(3, 0x00, “100e”) //payload is time in secs to continue blinking (set to 3600 secs)
cmds
}

def blinkOff() {
def cmds =
cmds << sendEvent(name: “blink”, value: “off”, descriptionText: “Blink mode set to Off”, displayed: true, isChange: true)
cmds << zigbee.command(3, 0x00, “0000”)
cmds
}

def temp2700() {
setColorTemperature(2700)
}

def temp3000() {
setColorTemperature(3000)
}

def temp6500() {
setColorTemperature(6500)
}

def setDefaultColor() {
log.info “Setting default color”
def cmds =
[
sendEvent(name: “switch”, value: “wait”, descriptionText: “Setting default color/level”, displayed: true, isChange: true),
“st cmd 0x${device.deviceNetworkId} ${endpointId} 0xFC0F 0x01 {}”,
“delay 180000”
]
return cmds + refresh()
}

private getEndpointId() {
new BigInteger(device.endpointId, 16).toString()
}

private hex(value, width=2) {
def result = new BigInteger(Math.round(value).toString()).toString(16)
while (result.size() < width) {
result = “0” + result
}
return result
}

private String swapEndianHex(String hex) {
reverseArray(hex.decodeHex()).encodeHex()
}

private byte reverseArray(byte array) {
byte tmp;
tmp = array[1];
array[1] = array[0];
array[0] = tmp;
return array
}

private getTempName(value) {
String tempName
if (value < 3000) tempName = “Incandescent”
else if (value < 3300) tempName = “Halogen”
else if (value < 5000) tempName = “Cool White”
else if (value <= 6500) tempName = “Daylight”
else tempName = “White Light Mode”
return tempName
}

//color name for saturation 100%
private getColorName(hueValue) {
String colorName
if (hueValue >= 0 && hueValue <= 7) colorName = “Red”
else if (hueValue >= 8 && hueValue <= 20) colorName = “Red-Orange”
else if (hueValue >= 21 && hueValue <= 26) colorName = “Orange”
else if (hueValue >= 27 && hueValue <= 40) colorName = “Orange-Yellow”
else if (hueValue >= 41 && hueValue <= 54) colorName = “Yellow”
else if (hueValue >= 55 && hueValue <= 94) colorName = “Yellow-Green”
else if (hueValue >= 95 && hueValue <= 124) colorName = “Green”
else if (hueValue >= 125 && hueValue <= 136) colorName = “Green-Cyan”
else if (hueValue >= 137 && hueValue <= 164) colorName = “Cyan”
else if (hueValue >= 165 && hueValue <= 205) colorName = “Cyan-Blue”
else if (hueValue >= 206 && hueValue <= 243) colorName = “Blue”
else if (hueValue >= 244 && hueValue <= 272) colorName = “Blue-Magenta”
else if (hueValue >= 273 && hueValue <= 320) colorName = “Magenta”
else if (hueValue >= 321 && hueValue <= 349) colorName = “Magenta-Pink”
else if (hueValue == 350) colorName = “Pink”
else if (hueValue >= 351 && hueValue <= 356) colorName = “Pink-Red”
else if (hueValue >= 357 && hueValue <= 360) colorName = “Red”
else colorName = “Color Mode”
return colorName
}

Hey, I could use some help synchronizing a hue bulb group and a smart switch. I have several Hue bulbs set up as a group in my bedroom and primarily use Alexa or my phone to control the group (configured using the (re)connect smartapp. In addition to these though, I also have a Leviton smart switch that I’d like to control the Hue group as well (and ideally keep the two methods of control in sync). Right now I have it set up where it triggers the switch to toggle on/off when the Hue group changes, as well as to trigger the Hue group on/off when the physical switch is toggled. This, on its own, causes an infinite loop of sorts, since one condition triggers the other, which goes back and triggers the original, etc
 To try and break out of this loop, I added an extra conditional to each that checks previousAge() of the two “devices” and only evals to true when it’s been greater than 10 seconds. However, even this seems somewhat unstable and sometimes I get 3-4 toggles before it settles down. Does anyone have a better/simpler way to achieve this. I think logically it is somewhat similar to a three-way switch, in that there are 2 points of control, but slightly more complex since we need to make sure the state of each is sync’ed w/ the other. Any help w/ the logic for this would be huge!

Why not
Just create a core rule to turn on/off your hue bulbs when your Leviton smartswitch is turned on/off. Assuming your Leviton switch can be seen by Alexa, use Alexa to turn on the Leviton switch when using voice and then you can still use the switch to toggle the lights. Then they will always be in sync.

Otherwise if the switch cannot be seen by Alexa, create a virtual toggle switch within ST and then add that to the group of lights that Alexa turns on. You can then create a rule in Core to have the Leviton switch sync with the virtual switch.

That’s the way I used to have it but wanted scene/color changing and dimming control of the hue group via voice, which I couldn’t do with just the physical switch exposed to Alexa. I guess I could expose both but have different names for them, but then that also gets a bit confusing for the voice control.

what about naming the switch “hue bulb” and the alexa group “hue bulbs”
 then you can dim “hue bulbs” or set color on “hue bulbs”
 and still turn on “hue bulb”. Just thinking out loud.

@fstbusa, I was thinking of that, but adding any extra complexity w/ the wife doesn’t go over very well
 I think I actually figured something out though! Instead of using the previousAge() function, I’m now just setting a variable (inProgress), which defaults to false, but then gets toggled to true once the piston starts. Then, there’s a 5 second wait timer and the inProgress var gets reset to false afterwards. Lastly, I added an extra conditional that ensures inProgress != true before acting on the event. So far this seems to work great in my testing over the past few hours.

1 Like

I think I have something similar? I use voice to change the colour and brighten/ dim but then a piston set up so when a switch it’s triggered on the wall if the light is on, turn it of and visa versa. But I also have it set so depending on the location mode the switch on from the switch will also turn the light on at different levels. I also have these lights in groups using @tonesto7 trendsetter which is brilliant at keeping everything synchronized.

Need some help with error message. Haven’t messed with My CoRE setup in months. Everything was fine previously. Today I keep getting following error when I try to select DONE option at last point to return to piston list after viewing/editing a piston. I know, I know, should switch to webCoRE but I have been too lazy.

  • Already updated/published to latest: v0.3.16d.20170828
  • Utilizing iPhone/iPad both same result & both on latest ST app
  • Checked live logging - no messages under core except for dashboard link
  • Dashboard working fine
  • Pistons seem to be operating fine & can be edited despite error
  • I do not have a large setup, maybe 30 or so pistons
  • I can add a new piston, receive piston added & automating message, then same error msg despite it is saved
  • I end up having to select back arrow to exit piston view BUT changes I made to piston actually remain, so it’s accepting the edit despite the message each time I try the DONE button to exit piston edit/view page

Hey you awesome CORE people need a little help with this.

So I have this awesome piston that tells us if a door has been left open for longer than 5 mins

Problem is say for example like this week the Inside Garage Door stays open because I have contractors using the garage as a work shop to bring stuff in and out. Then when I open and close another door it causes this piston to fire because the inside garage door is still open and has been open all day. So I need a way to tell the app that until this condition changes just ignore it or something so that it will stop announcing that the door is open.

Down the road I’d like to build a way to loop a reminder that said door is still open so that someone will go close it.

Edit I accidentally posted this on another thread.

I am trying to setup a simple piston that would would keep track all my contact sensors and when any of them is opened, I would like to see a push notification for any and all contact sensors reporting open state.

I tried with one sensor to see when a door is open, but I cant seem to get the 2 things - the device name and the current status of that device to show up as push notification.

My piston basically would monitor for open condition then using location set string variable testVar to $currentEventDevice.
In the then condition, using location, send push notification with the text being {testVar}.
The notification shows incorrect text - time (the text in the notification is time, strange).

I can see the assignment of testVar is not empty instead of {currentEventDevice} although I have select that value in the assignment.

What am I doing wrong here?
Any suggestions appreciated.
Some screenshots of my piston -

G

I had a simple piston that if a virtual “arrival switch” was on and the motion sensor was active i would send a voice message to my speaker
pretty simple. Then I decided I would like to set another switch “arrival Text switch” and if it was on and there was motion then it would send both a text message as well as the voice notification. I use Echo to set whichever switch i need depending on if I was at home or outside.

It seems to be working as if the switches are reversed, and I don’t know what the exclamation point means beside the switch name

Thanks for any help

I hope someone can help with this problem


I’m trying to use the “Stays” or “Was” condition, with a SmartThings Power socket (Switch/Power Meter) and it just doesn’t seem to be working.

For example: “3D Printer power was greater than 20W for at least30 minutes” has been on all night, but is evaluating as false. Same with “3D Printer power was greater than 20W for at least 30 minutes”

Same deal if I try “3D Printer stays ON for 30 minutes”

Is this because it’s been on longer than 30 minutes? How do I configure that?

What I want to say is: if 3D Printer power drops below 20W, AND 3D Printer power was greater than 20W for more than 30 minutes.

It just doesn’t seem to be working. Any help would be greatly appreciated.

Cheers,

Adam

Hi


Looking for some help on my piston,
What I am trying to achieve is as follows:
if motion detected in lounge and lights are off, then set level and colour to 2 x lights in lounge

If no motion for 15 minutes
turn off.

This will allow me to let Plex adjust lights on events ( once in the room) and the motion sensor then wont keep turning the lights up

I have finally got the lights to turn on and to the right level and colour, and they do not change once on (great) with any additional motion, I just cant get them to turn off after 15-minutes on no motion.( screenshots of 2 of my attempts)

Any help appreciated