DTH for water sensor and device shows as ? on actiontiles


#1

So I made a smart cat water fountain using the Aeon Labs zwave water sensor. I followed the instructions in this thread …

I modified the Z-wave water sensor DTH as follows but now on actiontiles the tile appears with just a big ? instead of an icon. Is there something I’m missing in the dth? How to I get it to show an icon?

/**

  • Copyright 2017
  • 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.
  • Cat FountainZ-Wave Water Sensor
  • Author: SmartThings
  • Date: 2013-03-05
    */

metadata {
definition (name: “Cat Fountain Water Sensor”, namespace: “smartthings”, author: “SmartThings”, ocfDeviceType: “x.com.st.d.sensor.moisture”) {
capability "Water Sensor"
capability "Sensor"
capability "Battery"
capability “Refresh”

  fingerprint deviceId: '0xA102', inClusters: '0x30,0x9C,0x60,0x85,0x8E,0x72,0x70,0x86,0x80,0x84,0x7A'

}

simulator {
status “low”: "command: 3003, payload: 00"
status “full”: “command: 3003, payload: FF”
}

tiles(scale: 2) {
standardTile(“water”, “device.water”, width: 6, height: 4) {
state “low”, label: ‘Low’, icon:“st.alarm.water.wet”, backgroundColor:"#e86d13"
state “full”, label: ‘Full’, icon:“st.alarm.water.dry”, backgroundColor:"#00A0DC"
}
valueTile(“battery”, “device.battery”, inactiveLabel: false, decoration: “flat”, width: 4, height: 2) {
state “battery”, label:’${currentValue}% battery’, unit:""
}
standardTile(“refresh”, “device.refresh”, inactiveLabel: false, decoration: “flat”, width: 2, height: 2) {
state “default”, action: “refresh.refresh”, icon: “st.secondary.refresh”
}

  main "water"
  details(["water", "battery", "refresh"])

}
}

def parse(String description) {
def result = null
if (description.startsWith(“Err”)) {
result = createEvent(descriptionText:description)
} else {
def cmd = zwave.parse(description, [0x20: 1, 0x30: 1, 0x31: 5, 0x80: 1, 0x84: 1, 0x71: 3, 0x9C: 1])
if (cmd) {
result = zwaveEvent(cmd)
} else {
result = createEvent(value: description, descriptionText: description, isStateChange: false)
}
}
return result
}

def sensorValueEvent(Short value) {
def eventValue = value ? “full” : "low"
createEvent(name: “water”, value: eventValue, descriptionText: “$device.displayName is $eventValue”)
}

def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd)
{
sensorValueEvent(cmd.value)
}

def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd)
{
sensorValueEvent(cmd.value)
}

def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd)
{
sensorValueEvent(cmd.value)
}

def zwaveEvent(physicalgraph.zwave.commands.sensorbinaryv1.SensorBinaryReport cmd)
{
sensorValueEvent(cmd.sensorValue)
}

def zwaveEvent(physicalgraph.zwave.commands.sensoralarmv1.SensorAlarmReport cmd)
{
sensorValueEvent(cmd.sensorState)
}

