Announcement

Collapse
No announcement yet.

Command to set Device Parameter

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bob_Linux_User
    replied
    I have attached the "How To" .pdf to create the pulse data (or any other device that changes value) and graph the data through HS3.

    Bob
    Attached Files
    Last edited by Bob_Linux_User; November 30, 2014, 08:42 PM. Reason: Updated/Corrected attachment

    Leave a comment:


  • Bob_Linux_User
    replied
    I found a program used by someone in another forum that will set the parameter values. The problem is that it is not in vb.net and it would take me a while to figure out his code and excerpt the section that sends the command to parameter 2. I know this is the easy way out, but is someone could look at the code and figure out how to send the configuration commands to the device it would solve my problem and the problem with the new z-wave plus alarm issue also. Any Help from the Gurus?

    Bob


    Code:
    **
     *  MIMOLite Doorbell
     *
    */
    metadata {
    	definition (name: "MIMOLite Doorbell", namespace: "NTDCS", author: "Adam Newcomb") {
        	capability "Contact Sensor"	
    	capability "Refresh"
            capability "Configuration"
            //uncomment for switch
            /*
            capability "Polling"
            capability "Switch"
            */
    	}
    	simulator {
    		// reply messages
    		reply "2001FF,delay 100,2502": "command: 2503, payload: FF"
    		reply "200100,delay 100,2502": "command: 2503, payload: 00"
    
    		// status messages
    		status "open":  "command: 2001, payload: FF"
    		status "closed": "command: 2001, payload: 00"
    
            //uncomment for switch
            /*
            status "on":  "command: 2003, payload: FF"
    		status "off": "command: 2003, payload: 00"
            */
    	}
    
    	tiles {
    
            standardTile("contact", "device.contact", inactiveLabel: false) {
    			state "open", label: "DingDong!", icon: "st.security.alarm.alarm", backgroundColor: "#ffa81e"
    			state "closed", label: " ", icon: "st.security.alarm.clear", backgroundColor: "#79b821"
    		}
    
            standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") {
    			state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
    		}
    
            standardTile("power", "device.power", canChangeIcon: true, canChangeBackground: true)
    		{
            	state "off", label: 'OFF', backgroundColor: "#ffa81e", icon:"st.switches.light.off"
            	state "on", label: 'ON', backgroundColor: "#79b821", icon:"st.switches.light.on"
            }
    
    		//uncomment for switch
            /*
    		standardTile("switch", "device.switch", canChangeBackground: true, canChangeIcon: true, inactiveLabel: false) {
            	state "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
    			state "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#ffa81e"
            }
            */
    
            valueTile("voltage", "device.voltage") {
    			state("voltage", label:'${currentValue}v', unit:"ADC")
    		}
    
    
    		main (["contact"])
    
            //uncomment for switch
    		details(["contact", "voltage", "refresh", "power" /* , "switch" */])
    	}
    }
    
    def parse(String description) {
    
        def result = null
        def cmd = zwave.parse(description, [0x20: 1, 0x84: 1, 0x30: 1, 0x70: 1, 0x31: 3, 0x71: 1])
        if (cmd) {
            result = zwaveEvent(cmd)
            log.debug "parse cmd: '${cmd}' to result: '${result.inspect()}'"
        } else {
            log.debug "parse failed for event: '${description}'"
        }
        result
    }
    
    def zwaveEvent(physicalgraph.zwave.commands.sensorbinaryv1.SensorBinaryReport cmd)
    {
    	log.debug "zwaveEvent SensorBinaryReport: '${cmd}'"
    	sensorValueEvent(cmd.sensorValue)
    }
    
    def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd)
    {
        //BUGBUG_NOTE: this is the event that gets sent from simluated messages and also if subscribed to association group 1
    	log.debug "zwaveEvent BasicSet: '${cmd}'"
        sensorValueEvent(cmd.value)
    }
    
    def zwaveEvent(physicalgraph.zwave.commands.sensormultilevelv3.SensorMultilevelReport cmd)
    {
    	log.debug "zwaveEvent SensorMultilevelReport: '${cmd}'"
    
        createEvent( name: "voltage", isStateChange:true, value:cmd.scaledSensorValue,descriptionText: "${device.displayName} measured voltage in ADC Counts")
    }
    
    def zwaveEvent(physicalgraph.zwave.commands.alarmv1.AlarmReport cmd)
    {
    	log.debug "zwaveEvent AlarmReport: '${cmd}'"
    
        switch (cmd.alarmType) {
            case 8:
                def map = [ name: "power", isStateChange:true]
                if (cmd.alarmLevel){
                    map.value="off"
                    map.descriptionText = "${device.displayName} lost power"
                }
                else {
                    map.value="on"
                    map.descriptionText = "${device.displayName} has power"
                }
                createEvent(map)
            break;
    		default:
            	[:]
            break;
        }
    }
    
    def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd) {
    	log.debug "zwaveEvent SwitchBinaryReport: '${cmd}'"
    	switchValueEvent(cmd.value)
    }
    
    def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
    	log.debug "zwaveEvent BasicReport: '${cmd}'"
    
        switchValueEvent(cmd.value)
    }
    
    def zwaveEvent(physicalgraph.zwave.commands.configurationv1.ConfigurationReport cmd) {
    	log.debug "zwaveEvent ConfigurationReport: '${cmd}'"
        [:]
    }
    
    def zwaveEvent(physicalgraph.zwave.commands.associationv2.AssociationReport cmd) {
        cmd.nodeId.each({log.debug "AssociationReport: '${cmd}', hub: '$zwaveHubNodeId' reports nodeId: '$it' is associated in group: '${cmd.groupingIdentifier}'"})
        [:]
    }
    def zwaveEvent(physicalgraph.zwave.Command cmd) {
    	log.debug "zwaveEvent Command not Handled: '${cmd}'"
    	// Handles all Z-Wave commands we aren't interested in
    	[:]
    }
    
    private sensorValueEvent(Short value) {
    
    	def result = []
    
        if (value) {
        	log.debug "Open sensor value event: $value"
            result << createEvent(name: "contact", value: "open", descriptionText: "$device.displayName is open", isStateChange:true )
    	} else {
            log.debug "Closed sensor value event: $value"
    		result << createEvent(name: "contact", value: "closed", descriptionText: "$device.displayName is closed", isStateChange:true)
    	}
    
        result
    }
    
    private switchValueEvent(Short value)
    {
    	createEvent([name: "switch", value: value ? "on" : "off", isStateChange:true ])
    }
    
    
    def refresh() {
    	log.debug "executing 'refresh'"
    
        delayBetween([
    		zwave.configurationV1.configurationGet(parameterNumber:3).format(),
    		zwave.configurationV1.configurationGet(parameterNumber:4).format(),
    		zwave.configurationV1.configurationGet(parameterNumber:5).format(),
    		zwave.configurationV1.configurationGet(parameterNumber:6).format(),
    		zwave.configurationV1.configurationGet(parameterNumber:7).format(),
            zwave.configurationV1.configurationGet(parameterNumber:8).format(),
            zwave.configurationV1.configurationGet(parameterNumber:9).format(),
            zwave.configurationV1.configurationGet(parameterNumber:11).format(),
            zwave.associationV1.associationGet(groupingIdentifier:1).format(),
            zwave.associationV1.associationGet(groupingIdentifier:2).format(),
            zwave.associationV1.associationGet(groupingIdentifier:3).format(),
            zwave.associationV1.associationGet(groupingIdentifier:4).format(),
            zwave.associationV1.associationGet(groupingIdentifier:5).format(),
            zwave.switchBinaryV1.switchBinaryGet().format(),
            zwave.alarmV1.alarmGet(alarmType:8).format(),
            zwave.sensorMultilevelV3.sensorMultilevelGet().format()
    	],100)
    }
    
    // handle commands
    def configure() {
    	log.debug "executing 'configure'"
    
        /*
        8v=11000101 = 197
    	7v=11000001 = 193
    
    	4v=2741=10101011 = 171
    	5v=2892=10110100 = 180
    
    	.5v=631=00100111=39
    	2v=2062=10000000=128
    
    	24v=11101000 = 232
    	23v=11100111 = 231
    
    	1.5v=1687=01101001=105
        1.25v=1433=01011001=89
        1.125=1306=01010001=81
    	1v=1179=01001001=73
        */
    	def cmd = delayBetween([
        	zwave.configurationV1.configurationSet(parameterNumber: 2, size: 1, configurationValue: [1]).format(),  // clear pulse meter counts
        	zwave.configurationV1.configurationSet(parameterNumber: 3, size: 1, configurationValue: [1]).format(),  // sig 1 triggers relay
            zwave.configurationV1.configurationSet(parameterNumber: 4, size: 1, configurationValue: [100]).format(),  // lower threshold, high
            zwave.configurationV1.configurationSet(parameterNumber: 5, size: 1, configurationValue: [39]).format(),  // lower threshold, low
            zwave.configurationV1.configurationSet(parameterNumber: 6, size: 1, configurationValue: [232]).format(),  // upper threshold, high
            zwave.configurationV1.configurationSet(parameterNumber: 7, size: 1, configurationValue: [231]).format(),  // upper threshold, low
            zwave.configurationV1.configurationSet(parameterNumber: 8, size: 1, configurationValue: [1]).format(),  // set to analog, below bounds
            zwave.configurationV1.configurationSet(parameterNumber: 9, size: 1, configurationValue: [255]).format(),  // disable periodic reports
            zwave.configurationV1.configurationSet(parameterNumber: 11, size: 1, configurationValue: [0]).format(),  // momentary relay
            zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:zwaveHubNodeId).format(),	//subscribe to basic sets on sig1
            zwave.associationV1.associationSet(groupingIdentifier:2, nodeId:zwaveHubNodeId).format(),	//subscribe to basic multisensorreports
            zwave.associationV1.associationSet(groupingIdentifier:3, nodeId:zwaveHubNodeId).format(),	//subscribe to power alarm
            zwave.associationV1.associationRemove(groupingIdentifier:4, nodeId:zwaveHubNodeId).format(),	//unsubscribe from binary sensor reports
            zwave.associationV1.associationRemove(groupingIdentifier:5, nodeId:zwaveHubNodeId).format()	//unsubscribe from pulse meter events
    	],100)
        //associationRemove
    }
    
    //uncomment for switch
    /*
    def poll() {
    	// If you add the Polling capability to your device type, this command will be called approximately
    	// every 5 minutes to check the device's state
    	//zwave.basicV1.basicGet().format()
    }
    
    def on() {
    	delayBetween([
    		zwave.basicV1.basicSet(value: 0xFF).format(),
    		zwave.switchBinaryV1.switchBinaryGet().format()
    	],100)
    }
    
    def off() {
    	delayBetween([
    		zwave.basicV1.basicSet(value: 0x00).format(),
    		zwave.switchBinaryV1.switchBinaryGet().format()
    	],100)
    }
    */

    Leave a comment:


  • Bob_Linux_User
    replied
    Rupp,

    Thanks for the reply. I will put in the bugzilla report. I just cannot help but believe that I am missing something and that a CAPI command can be sent to the device for Parameter 2 and any value (doesn't care). BTW but following another post (smarter people), I now have the Water Usage storing data to a "Flat File" and a tab under view to display a Water Usage Graph. The graph can be Hourly/Daily/Weekly/Monthly .etc depending on the data stored in the Flat File. I am planning on publishing a "How To" document on the forum when I get it put together. Most of the work came from other members on this forum so I cannot really take any credit for the project. I have worked on the SQL database and can create the .mdf and the table from script, but that is as far as I got with that. I got sidetracked by the graphing, which is more fun.

    Bob

    Leave a comment:


  • Rupp
    replied
    You should put in a Bugzilla ticket on this feature request as this is a good idea and useful for many Z-Wave devices.

    Leave a comment:


  • Bob_Linux_User
    replied
    Good Morning Mike,

    You may be right. It just seems odd that the Pulse counter (internal counter) cannot be reset from a script. Not much use if the pulse count cannot be set to zero based on predetermined date/time. Thanks again.

    Bob

    Leave a comment:


  • Uncle Michael
    replied
    This may not be exactly what you are trying to do, but the exchange in this thread sounds like it might describe a similar problem.

    http://board.homeseer.com/showthread.php?p=1147103

    Leave a comment:


  • Bob_Linux_User
    replied
    Mike,

    I looked at the CAPI commands and the thread you referenced but still could not figure this one out. HS does this through the Z-Wave - Settings tab by selecting the Parameter number and the value so I know it can be done but it is beyond me. Thanks for your response.

    Bob

    Leave a comment:


  • Uncle Michael
    replied
    Sorry. I misunderstood your question.

    I think you will have to delve into the new CAPI commands to do what you want. This thread has some useful information.

    Leave a comment:


  • Bob_Linux_User
    replied
    Hi Uncle Michael,

    I do have access to the Help file. I understand the normal SetDeviceValue commands. What I do not understand is how to select which "Parameter" I want to send a value to. This device has 11 Parameter settings which cause the device (MIMOlite) to be configured for different functionality. If I send a value (any value) to Parameter 2 it causes the internal Pulse Counter to reset to zero. I can reset the device on the Devices Page but it does not send the reset to the MIMOlite to reset the internal counter so when the device sees another pulse the value on the Device Page is not 1 it is the internal counter +1. I do not know if I need to send two bytes of data with byte 1 being the Parameter and byte 2 being the value or even how to send raw data. I hope that made sense.

    Bob

    Leave a comment:


  • Uncle Michael
    replied
    Have you looked at the Help file?
    Do you have vb.net experience or are you looking for more basic help?
    Attached Files

    Leave a comment:


  • Bob_Linux_User
    started a topic Command to set Device Parameter

    Command to set Device Parameter

    Hi All,

    I cannot figure out how to send a value to a device Parameter. What I am trying to do is send a value of 1 to Parameter 2 on a specific device with VB.Net. I can manually perform the function under the Z-Wave Settings tab but need to send the command from a script. Any help would be appreciated.

    Bob
Working...
X