Secure SIR321 with Temp Probe - Beta

smartapp_hvac
dth_hvac

(Antony Pugh) #1

Right. For those that do not know what this is. it is a Switch built for immersion heaters but I’m sure could control other things. it has a hard button on it for turning on for 30, 60 and 120 mins before auto turning off. It looks to have a bit more available to it when z-wave active.

Some features:

  • 1min to 24 hours time
  • Auto turn off at Temp
  • Tank Temp reading.

Taken a bit of time to learn what I’m doing and how to do it but I’m getting there. Attached is the most up-to-date code that works for this item.

At the moment all it does is report the temp and the on and off switch function

Things to do

  • Check Temp of water matches tank reading
  • Build in a calibration line for other users
  • Create 30, 60, 120 and 240 and ALL DAY Button on to Handler
  • Create Smart app to handle setting custom schedules (Possibly)
  • Confirm Configurations are working and Reportable
  • Tidy up code

CODE

/**

  • Thanks to MeavyDev for his SRT321 code that helped me make this work.
    */
    metadata {
    definition (name: “Secure SIR321”, namespace: “Behold81”, author: “Ant Pugh”) {
    capability "Actuator"
    capability "Configuration"
    capability "Switch"
    capability "Polling"
    capability "Refresh"
    capability "Sensor"
    capability "Thermostat Schedule"
    capability “Temperature Measurement”
  fingerprint deviceId:"0x1000", inClusters: "0x72 0x86 0x25 0x20 0x85 0x53 0x70 0x31"

}

// 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: ‘Heating’, action: “switch.off”, icon: “st.Bath.bath4.on”, backgroundColor: "#79b821"
attributeState “off”, label: ‘${name}’, action: “switch.on”, icon: “st.Bath.bath4.off”, backgroundColor: “#ffffff
}
tileAttribute(“device.temperature”, key: “SECONDARY_CONTROL”)
{
attributeState(“default”, label:’${currentValue} C’, unit:“C”)
}
}

  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","temperature","refresh"])

}
}

def parse(String description) {
log.debug "parse description: $description"
def result
def cmd = zwave.parse(description, [0x20:1, 0x25:1, 0x86:1, 0x70:1, 0x72:1, 0x31:1, 0x53:1, 0x86: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”]

}

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.commands.sensormultilevelv1.SensorMultilevelReport cmd)
{
def result = []
def map = [:]
map.value = cmd.scaledSensorValue.toString()
map.unit = cmd.scale == 1 ? “F” : "C"
map.name = "temperature"
createEvent(map)
}

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(),
zwave.sensorMultilevelV1.sensorMultilevelGet().format()

])
}

def refresh() {
delayBetween([
zwave.switchBinaryV1.switchBinaryGet().format(),
zwave.manufacturerSpecificV1.manufacturerSpecificGet().format(),
zwave.sensorMultilevelV1.sensorMultilevelGet().format()

])
}

def configure()
{
log.debug “configure”

// Normally this won't do anything as the thermostat is asleep, 
// but do this in case it helps with the initial config

//Set Temp Scale
zwave.configurationV1.configurationSet(configurationValue: [0xff], parameterNumber: 2, size: 1).format()
//Setup Group 2
zwave.associationV1.associationSet(groupingIdentifier:2, nodeId:[zwaveHubNodeId]).format()
//Set Report Time
zwave.configurationV1.configurationSet(configurationValue: [0x3c], parameterNumber: 3, size: 2).format()
zwave.configurationV1.configurationSet(configurationValue: [0x3c], parameterNumber: 4, size: 2).format()
zwave.configurationV1.configurationSet(configurationValue: [0x12c], parameterNumber: 5, size: 2).format()

}


Secure Controls SIR321 and SmartThings
(Ross Mc Carthy) #2

Hi there,

I recently purchased an SIR321 with Temp probe and have used your handler. Thanks a million for providing.
Been a few years since I did any kind of coding but I have “developed” a smartApp for use with the SIR321.
May be a bit messy but it seems to function well.

Takes Start and End Time for water heating
Take a target probe temp.

It’ll heat within that period until target temp is reached.
Also caters for someone manually hitting boost button and won’t stop heating for then just because they are outside the window.

I’m interested in any comments / improvements:


(Antony Pugh) #3

I’ll take a look.

Glad my handler is working for you.

I’m in the process of sorting the temp probe too so you can scale it to the real temperature not just the external tank.

I wanted to build in some bits in to the handler to give proper use of the timer function but I think it’s a non supported code set on smartthings as it never works when I test it.

Any thought or improvements welcome.


(Bill Bostock) #4

I can’t get my SIR321 to pair with my SmartThings Hub. It’s possibly too far away, although I have other devices in range which should repeat. Do you have any ideas?


#5

This is a zwave classic device, not the newer generation Z wave plus. For that reason, it will not use the repeaters until after it has first been paired to the hub.

So you will either have to bring the device close to the hub or the hub close to the device or use a minimote for the initial pairing.

The minimote is a small handheld controller which can perform some administrative functions for the hub, as well as acting as a regular button remote. It typically cost about €45. One of the things it can do is to include a new device to the network, as long as that device does not require secure pairing. So it’s particularly good for mains-powered devices like switches where it can be difficult to get the device and the hub close enough to do the initial pairing.

Once you have done the initial pairing, if you have to physically move the device to a different location for daily operation, do so and then run a “Z wave repair” utility and it will then use the nearby repeaters. But it has to get on the network first.


(Bill Bostock) #6

Many thanks. It will be easier to temporarily move the hub. Cheers


(Marcus Lyle) #7

Hello,
When I transferred the code over to my hub it showed up as “missing tiles”. Playing around a bit I’ve managed to get it to show tiles now. The odd thing at the moment is that I can’t seem to get a temperature reading.
With now temperature showing, it makes the app that Ross_McCarthy made not work. Any thoughts.
I like the idea of being able to scale it to real temperature.
Just to give some back ground, I’m attempting to use it to control the heater on a hot tub. I’ve got the water filter and jets all working through smartthings now, it’s just a case of getting this switch to operate the heater, essentially working just as an immersion would.
Any assistance appreciated.


(John Shaw) #8

Does anyone have a link to the SIR321 device handler code. The listing on this thread looks incomplete?
Many thanks.


(Antony Pugh) #9

Look half way down the link to the guy hub. This code works well.


(John Shaw) #10

Thanks for quick reply.
Did you mean thus link:
rossjmccarthy/SmartThings/blob/master/SIR321-Immersion-Control.src
If this is the correct one. Do you know if it works without a temperature probe.
Thanks.


(Antony Pugh) #11

It will the temp will just show up as -

You can also comment it out in the handler on functions.


(John Shaw) #12

Thanks for that.
Hope you don’t mind but just to confirm. In order to use your handler instead of the standard power outlet I’m using at the moment, I need to:

  1. Remove all SmartApps that control the SIR321 that I already have paired with smartthings.
  2. Remove the existing SIR321 pairing from smartthings.
  3. Install your handler into smartthings IDE.
  4. Pair the SIR321 as a new device using your handler into smartthings.

Does this sound correct?

Appreciate the help.
Thanks, John


(Antony Pugh) #13

You should be able to just add the handler. Then assign it to your SIR321. It should not need removing.


(John Shaw) #14

Thanks again.
Didn’t get chance to test this yet as I’m not sure how you would just switch the device handler for an already installed device. Would that be within the smartthings IDE rather than the mobile app maybe?


(Antony Pugh) #15

Yes. exactly that.

In the IDE add the new handler code

Then under My Devices, Edit

change the Type to your new handler. when you next use it all will be fine.

In all honesty with out the probe it still is just a power switch. The timing function will not work on ST due to the lack of code support I believe on the zWave Functions. (scenes I think it uses)

But if you have the temp probe then it makes it a bit smarter.


(John Shaw) #16

Right, that makes sense. I’ll try this.
I have ordered a probe, so might wait to switch the handler till then.
Thanks, John


(John Shaw) #17

Just one further question. I have found with the standard outlet handler, that quite often the Off command that is sent to the device by the smartthings hub is ignored and the device does not switch off.
I think it might be the device’s location and it’s distance from the smartthings hub. I’m going to try a z-wave extender to hopefully improve things.
Does your handler perform any checks that might help with the failed actioning of the Off command?
Thanks, John


(Antony Pugh) #18

The second handler in this post is not my work it was a redeveloped after I had a small config issue.

My plug is quite far from the hub but works reliably. I normally use a webcore anyway that runs an off command based on temp. So based on this it auto turns off if it fails to turn off the next time it checks.


(John Shaw) #19

I see, I haven’t tried webcore yet.
I’ve installed the extender so will see how it goes with that.
After looking yesterday evening, I think the issue is the line of sight between the hub and switch, in that it has the immersion heater tank in between…not good for radio signals of course!
Thanks for all your help.


#20

Hi there

This is exactly what I am trying to do but this results in an HTTP 405 error The specified HTTP method is not allowed for the requested resource.