Skip to content

Commit

Permalink
Standardisation
Browse files Browse the repository at this point in the history
  • Loading branch information
tmleafs authored Feb 7, 2018
1 parent c37fcd9 commit 895a0bd
Showing 1 changed file with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@
* bspranger - renamed to bspranger to remove confusion of a4refillpad
*
*/
preferences {
input name: "dateformat", type: "enum", title: "Set Date Format\n US (MDY) - UK (DMY) - Other (YMD)", description: "Date Format", required: false, options:["US","UK","Other"]
input name: "clockformat", type: "bool", title: "Use 24 hour clock?", defaultValue: false, required: false
input description: "Only change the settings below if you know what you're doing", displayDuringSetup: false, type: "paragraph", element: "paragraph", title: "ADVANCED SETTINGS"
input name: "voltsmax", title: "Max Volts\nA battery is at 100% at __ volts\nRange 2.8 to 3.4", type: "decimal", range: "2.8..3.4", defaultValue: 3, required: false
input name: "voltsmin", title: "Min Volts\nA battery is at 0% (needs replacing) at __ volts\nRange 2.0 to 2.7", type: "decimal", range: "2..2.7", defaultValue: 2.5, required: false
input description: "Changed your battery? Reset the date", displayDuringSetup: false, type: "paragraph", element: "paragraph", title: "Battery Changed"
input name: "battReset", type: "bool", title: "Battery Changed?", description: "", displayDuringSetup: false
}

metadata {
definition (name: "Xiaomi Door/Window Sensor", namespace: "bspranger", author: "bspranger") {
Expand All @@ -45,9 +36,9 @@ metadata {
capability "Health Check"

attribute "lastCheckin", "String"
attribute "lastCheckinDate", "Date"
attribute "lastOpened", "String"
attribute "lastOpenedDate", "Date"
attribute "lastCheckinDate", "Date"
attribute "batteryRuntime", "String"

fingerprint endpointId: "01", profileId: "0104", deviceId: "0104", inClusters: "0000, 0003, FFFF, 0019", outClusters: "0000, 0004, 0003, 0006, 0008, 0005 0019", manufacturer: "LUMI", model: "lumi.sensor_magnet", deviceJoinName: "Xiaomi Door Sensor"
Expand Down Expand Up @@ -81,9 +72,10 @@ metadata {
]
}
valueTile("spacer", "spacer", decoration: "flat", inactiveLabel: false, width: 1, height: 1) {
state "default", label:''
}
valueTile("lastcheckin", "device.lastCheckin", decoration: "flat", inactiveLabel: false, width: 4, height: 1) {
state "default", label:'Last Checkin:\n${currentValue}'
state "default", label:'Last Event:\n${currentValue}'
}
standardTile("resetClosed", "device.resetClosed", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "default", action:"resetClosed", label: "Override Close", icon:"st.contact.contact.closed"
Expand All @@ -97,6 +89,22 @@ metadata {
main (["contact"])
details(["contact","battery","resetClosed","resetOpen","spacer","lastcheckin", "spacer", "spacer", "batteryRuntime", "spacer"])
}
preferences {
section {
input description: "", type: "paragraph", element: "paragraph", title: "DATE & CLOCK"
input name: "dateformat", type: "enum", title: "Set Date Format\n US (MDY) - UK (DMY) - Other (YMD)", description: "Date Format", options:["US","UK","Other"]
input name: "clockformat", type: "bool", title: "Use 24 hour clock?", defaultValue: false
}
section {
input description: "If you have installed a new battery, the toggle below will reset the Changed Battery date to help remember when it was changed.", type: "paragraph", element: "paragraph", title: "CHANGED BATTERY DATE RESET"
input name: "battReset", type: "bool", title: "Battery Changed?", description: ""
}
section {
input description: "Only change the settings below if you know what you're doing.", type: "paragraph", element: "paragraph", title: "ADVANCED SETTINGS"
input name: "voltsmax", title: "Max Volts\nA battery is at 100% at __ volts\nRange 2.8 to 3.4", type: "decimal", range: "2.8..3.4", defaultValue: 3, required: false
input name: "voltsmin", title: "Min Volts\nA battery is at 0% (needs replacing) at __ volts\nRange 2.0 to 2.7", type: "decimal", range: "2..2.7", defaultValue: 2.5, required: false
}
}
}

def parse(String description) {
Expand All @@ -105,7 +113,7 @@ def parse(String description) {
// send event for heartbeat
def now = formatDate()
def nowDate = new Date(now).getTime()
sendEvent(name: "lastCheckin", value: now)
sendEvent(name: "lastCheckin", value: now, displayed: false)
sendEvent(name: "lastCheckinDate", value: nowDate, displayed: false)

Map map = [:]
Expand Down

0 comments on commit 895a0bd

Please sign in to comment.