def zwaveEvent(physicalgraph.zwave.commands.notificationv3.NotificationReport cmd)
{
def result = []
if (cmd.notificationType == 0x05) {
result << sensorValueEvent(cmd.event <= 2 ? 255 : 0)
} else if (cmd.notificationType == 0x04) {
if (cmd.event <= 0x02) {
result << createEvent(descriptionText: “$device.displayName detected overheat”, isStateChange: true)
} else if (cmd.event <= 0x04) {
result << createEvent(descriptionText: “$device.displayName detected rapid temperature rise”, isStateChange: true)
} else {
result << createEvent(descriptionText: “$device.displayName detected low temperature”, isStateChange: true)
}
} else if (cmd.notificationType == 0x07) {
if (cmd.event == 0x03) {
result << createEvent(descriptionText: “$device.displayName covering was removed”, isStateChange: true)
result << response(zwave.wakeUpV1.wakeUpIntervalSet(seconds:4*3600, nodeid:zwaveHubNodeId))
}
} else if (cmd.notificationType) {
def text = “Notification $cmd.notificationType: event ${([cmd.event] + cmd.eventParameter).join(”, ")}"
result << createEvent(name: “notification$cmd.notificationType”, value: “$cmd.event”, descriptionText: text, displayed: false)
} else {
def value = cmd.v1AlarmLevel == 255 ? “active” : cmd.v1AlarmLevel ?: "inactive"
result << createEvent(name: “alarm $cmd.v1AlarmType”, value: value, displayed: false)
}
result
}

def zwaveEvent(physicalgraph.zwave.commands.wakeupv1.WakeUpNotification cmd)
{
def result = [createEvent(descriptionText: “${device.displayName} woke up”, isStateChange: false)]
if (!state.lastbat || (new Date().time) - state.lastbat > 536060*1000) {
result << response(zwave.batteryV1.batteryGet())
} else {
result << response(zwave.wakeUpV1.wakeUpNoMoreInformation())
}
result
}

def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
def map = [ name: “battery”, unit: “%” ]
if (cmd.batteryLevel == 0xFF) {
map.value = 1
map.descriptionText = "${device.displayName} has a low battery"
map.isStateChange = true
} else {
map.value = cmd.batteryLevel
}
state.lastbat = new Date().time
[createEvent(map), response(zwave.wakeUpV1.wakeUpNoMoreInformation())]
}

def zwaveEvent(physicalgraph.zwave.commands.sensormultilevelv5.SensorMultilevelReport cmd)
{
def map = [ displayed: true, value: cmd.scaledSensorValue.toString() ]
switch (cmd.sensorType) {
case 1:
map.name = "temperature"
map.unit = cmd.scale == 1 ? “F” : "C"
break;
case 5:
map.name = "humidity"
map.value = cmd.scaledSensorValue.toInteger().toString()
map.unit = cmd.scale == 0 ? “%” : ""
break;
}
createEvent(map)
}

def zwaveEvent(physicalgraph.zwave.Command cmd) {
createEvent(descriptionText: “$device.displayName: $cmd”, displayed: false)
}

def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) {
def result = []

def msr = String.format("%04X-%04X-%04X", cmd.manufacturerId, cmd.productTypeId, cmd.productId)
log.debug "msr: $msr"
updateDataValue(“MSR”, msr)

if (msr == “0086-0002-002D”) { // Aeon Water Sensor needs to have wakeup interval set
result << response(zwave.wakeUpV1.wakeUpIntervalSet(seconds:4*3600, nodeid:zwaveHubNodeId))
}
result << createEvent(descriptionText: “$device.displayName MSR: $msr”, isStateChange: false)
result
}


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

Firstly, please visit our ActionTiles Knowledge Base, Support & Ideas Forum (support.actiontiles.com – easy to remember, right?) for the most up to date information:


##The quick answer is:

The Device probably does not have a current value for Attribute “water.

The quickest solution is usually sufficient to just “wet” the water sensor to make it have a value; then let it dry. ActionTiles will now be primed.

You can confirm in advance if the Device has a value by checking IDE under:

###My Devices / device name / details:

If there is no value for “water”, then ActionTiles has to display :question:.


#3

I think perhaps the problem is that the dth is set up so that the value for “water” is “full” or “low” instead of “wet” or “dry”

When I try to change it to “wet” and “dry” the device reports the opposite of the actual status and still shows a ? on actiontiles


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #4

I’m not sure what you mean by this?


#5

When I replace full and low in the dth with wet and dry, the device doesn’t report correctly and still shows ? In actiontiles


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #6

Please upload your current output of this screenshot from your SmartThings IDE / Location / My Devices:


#7


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #8

Thanks for the screenshot @Timffba!

The reason ActionTiles displays a :question: for your Device’s Tiles is because it has an invalid value for the Attribute “water”, that value being “full”.

The only valid (enumerated) values are "dry"or “wet”, per Capability “Water Sensor” specifications: