Multi Tile Status not showing correctly after a refresh


(Antony Pugh) #1

I have a simple zwave switch setup at the moment. that will be doing more later. it has a few capabilities but for now I just need it that when on shows as on and viceversa.

I have added a binary tile and this does show correct. If I turn it on the tile goes green and to on. the binary shows 255. if I do a refresh it shows as off in the multitile but the binary is still correct and logging still shows the payload as on.

what is not right?

It is possible I have some dead code breaking it.

/**

  • Copyright 2015 SmartThings
  • 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: “Secure SIR321 v2”, namespace: “smartthings”, author: “SmartThings”) {
capability "Actuator"
capability "Indicator"
capability "Switch"
capability "Polling"
capability "Refresh"
capability "Sensor"
capability “Thermostat Schedule”

  fingerprint deviceId:"0x1000", inClusters: "0x72 0x86 0x25 0x20 0x85 0x53 0x70"

}

// simulator metadata
simulator {
status “on”: "command: 2003, payload: FF"
status “off”: “command: 2003, payload: 00”

  // reply messages
  reply "2001FF,delay 100,2502": "command: 2503, payload: FF"
  reply "200100,delay 100,2502": "command: 2503, payload: 00"

}

// tile definitions
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.switches.switch.on”, backgroundColor: "#79b821"
attributeState “off”, label: ‘${name}’, action: “switch.on”, icon: “st.switches.switch.off”, backgroundColor: “#ffffff
}
}

  standardTile("indicator", "device.indicatorStatus", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
  	state "when off", action:"indicator.indicatorWhenOn", icon:"st.indicators.lit-when-off"
  	state "when on", action:"indicator.indicatorNever", icon:"st.indicators.lit-when-on"
  	state "never", action:"indicator.indicatorWhenOff", icon:"st.indicators.never-lit"
  }
    
  standardTile("scheduleset", "device.scheduleswitch", width: 2, height: 2, canChangeIcon: true) {
		state "Set", label: '${name}', action: "scheduleon", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
		state "on", label: '${name}', action: "scheduleoff", icon: "st.switches.switch.on", backgroundColor: "#E60000"

}

  standardTile("refresh", "device.switch", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
  	state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
  }
    valueTile("SwitchValue", "device.switchvalue", width: 2, height: 2,) {
  	state "default", label:'${currentValue}', unit:"dF"
  }
    valueTile("TestValue", "device.testvalue", width: 2, height: 2,) {
  	state "default", label:'${currentValue}'
  }
  main "switch"
  details(["switch","refresh","indicator","SwitchValue","TestValue","scheduleset"])

}
}

def parse(String description) {
log.debug "parse description: $description"
def result = null
def cmd = zwave.parse(description, [0x20: 1, 0x70: 1])
if (cmd) {
result = createEvent(zwaveEvent(cmd))
}
if (result?.name == ‘hail’ && hubFirmwareLessThan(“000.011.00602”)) {
result = [result, response(zwave.basicV1.basicGet())]
log.debug “Was hailed: requesting state update”
} else {
log.debug “Parse returned ${result?.descriptionText}”
}
return result
}

def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
def result = []
result << createevent(name: “switch”, value: cmd.value ? “on” : “off”)
result
}

def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd) {
[name: “switch”, value: cmd.value ? “on” : “off”, type: “physical”]
}

def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd) {
[name: “switch”, value: cmd.value ? “on” : “off”, type: “digital”]
[name: “switchvalue”, value: cmd.payload]

}

def zwaveEvent(physicalgraph.zwave.commands.schedulev1.CommandScheduleReport cmd) {
[name: “testvalue”, value: cmd.durationByte]

}

def zwaveEvent(physicalgraph.zwave.commands.configurationv1.ConfigurationReport cmd) {
def value = "when off"
if (cmd.configurationValue[0] == 1) {value = “when on”}
if (cmd.configurationValue[0] == 2) {value = “never”}
[name: “indicatorStatus”, value: value, display: false]
}

def zwaveEvent(physicalgraph.zwave.commands.hailv1.Hail cmd) {
[name: “hail”, value: “hail”, descriptionText: “Switch button was pressed”, displayed: false]
}

def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) {
if (state.manufacturer != cmd.manufacturerName) {
updateDataValue(“manufacturer”, cmd.manufacturerName)
}
}

def zwaveEvent(physicalgraph.zwave.Command cmd) {
// Handles all Z-Wave commands we aren’t interested in
[:]
}

def on() {
delayBetween([
zwave.basicV1.basicSet(value: 0xFF).format(),
zwave.switchBinaryV1.switchBinaryGet().format()
])
}

def off() {
delayBetween([
zwave.basicV1.basicSet(value: 0x00).format(),
zwave.switchBinaryV1.switchBinaryGet().format()
])
}

def poll() {
delayBetween([

  zwave.switchBinaryV1.switchBinaryGet().format(),
  zwave.manufacturerSpecificV1.manufacturerSpecificGet().format()

])
}

def refresh() {
delayBetween([
zwave.switchBinaryV1.switchBinaryGet().format(),
zwave.manufacturerSpecificV1.manufacturerSpecificGet().format()
])
}

def scheduleon() {
sendEvent(name: “scheduleswitch”, value: “on”)
zwave.scheduleV1.commandScheduleSet(scheduleId: 0x01, durationByte: 20)
log.info “On”
}

def scheduleoff() {
sendEvent(name: “scheduleswitch”, value: “off”)
log.info “off”
}

def indicatorWhenOn() {
sendEvent(name: “indicatorStatus”, value: “when on”, display: false)
zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 3, size: 1).format()
}

def indicatorWhenOff() {
sendEvent(name: “indicatorStatus”, value: “when off”, display: false)
zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 3, size: 1).format()
}

def indicatorNever() {
sendEvent(name: “indicatorStatus”, value: “never”, display: false)
zwave.configurationV1.configurationSet(configurationValue: [2], parameterNumber: 3, size: 1).format()
}

def invertSwitch(invert=true) {
if (invert) {
zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 4, size: 1).format()
}
else {
zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 4, size: 1).format()
}
}


(Antony Pugh) #2

RESOLVED. Kinda

Its the dual item on the Binary Get command.

Can you run multiple Get’s and have it feed different tiles?


(Scruffy Sjb) #3

I’ve just got me an SIR 321 - how are you doing with yours? Did you get your issues resolved?

Can you share your Device Handler with the community?

Thanks,
Simon


(Scruffy Sjb) #4

I’ve not set mine up yet – it’s still on my to-do list. FYI – I live in the US as well as in Ireland and the SIR321 is in Ireland – I have SmartThings in both locations. There is some remodeling going on in my Irish house that will entail altering the plumbing and would affect the location of the SIR321 – so that’s why it’s still on my to-do list.

Thanks for sharing your handler.

Simon