SmartThings Community

Secure SIR321 with Temp Probe - Beta

Where are you seeing the HTTP Error?

this is the code I am using successfully.

/**
*

  • Horstmann Secure SIR-321
  • Author: Mike Baird
  • Date: 2017-08-15
  • 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.
  • http://products.z-wavealliance.org/products/1012

*/
metadata {

definition (name: “Secure SIR321”, namespace: “m1cs”, author: “Mike Baird”) {
capability “Actuator”
capability “Configuration”
capability “Switch”
capability “Polling”
capability “Refresh”
capability “Sensor”
capability “Thermostat Schedule”
capability “Temperature Measurement”

  fingerprint mfr: "0059", prod: "0010", deviceJoinName: "Immersion Heater"		

}

// simulator metadata
simulator {
status “on”: “command: 2503, payload: FF”
status “off”: “command: 2503, 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.bath13”, backgroundColor: “#79b821”, nextState:“off”
attributeState “off”, label: ‘{name}', action: "switch.on", icon: "st.Bath.bath13", backgroundColor: "#ffffff", nextState:"on" } tileAttribute("device.temperature", key: "SECONDARY_CONTROL") { attributeState("default", label:'{currentValue}’, unit:“C”, icon: “st.Weather.weather2”)
}
}

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

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

}
}

def parse(String description) {
log.debug “parse description: $description”

def result
//COMMAND_CLASS_BASIC 0x20
//COMMAND_CLASS_SWITCH_BINARY 0x25
//COMMAND_CLASS_VERSION 0x86
//COMMAND_CLASS_CONFIGURATION 0x70
//COMMAND_CLASS_MANUFACTURER_SPECIFIC 0x72 (v2)
//COMMAND_CLASS_SENSOR_MULTILEVEL 0x31
//COMMAND_CLASS_CLIMATE_CONTROL_SCHEDULE 0x46
//COMMAND_CLASS_ASSOCIATION 0x85

def cmd = zwave.parse(description, [0x20:1, 0x25:1, 0x86:1, 0x70:1, 0x72:2, 0x31:1])
if (cmd) {
result = createEvent(zwaveEvent(cmd))
}

log.debug “Parse returned ${result?.descriptionText}”

return result
}

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

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.configurationv1.ConfigurationReport cmd)
{
log.debug “configuration: $cmd”
def map = [:]
map.value = cmd.scaledConfigurationValue
map.displayed = false
switch (cmd.parameterNumber) {
case 1:
map.name = “failSafeTimer”
break
case 2:
map.name = “tempScale”
break
case 3:
map.name = “tempReportInterval”
break
case 4:
map.name = “deltaConfigTempReport”
break
case 5:
map.name = “tempCutOff”
break
default:
return [:]
}
return map

}

def zwaveEvent(physicalgraph.zwave.commands.sensormultilevelv1.SensorMultilevelReport cmd)
{
def result =
def map = [:]
map.value = cmd.scaledSensorValue.toString()
map.unit = cmd.scale == 0.5 ? “F” : “C”
map.name = “temperature”
createEvent(map)
}

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

def on() {
delayBetween([
zwave.basicV1.basicSet(value: 0xFF).format(),
zwave.switchBinaryV1.switchBinaryGet().format(),
zwave.configurationV1.configurationSet(scaledConfigurationValue: 60, parameterNumber: 3, size: 2).format() //poll interval reduced to 1 minute
])
}

def off() {
delayBetween([
zwave.basicV1.basicSet(value: 0x00).format(),
zwave.switchBinaryV1.switchBinaryGet().format(),
zwave.configurationV1.configurationSet(scaledConfigurationValue: 300, parameterNumber: 3, size: 2).format() //poll interval increaced to 5 minutes
])
}

def poll() {
delayBetween([
zwave.switchBinaryV1.switchBinaryGet().format(),
zwave.sensorMultilevelV1.sensorMultilevelGet().format()
])
}

def refresh() {
delayBetween([
zwave.switchBinaryV1.switchBinaryGet().format(),
zwave.sensorMultilevelV1.sensorMultilevelGet().format(),
zwave.configurationV1.configurationGet(parameterNumber: 1).format(),
zwave.configurationV1.configurationGet(parameterNumber: 2).format(),
zwave.configurationV1.configurationGet(parameterNumber: 3).format(),
zwave.configurationV1.configurationGet(parameterNumber: 4).format(),
zwave.configurationV1.configurationGet(parameterNumber: 5).format()
], 3000)
}

def updated() {
log.debug “updated… calling configure.”
configure()
}

def configure() {
log.debug “configure”
def cmds =
cmds << zwave.configurationV1.configurationSet(scaledConfigurationValue: 0, parameterNumber: 1, size: 1).format() //disable failsafe timer
cmds << zwave.configurationV1.configurationSet(scaledConfigurationValue: 0, parameterNumber: 2, size: 2).format() //Set Temp Scale to C
cmds << zwave.configurationV1.configurationSet(scaledConfigurationValue: 300, parameterNumber: 3, size: 2).format() //poll interval in seconds
cmds << zwave.configurationV1.configurationSet(scaledConfigurationValue: 10, parameterNumber: 4, size: 2).format() //poll interval in degrees
cmds << zwave.configurationV1.configurationSet(scaledConfigurationValue: 800, parameterNumber: 5, size: 2).format() //degree failsafe in 0.1 degrees (800 = 80 C)
cmds << zwave.associationV1.associationSet(groupingIdentifier:2, nodeId:[zwaveHubNodeId]).format()
delayBetween(cmds, 2500)
}

Hi there

That’s great. Thanks very much.

To answer your first question in the IDE if I go to My Devices, choose the device and make a change then the webpage blanks. I then hit [F5] to refresh and the thing throws an HTTP error.

As for the code that you posted, thanks again. Copy Paste results in an error which seems to be a UNICODE issue around the quotes. Do you know of a magic way to get the code copied across?

Hey guys can u help?got myself a sir321 i cant copy and paste any of the code within the threads here as it comes up as an error within the "create device handler"box, so i have gone to git hub and used @Ross_McCarthy dth, the device handler is created fine, i then go to the sir321 which has been added via the smarthings app as a “zwave switch” use edit and then change the “type” to the new device handler “sir321 immersion controller” i press update and it says update and refreshes and says updated but it doesnt update it remains as a zwave switch type, to be sure i changed the type to a few other different zwave types just to see if it changes the type and it does,its seems it just wont accept the new device handler type,for the moment i have it working as on off switch with the zwave sw type,any advice would be appreciated very much,
thanks.

You need the one I posted. But it needs redoing so it works. I might try posting it to git hub instead.

Can’t do it for a couple of weeks though.

1 Like

Hey there,
Thanks very much for your reply, no worries at atall I can wait for that no problem I have no idea of coding so I wouldn’t know where to begin.thanks again

Any joy bro? no pressure just wondering if it’s still on the cards thanks

Yeah. I’m in the same boat.

Would be great to be able to set the immersion to run for 60 minutes rather than plain on/off

Sorry I have been out of the country and forgot. I’ll do it tomorrow. I might fit hub it for you.

1 Like

Thanks a mill mate git hub be top notch,
Thanks again :ok_hand:

behold81/ STCustomDH

Try this repo. if this works let me know Ill update the first page.

1 Like

Just seeing this thanks m8 ill let you know

1 Like

OK, so I have applied this and at least it is allowing me to change the device. I don’t have temperature sensors installed in my switches.

I don’t see any timer settings - is that expected? I would be great to be able to set 30mins, 60mins, 120mins or ON

No the commands are not usable in ST as they are not exposed by Samsung. I tried and tried and just failed.

The new coding might now support it but not looked. But a selection of push buttons and webcore pistons would do that.

Oh. Adding the temp sensor is useful. That way you can only have the immersion come on after the temp has dropped a significant amount rather than little top ups.

Also on long holidays you can use it as well OST protection.

Yes, I’m happy with the webcore piece. Thank you

1 Like

Hi Mike

This is the one that is working for me.

I notice that one of the capabilities for the device is schedule. When I look at this in WebCore then set schedule is exposed. Do you know how to take advantage of this - I naively tried Set Schedule 30 and it does not appear to do a whole lot :slight_smile:

It might be different now but the set schedule code was not supported by ST due to the type of request it was. Changes in the code sets from ST might allow this now.