Sending parameter settings


(Paul) #1

Hello,
Some of my Aeon Micro Switches don’t update the hub when they are manually switched. I contacted Aeon support and they responded with:

If it is possible to make parameter change to the DSC26103, then set this parameter setting:

Parameter 80 [1 byte]: 1 or 2

This should allow automatic reports to your controller every time they are switched manually.

Is that something I can do from within Smartthings? Perhaps by with a Smart App or custom device type? I’ve hacked a few apps together, but I’ve never dealt with device types or parameter changes.

EDIT:
Okay so I messed around with a custom device type. I copied the “Configuration” code from the Aeon Multisensor, but changed the payload to deliver what I think is the correct Parameter change. When I apply that new device type to my Micro Switch, the Configure tile doesn’t show up in preferences. I must be missing something silly. Here’s the code so far:

metadata {
	definition (name: "Z-Wave Switch with Perameter Change", namespace: "smartthings", author: "Smartthings") {
		capability "Actuator"
		capability "Indicator"
		capability "Switch"
		capability "Polling"
		capability "Refresh"
		capability "Sensor"
            capability "Configuration"

		fingerprint inClusters: "0x25"
	}

	// 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 {
		standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
			state "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
			state "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
		}
		standardTile("indicator", "device.indicatorStatus", 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("reporting", "device.reporting", inactiveLabel: false, decoration: "flat") {
			state "reporting", label:'', action:"reporting.reporting", icon:"st.secondary.configure"
        }
		standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") {
			state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
		}
		standardTile("configure", "device.configure", inactiveLabel: false, decoration: "flat") {
			state "configure", label:'', action:"configuration.configure", icon:"st.secondary.configure"
		}
		main "switch"
		details(["switch", "refresh", "indicator", "configure"])
        
	}
}

def parse(String 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) {
	[name: "switch", value: cmd.value ? "on" : "off", type: "physical"]
}

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

def configure() {
	zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 80, size: 1).format()
}

Any ideas would be greatly appreciated.


Single switch wall switches vs multi switch
(Mike Maxwell) #2

It goes in the device type., you want value 2, 1 requires adding a handler for the hail command.
I am using this on all my Aeons and it works great.
Give me a few minutes to scrape the code for you.


(Mike Maxwell) #3

OK, I don’t understand the configuration thing.
But the following will work.
–add command “hEnable” in the capability section
–then add this:
def hEnable() {
zwave.configurationV1.configurationSet(configurationValue: [2], parameterNumber: 80, size: 1).format()
}
Run the simulator, connect it to a real AEON, click the new command hEnable in the ide.
Activate the physical switch you just configured, the state should now report immediately in the ide.
The driver doesn’t need to be updated, you’re just using this device to set the parameter.

There is a way to have this set as the default state when the driver is first loaded, just didn’t bother as this was faster.

Update:, pram value 1 does work, but its slower as it causes ST to issue a poll command, where as value 2 causes the Aeon to issue a configuration report, so its quicker as an additional trip to the cloud is avoided.


(Paul) #4

Thanks @Mike_Maxwell. I’ll try that when I get home tonight!

EDIT: So I don’t know what changed, but suddenly the configure tile showed up today using my old code. I’m chalking it up to Smartthings oddities.

@Mike_Maxwell you’re right about using 2 instead of 1. It’s noticeably faster that way.

Mike’s code is probably more eligant, but in case anyone needs it, here’s what I’m using:

metadata {
	definition (name: "Z-Wave Switch with Parameter Change", namespace: "", author: "Paul Toben") {
		capability "Actuator"
		capability "Indicator"
		capability "Switch"
		capability "Polling"
		capability "Refresh"
		capability "Sensor"
            capability "Configuration"

		fingerprint inClusters: "0x25"
	}

	// 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 {
		standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
			state "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
			state "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
		}
		standardTile("indicator", "device.indicatorStatus", 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("reporting", "device.reporting", inactiveLabel: false, decoration: "flat") {
			state "reporting", label:'', action:"reporting.reporting", icon:"st.secondary.configure"
        }
		standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") {
			state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
		}
		standardTile("configure", "device.configure", inactiveLabel: false, decoration: "flat") {
			state "configure", label:'', action:"configuration.configure", icon:"st.secondary.configure"
		}
		main "switch"
		details(["switch", "refresh", "indicator", "configure"])
        
	}
}

def parse(String 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) {
	[name: "switch", value: cmd.value ? "on" : "off", type: "physical"]
}

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

def configure() {
	zwave.configurationV1.configurationSet(configurationValue: [2], parameterNumber: 80, size: 1).format()
}

(Mike Maxwell) #5

Sweet! I’m in the process of writing AEON specific device drivers for the V2 switch and dimmer, these will have the configurable parameters in the preferences section of the device, and update the device when these are changed.

I will be including 80 (reporting), 120 (external switch function type), and 2 which is a built in flashing/strobe function.
If I get 2 working the device could have an alarm/strobe capability which I would use when someone rings my freaking door bell…


(Paul) #6

Nice, Mike. Let me know if you need some beta testing. I’m in the process of installing about two dozen of the micro switches. Most are the cheapest V1 switches, but I have a handful of the V2 energy smart switches and dimmers too.


(Mike Maxwell) #7

V1?, do mean the non energy reporting ones?
I don’t think the actual V1’s are still available.
There’s 4 current devices available (all are V2)
Dimmer, non energy and energy reporting
Switch, non energy and energy reporting…
Yup, will keep you updated, looking like I’ll get this done before weeks end, I’ll post the device here.


(Paul) #8

Ah yes. Yeah that’s what I meant… I thought only the energy reporting ones were V2


(Mike Maxwell) #9

Alright here we go, please give them a try:
Switch highlights:
Variation of the stock SmartThings “Dimmer-Switch” and twack’s improved dimmer
–auto re-configure after setting preferences
–alarm indicator capability (using AEON hardware blink function)

Includes:
preferences tile for setting:
reporting functions (parameter 80)
control switch type (parameter 120)
preconfigured blinker modes
Switch Code:

Dimmer Code:

Let me know how it works for you!
I’m having fun with it.


About to make the jump...but I need a on/off relay module
(Mike Maxwell) #10

Freaking device tile to test the blinking doesn’t work from the APP on my phone at lease.
Works from the IDE, and also fine from stock smart apps.

That was the “drive the kids nuts by strobbing their lights until they get down for dinner” button…

UPDATE: app strobe test tile now works, nope, wasn’t me didn’t do nutting…


(Paul) #11

Working with the switch device type today… strobe tile is not working for me, but maybe I should just wait a bit…?


(Mike Maxwell) #12

You just confirmed my suspicions.
I don’t think the app tile can call a custom method properly.
I’ve updated both devices (in the code blocks above) to the devices I have in production, where the tile calls the normal alarm method vs the previous custom one I had.
These worked for me immediately after publishing.


(Joe) #13

I updated my device type for the standard v2 micro switch using the code supplied and the device stat goes from on to turning off, but never updates. Any advice?


(Mike Maxwell) #14

Please get the latest here:

I’ve replaced the above code with git links as well.


(Joe) #15

I also had to kill the app and restart it. I’m not sure why, but that fixed it. Thanks!


(Mike Maxwell) #16

Yea, killing the app is normal practice when replacing devices I’ve noticed, without doing that it’s hit and miss.


(Nico) #17

is the parameter is working on Aeon Micro Smart Energy Switch 2nd edition ?
because I have the same problem with latest status of this switch, when I manually change the state of switch.

For me, what’s perfect is when I’m using SmartPower Outlet, and using centralite switch device type.
The status is always right no matter what.

I just wonder, Micro Smart Energy Switch 2nd edition has KWH meter function, but no wattage information about it. Is it different feature ?
I think, when device can do KWH measurement, It should can measure the wattage.