Newbie in need of a bit of help

Trying to write my own handler for a Z-Wave Immersion heater controller. The unit uses normal Binary Switching but has an option to set a timer for x number of minutes up to 1440 using the Schedule (0x53) Class.

I am struggling for some reason to get my head round creating a tile to display the current schedule. Maybe I should start with sending a schedule but I assume once on there has to be a schedule able to be recalled.

I created a zwaveevent to use the commandschedulereport to display a value. I have no ide what it is returning and I can’t get debugging working or the simulator to help work the issue out.

Any help would be appreciated. the code I have so far is below.

metadata {
definition (name: “Secure SIR321”, namespace: “smartthings”, author: “Antony Pugh”) {
capability “Actuator”
capability “Switch”
capability “Polling”
capability “Refresh”
capability “Sensor”

  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: “Immersion”, width: 6, height: 4, canChangeIcon: true){
tileAttribute (“device.switch”, key: “PRIMARY_CONTROL”) {
attributeState “on”, label: ‘Heating’, action: “switch.off”, icon: “st.switches.switch.on”, backgroundColor: “#79b821
attributeState “off”, label: ‘${name}’, action: “switch.on”, icon: “st.switches.switch.off”, backgroundColor: “#ffffff
}
}

    valueTile("timer", "device.timer", width: 2, height: 2) {
  		state "timer", label:'${currentValue}°',unit:""
        
  	}
  standardTile("refresh", "device.switch", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
  	state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
  }
  main "switch"
  details(["switch","refresh","timer"])

}
}

//def parse(String description) {
// def result = null
// def cmd = zwave.parse(description, [0x20: 1, 0x70: 1, 0x53: 1])
// if (cmd) {
// result = createEvent(zwaveEvent(cmd))
// log.debug “Parsed ${cmd} to ${result.inspect()}”
// }
// 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 parse(String description) {
def result = null
def cmd = zwave.parse(description, [0x20: 1, 0x70: 1, 0x53: 1])
if (cmd) {
result = zwaveEvent(cmd)
log.debug “Parsed ${cmd} to ${result.inspect()}”
} else {
log.debug “Non-parsed event: ${description}”
}
return result
}

def zwaveEvent(physicalgraph.zwave.commands.schedulev1.CommandScheduleReport cmd) {
createEvent(name: “timer”, value = cmd.durationByte ? unit:“mins”)
log.debug “Parsed ${cmd} to ${result.inspect()}”
}

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”]
}

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()
])
}

[quote=“Behold81, post:1, topic:36926”]
createEvent(name: “timer”, value = cmd.durationByte ? unit:“mins”)
log.debug “Parsed ${cmd} to ${result.inspect()}”
[/quote]I’m also new to device types so I may be wrong, but I think the event needs to be returned by the method. Try swapping these two lines and see if that makes a difference.

[quote=“krlaframboise, post:2, topic:36926”]
value = cmd.durationByte ? unit:“mins”)
[/quote]I think that should also be:
value: cmd.durationByte, unit:“mins”)

Hmmm

That does not seem to help.

I’m struggling with how to present the code for 0x53. There are no examples anywhere on how to use it,.

I have now tried to move on to Setting the schedule command which should be telling it a number of mins and it will turn on for that long. Once this is working then maybe a response can be got. it looks like the manual states that binary wipes the schedule and visa versa.

My issue is that I can’t call any Schedule commands to make it work.

Here is the manual on the capabilities.

Binary Switch

  • Binary Switch Set
  • Binary Switch Get
  • Binary Switch Report

Schedule

  • Schedule Supported Get
  • Schedule Set
  • Schedule Get
  • Schedule Remove
  • Schedule State Get

Details:

  • Schedule ID: 0x01

  • Supported CC: Binary Switch SET command

  • Type of Schedule: Start now

  • Duration type: Minutes

  • Maximum schedule duration: 1440 minutes
    Note: No override and fallback mode is supported. The binary switch set command and pressing the BOOST button will over ride the schedule & vice versa.

    Basic Mapped to binary switch command class as follows:

  • Basic Set: Binary Switch
  • Set Basic Get: Binary Switch
  • Get Basic Report: Binary Switch Report

Association Two association groups are supported :

  • Group-1: Nodes to receive Schedule report
  • Group-2: Nodes to receive multilevel sensor report
  • Each group contains maximum 4 nodes.
  • Note: Group-2 is available only when external temp sensor is connected.

Multilevel sensor

  • Multilevel Sensor Get
  • Multilevel Sensor Report

[quote=“Behold81, post:4, topic:36926”]
I’m struggling with how to present the code for 0x53.
[/quote]I believe your CommandScheduleReport will get called if you change your refresh and/or poll method to look like:

delayBetween([
zwave.switchBinaryV1.switchBinaryGet().format(),
zwave.scheduleV1.commandScheduleGet().format(),
zwave.manufacturerSpecificV1.manufacturerSpecificGet().format()
])

That still won’t help you because your CommandScheduleReport method won’t work for several reasons, but I think it will if you change it to:

log.debug "Parsed ${cmd}"
createEvent(name: “timer”, value: cmd.durationByte, unit:“mins”)

To set the schedule, I think you need to do something like:
zwave.scheduleV1.commandScheduleSet(scheduleId: 0x01, durationByte: )

It looks like there are a lot of parameters you can pass it and durationByte would be the number of minutes to turn on for. I’m not sure which other parameters are required, but you can find more information about the schedule command here.

I probably would not do this with a device type… just let the device code work as stock and turn on and off. and use one of the scheduling smartapps to turn it on and off (assuming that it has switch control) that are already out there

I would if it didn’t turn off after 120 mins. The on off is a count down timer. On the main unit it’s 30/60or 120 mins.

As a plain z wave switch it’s 120 mins. I want some longer periods. The schedule class allows it to be turned on for up to 24h in 1 min increments.

I suppose I could monitor for if it turns off in this period tun it back on. Would be good to have this fully working. This is the only immersion switch in the uk. All the micro switches are not good with 3kw loads and need solid relays.

Hi @Behold81
I know this is almost 7 years later, but I am in the process of developing an Edge driver for my SIR321.
Did you ever solve your 0x53 schedule problem?
Even specifying a 23 hour period would mean my SIR321 stayed on until explicitly switched off.
Cheers,
Aidan