Compare commits

..

52 Commits

Author SHA1 Message Date
유영서
9003a7da78 MSA-1304: 1 2016-05-26 02:49:33 -05:00
Jason Botello
aa3a18f421 Merge pull request #865 from SmartThingsCommunity/MSA-1255-1
MSA-1255: Gidjit - Smart Launcher with SmartThings support
2016-05-25 15:13:55 -05:00
Vinay Rao
fc6b14b85e Merge pull request #921 from SmartThingsCommunity/staging
Rolling down staging hotfix to master
2016-05-24 16:27:08 -07:00
Vinay Rao
f131fb71cf Merge pull request #918 from SmartThingsCommunity/production
Rolling down production hotfix to staging
2016-05-24 13:51:26 -07:00
Vinay Rao
9c27ed6cb7 Merge pull request #913 from SmartThingsCommunity/revert-904-revert-901-DVCSMP-1739-revert-untested-code
Revert "DVCSMP-1739 Revert "Undo DVCSMP-1739 Revert "make sure reformat the storeGraphData"""
2016-05-23 16:05:09 -07:00
Dwight Liu
35edaa19c7 Revert "DVCSMP-1739 Revert "Undo DVCSMP-1739 Revert "make sure reformat the storeGraphData""" 2016-05-23 14:38:40 -07:00
Vinay Rao
dc09201866 Merge pull request #912 from larsfinander/DVCSMP-1770_Add_MSR_to_zwave-switch_staging
DVCSMP-1770 Add MSR to zwave-switch and configure at pairing
2016-05-23 14:22:40 -07:00
Lars Finander
6afcbf8f70 DVCSMP-1770 Add MSR to zwave-switch and configure at pairing
-Make ZWave switch and Dimmer switch behave the same and save MSR and
manufacturer name in data
2016-05-23 14:13:10 -07:00
rohandesai
2894d52efa Merge pull request #909 from SmartThingsCommunity/MSA-1285-3
MSA-1285: May 2016 Submission
2016-05-20 13:39:33 -07:00
Will Price
a21f9f177c MSA-1285: Updated submission, already reviewed, just cleaning up the pull request. 2016-05-20 14:22:19 -05:00
rohandesai
02f968b8cb Merge pull request #889 from SmartThingsCommunity/MSA-1278-2
MSA-1278: Updates to dynamic object execution for security compliance
2016-05-20 10:30:48 -07:00
Juan Pablo Risso
b105d9d80e DVCSMP-1775 - Call poll() every 5 minutes to reduce duplicated calls (#902)
* DVCSMP-1775 - Call poll() every 5 minutes to reduce duplicated calls

Call poll() every 5 minutes instead of discovery() to reduce duplicated
getActivityList() call.

* Better error logging
2016-05-19 13:58:44 -04:00
Chelsea Okey
9bfad5d6a4 Merge pull request #908 from ch3lsea/INTL-527
INTL-527 Temperature Notifications Should Respect Location Temp Scale
2016-05-19 10:41:01 -05:00
chelseaokey
85a335d365 INTL-527 Temperature Notifications Should Respect Location Temp Scale 2016-05-19 09:59:45 -05:00
Jim Anderson
40e6778e31 Merge pull request #898 from jimmyjames/add-tiles-readme
DOCS-284 adding README for example/test tiles
2016-05-18 13:58:45 -05:00
Jim Anderson
feba6643a6 Merge pull request #893 from jimmyjames/tile-examples-default-state
DOCS-284 - update tiles for best practices, add setColor to colorWheel
2016-05-17 14:07:55 -05:00
Vinay Rao
49c893771d Merge pull request #905 from SmartThingsCommunity/staging
Rolling down staging hotfix to master
2016-05-17 10:06:48 -07:00
Vinay Rao
d73f4c2ded Merge pull request #904 from SmartThingsCommunity/revert-901-DVCSMP-1739-revert-untested-code
DVCSMP-1739 Revert "Undo DVCSMP-1739 Revert "make sure reformat the storeGraphData""
2016-05-17 10:01:27 -07:00
Vinay Rao
13a056ec8d Revert "Undo DVCSMP-1739 Revert "make sure reformat the storeGraphData"" 2016-05-17 09:59:03 -07:00
Vinay Rao
bd0ccd0c21 Merge pull request #903 from SmartThingsCommunity/staging
Rolling up staging to production Deploy May 17
2016-05-17 09:58:29 -07:00
Vinay Rao
d34508c19d Merge pull request #901 from dsainteclaire/DVCSMP-1739-revert-untested-code
Undo DVCSMP-1739 Revert "make sure reformat the storeGraphData"
2016-05-16 17:28:04 -07:00
David Sainte-Claire
a8e118fe83 Revert "make sure reformat the storeGraphData"
This reverts commit e1de599668.

Revert "make descriptive comment and add space in else condition"

This reverts commit 0e01cbed06.

Revert "null zwave event check in storeGraphData"

This reverts commit 8821c68e9c.
2016-05-16 17:20:43 -07:00
Vinay Rao
072cc066b6 Merge pull request #900 from workingmonk/bug/cree_remove_fingerprint
DPROT-94 removing cree fingerprint from zll dimmer until the fix in trim
2016-05-16 14:59:22 -07:00
Vinay Rao
17562c96ae removing cree fingerprint from zll dimmer until the fix in trim for deviceJoinName 2016-05-16 14:54:09 -07:00
Lars Finander
f55452d1c6 Merge pull request #887 from larsfinander/Add_MSR_to_zwave-switch
DVCSMP-1770 Add MSR to zwave-switch and configure at pairing
2016-05-16 13:37:18 -07:00
rohandesai
14b5fd41b8 Merge pull request #895 from rohandesai/DVCSMP-1709
DVCSMP-1709 Android>SmartApps>PlatLinkConnector>Unable To Add
2016-05-16 13:18:22 -07:00
rohandesai
0f4d7bd520 Merge pull request #868 from rohandesai/DVCSMP-1699-life360
DVCSMP-1699 Na02>Missing/Failed Oauth Tokens - Life360
2016-05-16 13:18:13 -07:00
rohandesai
a95fbf2612 Merge pull request #867 from rohandesai/DVCSMP-1699
DVCSMP-1699 Na02>Missing/Failed Oauth Tokens - Netatmo
2016-05-16 13:17:57 -07:00
Jack Chi
0f60ca61cb Merge pull request #899 from jackchi/add-category-smartsense
[CHF-74] Add category to SmartSense DTH
2016-05-16 11:50:00 -07:00
jackchi
293a73136e [CHF-74] Add category to SmartSense DTH 2016-05-16 11:43:21 -07:00
Vinay Rao
3b56fb4a2f Merge pull request #891 from workingmonk/bug/hotfix_cree_fingerprint
DPROT-94 moving the cree specific generic fingerprint back to cree dth
2016-05-16 11:30:50 -07:00
Jim Anderson
26a0f6f939 DOCS-284 adding README for example/test tiles 2016-05-13 21:10:54 -05:00
Rohan Desai
8de3276ce6 DVCSMP-1709 Android>SmartApps>PlatLinkConnector>Unable To Add
- now getting the right shard url
2016-05-13 11:13:58 -07:00
Jim Anderson
f77c5810c6 DOCS-284 - update tiles for best practices, add setColor to colorWheel tile 2016-05-13 10:26:45 -05:00
Luke Bredeson
9fc5f14dd7 Merge pull request #235 from lbredeso/button-controller-dst-fix
SHARD-211: DST fix for Button Controller
2016-05-13 10:20:59 -05:00
Lars Finander
55d7a4a263 Merge pull request #886 from larsfinander/DVCSMP-1761_Remove_heartbeat
DVCSMP-1716 Remove heartbeat from device types
2016-05-12 21:01:17 -07:00
Vinay Rao
cca1eccce6 moving the cree specific generic fingerprint back to cree dth because of cree manufacturerInfo spacing issue 2016-05-12 16:10:05 -07:00
Matthew Hartley
56eef9cf22 MSA-1278: The Prempoint SmartApp is a service bridge to allow Prempoint users to import, share, and manage devices that are controlled by their SmartThings hub. 2016-05-12 14:28:40 -05:00
Rohan Desai
b33d621696 DVCSMP-1699 Na02>Missing/Failed Oauth Tokens
- now calling the method to get the right shard url for Life360
- removed serverUrl from the app settings
2016-05-12 11:25:36 -07:00
Rohan Desai
45b78eff8d DVCSMP-1699 Na02>Missing/Failed Oauth Tokens - Netatmo
- refactored the oauth component for the app to work in different shards, if supported
- fixed some white spacing issues and indents
- addressed comments
- edited spacing
2016-05-12 11:18:09 -07:00
Lars Finander
a133406b6e DVCSMP-1770 Add MSR to zwave-switch and configure at pairing
-Make ZWave switch and Dimmer switch behave the same and save MSR and
manufacturer name in data
2016-05-11 23:41:19 -07:00
Lars Finander
bd62962ee1 DVCSMP-1716 Remove heartbeat from device types
-Remove heartbeat from OSRAM white bulb and Smartpower Outlet
-Heartbeat was a hack previously used for Amazon Echo
2016-05-11 23:06:09 -07:00
tslagle13
f1e54c8a5c Merge pull request #872 from tslagle13/fix-vacation-lighting-director-exception
fix exception caused by typo
2016-05-11 18:59:00 -07:00
tslagle13
a4a48fddd2 fix exception caused by typo
added paren to end of "someoneIsHome" check on accident.
2016-05-11 12:07:03 -07:00
Vinay Rao
2bd18859b9 Merge pull request #870 from SmartThingsCommunity/master
Rolling up master to staging for next week's release
2016-05-10 15:44:41 -07:00
Vinay Rao
566425c531 Merge pull request #869 from SmartThingsCommunity/staging
Rolling up staging to production 05-10
2016-05-10 13:40:49 -07:00
Matthew Page
ab2ba8104d MSA-1255: The following app submitted will be an endpoint for our IOS app Gidjit.
Gidjit is like having a home screen based on your environment. It scans your surroundings looking for home devices, personal electronic devices, times and locations of interest, and more. It will present a list of corresponding launcher panels that allow you to quickly access actions like open an app, control/monitor a device, execute a SmartThings Routine, or link to the control/launch screen of a device. For example based on the users location they will quickly be able to access a preset routine. We are really looking forward to having SmartThings in integration with the app. 

Link: https://itunes.apple.com/us/app/gidjit-smart-launcher/id961388659?mt=8

The app currently will not have the SmartThing's support until the next version that will be released when this is hopefully approved, as we will also have to go through the Apple approval process allowing them to test the features.

Thank you for your time!

Matt
2016-05-07 16:51:30 -05:00
Vinay Rao
e7448e7908 Merge pull request #848 from SmartThingsCommunity/master
Rolling up master to staging
2016-05-03 10:59:58 -07:00
Vinay Rao
973c16f088 Merge pull request #842 from SmartThingsCommunity/staging
Rolling up changes to production from staging 2016-05-03 Release
2016-05-03 10:20:53 -07:00
Vinay Rao
e278a3b57d Merge pull request #838 from SmartThingsCommunity/master
Rolling up master to staging
2016-04-26 11:34:03 -07:00
Vinay Rao
b05d956d95 Merge pull request #830 from SmartThingsCommunity/staging
Rolling up changes to production from staging 2016-04-26 Release
2016-04-26 10:59:05 -07:00
Luke Bredeson
91c01dc643 DST fix for Button Controller 2015-10-29 12:35:28 -05:00
36 changed files with 1136 additions and 1710 deletions

View File

@@ -94,11 +94,11 @@ def parse(String description) {
def cmd = zwave.parse(description, [0x31: 1, 0x32: 1, 0x60: 3])
if (cmd) {
result = createEvent(zwaveEvent(cmd))
log.debug "Parse returned ${result?.descriptionText}"
storeGraphData(result.name, result.value)
} else {
log.debug "zwave.parse returned null command. Cannot create event"
}
log.debug "Parse returned ${result?.descriptionText}"
storeGraphData(result.name, result.value)
return result
}

View File

@@ -14,7 +14,6 @@
*
*/
//@Deprecated: Moved to ZLL Dimmer Bulb
metadata {
definition (name: "Cree Bulb", namespace: "smartthings", author: "SmartThings") {
@@ -25,7 +24,7 @@ metadata {
capability "Switch"
capability "Switch Level"
//fingerprint profileId: "C05E", inClusters: "0000,0003,0004,0005,0006,0008,1000", outClusters: "0000,0019"
fingerprint profileId: "C05E", inClusters: "0000,0003,0004,0005,0006,0008,1000", outClusters: "0000,0019"
}
// simulator metadata

View File

@@ -138,6 +138,7 @@ def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerS
log.debug "productTypeId: ${cmd.productTypeId}"
def msr = String.format("%04X-%04X-%04X", cmd.manufacturerId, cmd.productTypeId, cmd.productId)
updateDataValue("MSR", msr)
updateDataValue("manufacturer", cmd.manufacturerName)
createEvent([descriptionText: "$device.displayName MSR: $msr", isStateChange: false])
}

View File

@@ -1,456 +0,0 @@
/**
* Device Type Definition File
*
* Device Type: Fibaro Dimmer
* File Name: fibaro-dimmer.groovy
* Initial Release: 2015-06-00
* Author: SmartThings
*
* Copyright 2015 SmartThings
*
* 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.
*
*/
metadata {
// Automatically generated. Make future change here.
definition (name: "Fibaro Dimmer 1", namespace: "smartthings", author: "SmartThings, Elnar Hajiyev") {
capability "Switch Level"
capability "Actuator"
capability "Switch"
capability "Polling"
capability "Refresh"
capability "Sensor"
capability "Configuration"
//Extending Fibaro Dimmer 1 devices with scene attribute
attribute "scene", "number"
command "configureParams"
fingerprint deviceId: "0x1101", inClusters: "0x72,0x86,0x70,0x85,0x8E,0x26,0x7A,0x27,0x73,0xEF,0x26,0x2B"
}
simulator {
status "on": "command: 2003, payload: FF"
status "off": "command: 2003, payload: 00"
status "09%": "command: 2003, payload: 09"
status "10%": "command: 2003, payload: 0A"
status "33%": "command: 2003, payload: 21"
status "66%": "command: 2003, payload: 42"
status "99%": "command: 2003, payload: 63"
// reply messages
reply "2001FF,delay 5000,2602": "command: 2603, payload: FF"
reply "200100,delay 5000,2602": "command: 2603, payload: 00"
reply "200119,delay 5000,2602": "command: 2603, payload: 19"
reply "200132,delay 5000,2602": "command: 2603, payload: 32"
reply "20014B,delay 5000,2602": "command: 2603, payload: 4B"
reply "200163,delay 5000,2602": "command: 2603, payload: 63"
}
tiles {
multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
attributeState "on", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#79b821", nextState:"turningOff"
attributeState "off", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#79b821", nextState:"turningOff"
attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
}
tileAttribute ("device.level", key: "SLIDER_CONTROL") {
attributeState "level", action:"switch level.setLevel"
}
}
standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
}
standardTile("configureParams", "device.configure", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "configure", label:'', action:"configureParams", icon:"st.secondary.configure"
}
main(["switch"])
details(["switch", "refresh",
"levelSliderControl",
"configureParams"
])
}
preferences {
input name: "param1", type: "enum", defaultValue: "255", required: true,
options: ["0" : "0",
"1" : "1",
"2" : "2",
"255" : "255"],
title: "1. Activate / deactivate functions ALL ON / ALL OFF.\n" +
"Available settings:\n" +
"0 = All ON not active, All OFF not active,\n" +
"1 = All ON not active, All OFF active,\n" +
"2 = All ON active, All OFF not active,\n" +
"255 = All ON active, All OFF active.\n" +
"Default value: 255."
input name: "param6", type: "number", range: "0..2", defaultValue: "0", required: true,
title: "6. Sending commands to control devices assigned to 1st association group (key no. 1).\n" +
"Available settings:\n" +
"0 = commands are sent when device is turned on and off.\n" +
"1 = commands are sent when device is turned off. Enabling device does not send control commands. Double-clicking key sends 'turn on' command, dimmers memorize the last saved state (e.g. 50% brightness).\n" +
"2 = commands are sent when device is turned off. Enabling device does not send control commands. Double-clicking key sends 'turn on' command and dimmers are set to 100% brightness.\n" +
"Default value: 1.\n\n" +
"NOTE: Parameter 15 value must be set to 1 to work properly. This activates the double-click functionality - dimmer/roller shutter control."
input name: "param7", type: "number", range: "0..1", defaultValue: "1", required: true,
title: "7. Checking the device status before sending a control frame from the key no. 2.\n" +
"Available settings:\n" +
"0 = Device status is not checked.\n" +
"1 = Device status is checked.\n" +
"Default value: 1.\n\n" +
"Info: Key no. 2 is not represented by any physical device expect of devices on association list. " +
"This functionality prevents of lack of reaction on pressing key no. 2 through polling devices from list one by one and checking thier actual states.\n" +
"It is not possible to check the device status before sending a control frame from the key no. 2 if roller blind switch is chosen in parameter 14 (value 2)\n" +
"If devices state is checked before sending asociation then parameter 19 should be set to value 0."
input name: "param8", type: "number", range: "1..99", defaultValue: "1", required: true,
title: "8. The percentage of a dimming step at automatic control.\n" +
"Available settings: 1-99\n" +
"Default value: 1."
input name: "param9", type: "number", range: "1..255", defaultValue: "5", required: true,
title: "9. Time of manually moving the Dimmer between the extreme dimming values.\n" +
"Available settings: 1-255 (10ms 2.5s)\n" +
"Default value: 5."
input name: "param10", type: "number", range: "0..255", defaultValue: "1", required: true,
title: "10. Time of Automatic moving the Dimmer between the extreme dimming values.\n" +
"Available settings: 0-255 (0ms 2.5s)\n" +
"0 - this value disables the smooth change in light intensity\n" +
"Default value: 1.\n\n" +
"NOTE value 0 is required for inductive and capacitive devices unsuitable for dimming, (e.g. fluorescent lamps , motors etc.)."
input name: "param11", type: "number", range: "1..99", defaultValue: "1", required: true,
title: "11. The percentage of a dimming step at manual control.\n" +
"Available settings: 1-99\n" +
"Default value: 1."
input name: "param12", type: "number", range: "2..99", defaultValue: "99", required: true,
title: "12. Maximum Dimmer level control.\n" +
"Available settings: 2-99\n" +
"Default value: 99."
input name: "param13", type: "number", range: "1..98", defaultValue: "2", required: true,
title: "13. Minimum Dimmer level control\n" +
"Available settings: 1-98\n" +
"Default value: 2.\n\n" +
"NOTE: The maximum level may not be lower than the minimum level.\n" +
"Recommended values of parameters 12 and 13 (max and min level) for controlling the devices are as follows:\n" +
"- AC motors [min 60%, max 99%]\n" +
"- fluorescent lamps, fluorescent tubes, LED [min 98%, max 99%] [parameter 10 set to 0]"
input name: "param14", type: "number", range: "0..2", defaultValue: "0", required: true,
title: "14. Switch type. Choose between momentary switch and toggle switch.\n" +
"Available settings:\n" +
"0 = momentary switch,\n" +
"1 = toggle switch,\n" +
"2 = Roller blind switch (UP / DOWN) - two switch keys operate the Dimmer.\n" +
"Default value: 0."
input name: "param15", type: "number", range: "0..1", defaultValue: "1", required: true,
title: "15. Double click option (set lightning at 100%).\n" +
"Available settings:\n" +
"0 = Double click disabled,\n" +
"1 = Double click enabled.\n" +
"Default value: 1."
input name: "param16", type: "number", range: "0..1", defaultValue: "1", required: true,
title: "16. Saving the state of the device after a power failure. The Dimmer will return to the last position before power failure.\n" +
"Available settings:\n" +
"0 = the Dimmer does not save the state after a power failure, it returns to 'off' position,\n" +
"1 = the Dimmer saves its state before power failure.\n" +
"Default value: 1."
input name: "param17", type: "number", range: "0..1", defaultValue: "0", required: true,
title: "17. The function of 3 - way switch, provides the option to double key no. 1. " +
"The Dimmer may control two toggle push-buttons or an infinite number of momentary push-buttons.\n" +
"Available settings:\n" +
"0 = the function of 3-way switch is disabled,\n" +
"1 = the function of 3-way switch is enabled.\n" +
"Default value: 0."
input name: "param18", type: "number", range: "0..1", defaultValue: "0", required: true,
title: "18. The function of synchronizing the light level for associated devices. The Dimmer communicates the position to the associated device.\n" +
"Available settings:\n" +
"0 = function disabled,\n" +
"1 = function enabled.\n" +
"Default value: 0."
input name: "param19", type: "number", range: "0..1", defaultValue: "0", required: true,
title: "19. Assigns bistable key status to the device status.\n" +
"Available settings:\n" +
"0 = [On / Off] device changes status on key status change.\n" +
"1 = Device status depends on key status: ON when the key is ON, OFF when the key is OFF.\n"
"Default value: 0.\n\n" +
"Info: Remote control from Fibaro System Is Still Possible. This function is useful When you want display status of external devices, e.g. Motion Sensor, in Fibaro System."
input name: "param30", type: "number", range: "0..3", defaultValue: "3", required: true,
title: "30. Alarm of any type (general alarm, water flooding alarm, smoke alarm: CO, CO2, temperature alarm).\n" +
"Available settings:\n" +
"0 = DEACTIVATION - the device does not respond to alarm data frames,\n" +
"1 = ALARM DIMMER ON - the device turns on after detecting an alarm,\n" +
"2 = ALARM DIMMER OFF - the device turns off after detecting an alarm,\n" +
"3 = ALARM FLASHING the device periodically changes its status to the opposite, when it detects an alarm within 10 min."
"Default value: 3."
input name: "param39", type: "number", range: "1..65535", defaultValue: "600", required: true,
title: "39. Active flashing alarm time.\n" +
"Available settings: [1-65535][ms]\n" +
"Default value: 600."
input name: "param41", type: "number", range: "0..1", defaultValue: "0", required: true,
title: "41. Scene activation functionality.\n" +
"The device offers the possibility of sending commands compatible with Command class scene activation. " +
"Information is sent to devices assigned to association group no. 3. " +
"Controllers such as Home Center 2 are able to interpret such commands and based on these commands they activate scenes, to which specific scene IDs have been assigned. " +
"The user may expand the functionality of the button connected to inputs S1 and S2 by distinguishing the actions of keys connected to those inputs. " +
"For example: double click would activate the scene “goodnight” and triple click would activate the scene “morning”.\n" +
"Available settings:\n" +
"0 = functionality deactivated,\n" +
"1 = functionality activated.\n" +
"Default value: 0.\n\n" +
"Scene ID is determined as follows:\n" +
"Momentary switch:\n" +
"Input S1: holding down ID 12 (option inactive in case of roller blind switch), " +
"releasing ID 13, double click ID 14 (depends on parameters 15 value - 1 = double click active), " +
"triple click ID 15, one click ID 16.\n" +
"Input S2: holding down ID 22 (option inactive in case of roller blind switch), " +
"releasing ID 23, double click ID 24 (depends on parameters 15 value - 1 = double click active) option inactive in case of roller blind switch, " +
"triple click ID 25, one click ID 26.\n\n" +
"Toggle switch:\n" +
"Input S1: holding down ID 12, releasing ID 13, double click ID 14 (depends on parameters 15 value - 1 = double click active), triple click ID 15. " +
"If parameter no. 19 is set to 0: single click ID16 is sent. If parameter no. 19 is set to 1 following IDs are sent: switch from “off” to “on” ID 10, switch from “on” to “off” ID 11.\n" +
"Input S2: holding down ID 22, releasing ID 23, double click ID 24, (depends on parameters 15 value - 1 = double click active), triple click ID 25. " +
"If parameter no.19 set to 0 (default), then one click ID 26 is sent. If parameter no.19 is set to 1 following IDs are sent: switch from “off” to “on” ID 20, switch from “on” to “off” ID 21.\n\n" +
"Roller blind switch:\n" +
"Input S1, Turning on the light: switch from “off” to “on” ID 10, double click ID 14 (depends of parameter 15 value 1 - double click functionality), " +
"triple click ID 15, brighten ID 17, releasing ID 13.\n" +
"Input S2, Turning off the light: switch from “on” to “off” ID 11, triple click ID 25, dim ID 18, releasing ID 13."
input name: "param20", type: "number", range: "101..170", defaultValue: "110", required: true,
title: "ADVANCED FUNCTION\n\n" +
"20. The function enabling the change of control impulse length. " +
"This function will enable decreasing the minimum level of the Dimmer by extending the control impulse. " +
"By changing the minimum level, the user may completely dim LED bulbs. Not all LED bulbs available on the market have the dimming option.\n" +
"Available settings:\n" +
"Default values: 110 for 50Hz (UK), 101 for 60Hz (USA).\n\n"+
"WARNING!\nWrong setting of the function may cause incorrect operation of the Dimmer."
input name: "paramAssociationGroup1", type: "bool", defaultValue: false, required: true,
title: "The Dimmer 1 provides the association of three groups.\n\n" +
"1 = 1st group is assigned to key no. 1,\n" +
"Default value: true"
input name: "paramAssociationGroup2", type: "bool", defaultValue: false, required: true,
title: "2nd group is assigned to key no. 2\n" +
"Default value: true"
input name: "paramAssociationGroup3", type: "bool", defaultValue: true, required: true,
title: "3rd group for controllers such Home Center for state reporting,\n" +
"Default value: false"
}
}
def parse(String description) {
def item1 = [
canBeCurrentState: false,
linkText: getLinkText(device),
isStateChange: false,
displayed: false,
descriptionText: description,
value: description
]
def result
def cmd = zwave.parse(description, [0x26: 1, 0x70: 2, 072: 2])
//log.debug "cmd: ${cmd}"
if (cmd) {
result = createEvent(cmd, item1)
}
else {
item1.displayed = displayed(description, item1.isStateChange)
result = [item1]
}
if(result?.descriptionText)
log.debug "Parse returned ${result?.descriptionText}"
result
}
def createEvent(physicalgraph.zwave.commands.sceneactivationv1.SceneActivationSet cmd, Map map) {
log.debug( "Scene ID: $cmd.sceneId")
log.debug( "Dimming Duration: $cmd.dimmingDuration")
sendEvent(name: "scene", value: "$cmd.sceneId", data: [switchType: "$settings.param20"], descriptionText: "Scene id $cmd.sceneId was activated", isStateChange: true)
log.debug( "Scene id $cmd.sceneId was activated" )
}
def createEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd, Map item1) {
def result = doCreateEvent(cmd, item1)
for (int i = 0; i < result.size(); i++) {
result[i].type = "physical"
}
result
}
def createEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd, Map item1) {
def result = doCreateEvent(cmd, item1)
for (int i = 0; i < result.size(); i++) {
result[i].type = "physical"
}
result
}
def createEvent(physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelStartLevelChange cmd, Map item1) {
[]
}
def createEvent(physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelStopLevelChange cmd, Map item1) {
[response(zwave.basicV1.basicGet())]
}
def createEvent(physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelSet cmd, Map item1) {
def result = doCreateEvent(cmd, item1)
for (int i = 0; i < result.size(); i++) {
result[i].type = "physical"
}
result
}
def createEvent(physicalgraph.zwave.commands.switchmultilevelv1.SwitchMultilevelReport cmd, Map item1) {
def result = doCreateEvent(cmd, item1)
result[0].descriptionText = "${item1.linkText} is ${item1.value}"
result[0].handlerName = cmd.value ? "statusOn" : "statusOff"
for (int i = 0; i < result.size(); i++) {
result[i].type = "digital"
}
result
}
def doCreateEvent(physicalgraph.zwave.Command cmd, Map item1) {
def result = [item1]
item1.name = "switch"
item1.value = cmd.value ? "on" : "off"
item1.handlerName = item1.value
item1.descriptionText = "${item1.linkText} was turned ${item1.value}"
item1.canBeCurrentState = true
item1.isStateChange = isStateChange(device, item1.name, item1.value)
item1.displayed = item1.isStateChange
if (cmd.value >= 5) {
def item2 = new LinkedHashMap(item1)
item2.name = "level"
item2.value = cmd.value as String
item2.unit = "%"
item2.descriptionText = "${item1.linkText} dimmed ${item2.value} %"
item2.canBeCurrentState = true
item2.isStateChange = isStateChange(device, item2.name, item2.value)
item2.displayed = false
result << item2
}
result
}
def createEvent(physicalgraph.zwave.Command cmd, Map map) {
// Handles any Z-Wave commands we aren't interested in
log.debug "UNHANDLED COMMAND $cmd"
}
def on() {
log.info "on"
delayBetween([zwave.basicV1.basicSet(value: 0xFF).format(), zwave.switchMultilevelV1.switchMultilevelGet().format()], 5000)
}
def off() {
delayBetween ([zwave.basicV1.basicSet(value: 0x00).format(), zwave.switchMultilevelV1.switchMultilevelGet().format()], 5000)
}
def setLevel(value) {
def level = Math.min(value as Integer, 99)
delayBetween ([zwave.basicV1.basicSet(value: level).format(), zwave.switchMultilevelV1.switchMultilevelGet().format()], 5000)
}
def setLevel(value, duration) {
def level = Math.min(value as Integer, 99)
def dimmingDuration = duration < 128 ? duration : 128 + Math.round(duration / 60)
zwave.switchMultilevelV2.switchMultilevelSet(value: level, dimmingDuration: dimmingDuration).format()
}
def poll() {
zwave.switchMultilevelV1.switchMultilevelGet().format()
}
def refresh() {
zwave.switchMultilevelV1.switchMultilevelGet().format()
}
def createEvent(physicalgraph.zwave.commands.configurationv2.ConfigurationReport cmd, Map item1) {
log.debug "${device.displayName} parameter '${cmd.parameterNumber}' with a byte size of '${cmd.size}' is set to '${cmd.configurationValue}'"
}
def configureParams() {
log.debug "Configuring ${device.displayName} parameters"
def cmds = []
cmds << zwave.configurationV1.configurationSet(parameterNumber: 1, size: 1, scaledConfigurationValue: param1.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 6, size: 1, scaledConfigurationValue: param6.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 7, size: 1, scaledConfigurationValue: param7.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 8, size: 1, scaledConfigurationValue: param8.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 9, size: 1, scaledConfigurationValue: param9.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 10, size: 1, scaledConfigurationValue: param10.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 11, size: 1, scaledConfigurationValue: param11.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 13, size: 1, scaledConfigurationValue: param13.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 15, size: 1, scaledConfigurationValue: param15.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 16, size: 1, scaledConfigurationValue: param16.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 19, size: 1, scaledConfigurationValue: param19.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 20, size: 1, scaledConfigurationValue: param20.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 30, size: 1, scaledConfigurationValue: param30.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 39, size: 1, scaledConfigurationValue: param39.toInteger()).format()
cmds << zwave.configurationV1.configurationSet(parameterNumber: 41, size: 1, scaledConfigurationValue: param41.toInteger()).format()
// Register for Group 1
if(paramAssociationGroup1) {
cmds << zwave.associationV2.associationSet(groupingIdentifier:1, nodeId: [zwaveHubNodeId]).format()
}
else {
cmds << zwave.associationV2.associationRemove(groupingIdentifier:1, nodeId: [zwaveHubNodeId]).format()
}
// Register for Group 2
if(paramAssociationGroup2) {
cmds << zwave.associationV2.associationSet(groupingIdentifier:2, nodeId: [zwaveHubNodeId]).format()
}
else {
cmds << zwave.associationV2.associationRemove(groupingIdentifier:2, nodeId: [zwaveHubNodeId]).format()
}
// Register for Group 3
if(paramAssociationGroup3) {
cmds << zwave.associationV2.associationSet(groupingIdentifier:3, nodeId: [zwaveHubNodeId]).format()
}
else {
cmds << zwave.associationV2.associationRemove(groupingIdentifier:3, nodeId: [zwaveHubNodeId]).format()
}
delayBetween(cmds, 500)
}
def updated() {
log.debug "updated()"
response(["delay 2000"] + configureParams() + refresh())
}

View File

@@ -1,787 +0,0 @@
/**
* Copyright 2015 SmartThings
*
* 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.
*
*/
metadata {
definition (name: "Fibaro Dimmer 2", namespace: "smartthings", author: "Rajiv, Elnar Hajiyev") {
capability "Energy Meter"
capability "Actuator"
capability "Switch"
capability "Power Meter"
capability "Polling"
capability "Refresh"
capability "Sensor"
capability "Configuration"
capability "Switch Level"
//Extending Fibaro Dimmer 2 devices with scene attribute
attribute "scene", "number"
command "reset"
command "configureAfterSecure"
fingerprint deviceId: "0x1001", inClusters: "0x5E, 0x20, 0x86, 0x72, 0x26, 0x5A, 0x59, 0x85, 0x73, 0x98, 0x7A, 0x56, 0x70, 0x31, 0x32, 0x8E, 0x60, 0x75, 0x71, 0x27, 0x22, 0xEF, 0x2B"
}
// simulator metadata
simulator {
status "on": "command: 2003, payload: FF"
status "off": "command: 2003, payload: 00"
status "09%": "command: 2003, payload: 09"
status "10%": "command: 2003, payload: 0A"
status "33%": "command: 2003, payload: 21"
status "66%": "command: 2003, payload: 42"
status "99%": "command: 2003, payload: 63"
for (int i = 0; i <= 10000; i += 1000) {
status "power ${i} W": new physicalgraph.zwave.Zwave().meterV3.meterReport(
scaledMeterValue: i, precision: 3, meterType: 4, scale: 2, size: 4).incomingMessage()
}
for (int i = 0; i <= 100; i += 10) {
status "energy ${i} kWh": new physicalgraph.zwave.Zwave().meterV3.meterReport(
scaledMeterValue: i, precision: 3, meterType: 0, scale: 0, size: 4).incomingMessage()
}
["FF", "00", "09", "0A", "21", "42", "63"].each { val ->
reply "2001$val,delay 100,2602": "command: 2603, payload: $val"
}
}
// 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:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#79b821", nextState:"turningOff"
attributeState "off", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#79b821", nextState:"turningOff"
attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
}
tileAttribute ("device.level", key: "SLIDER_CONTROL") {
attributeState "level", action:"switch level.setLevel"
}
}
valueTile("power", "device.power", decoration: "flat", width: 2, height: 2) {
state "default", label:'${currentValue} W'
}
valueTile("energy", "device.energy", decoration: "flat", width: 2, height: 2) {
state "default", label:'${currentValue} kWh'
}
standardTile("reset", "device.energy", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "default", label:'reset kWh', action:"reset"
}
standardTile("configureAfterSecure", "device.configure", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "configure", label:'', action:"configureAfterSecure", icon:"st.secondary.configure"
}
standardTile("refresh", "device.power", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
}
main(["switch","power","energy"])
details(["switch","power","energy","configureAfterSecure","refresh","reset"])
}
preferences {
def paragraph = "GROUP 0 - The Dimmer 2 behavior - Basic functionalities"
input name: "param1", type: "number", range: "1..98", defaultValue: "1", required: true,
title: paragraph + "\n\n" +
"1. Minimum brightness level. " +
"This parameter is set automatically during the calibration process. " +
"The parameter can be changed manually after the calibration.\n" +
"Available settings: 1-98 - percentage level of brightness.\n" +
"Default value: 1."
input name: "param2", type: "number", range: "2..99", defaultValue: "99", required: true,
title: "2. Maximum brightness level. " +
"This parameter is set automatically during the calibration process. " +
"The parameter can be changed manually after the calibration.\n" +
"Available settings: 2-99 - percentage level of brightness.\n" +
"Default value: 99."
input name: "param3", type: "number", range: "1..99", defaultValue: "1", required: true,
title: "3. Incandescence level of dimmable compact fluorescent lamps. " +
"Virtual value set as a percentage level between parameters MIN (1%) and MAX (99%). " +
"The Dimmer 2 will set to this value after first switch on. " +
"It is required for warming up and switching dimmable compact fluorescent lamps and certain types of light sources.\n" +
"Available settings: 1-99 - percentage level of brightness.\n" +
"Default value: 1."
input name: "param4", type: "number", range: "0..255", defaultValue: "0", required: true,
title: "4. Incandescence time of dimmable compact fluorescent lamps. " +
"This parameter determines the time required for switching compact fluorescent lamps and certain types of light sources. " +
"Setting this parameter to 0 will disable the incandescence functionality.\n" +
"Available settings: 0-255 (0-25.5s).\n" +
"Default value: 0."
input name: "param5", type: "number", range: "1..99", defaultValue: "1", required: true,
title: "5. Automatic control - dimming step size. " +
"This parameter defines the percentage value of dimming step during the automatic control.\n" +
"Available settings: 1-99 - dimming step percentage value.\n" +
"Default value: 1."
input name: "param6", type: "number", range: "0..255", defaultValue: "1", required: true,
title: "6. Automatic control - time of a dimming step. " +
"This parameter defines the time of single dimming step set in parameter 5 during the automatic control.\n" +
"Available settings: 0-255 (0-2.55s, in 10ms steps).\n" +
"Default value: 1."
input name: "param7", type: "number", range: "1..99", defaultValue: "1", required: true,
title: "7. Manual control - dimming step size. " +
"This parameter defines the percentage value of dimming step during the manual control.\n" +
"Available settings: 1-99 - dimming step percentage value.\n" +
"Default value: 1."
input name: "param8", type: "number", range: "0..255", defaultValue: "5", required: true,
title: "8. Manual control - time of a dimming step. " +
"This parameter defines the time of single dimming step set in parameter 7 during the manual control.\n" +
"Available settings: 0-255 (0-2.55s, in 10ms steps).\n" +
"Default value: 5."
input name: "param9", type: "number", range: "0..1", defaultValue: "1", required: true,
title: "9. State of the device after a power failure. " +
"The Dimmer 2 will return to the last state before power failure.\n" +
"Available settings:\n" +
"0 = the Dimmer 2 does not save the state before a power failure, it returns to „off” position,\n" +
"1 = the Dimmer 2 restores its state before power failure.\n" +
"Default value: 1."
input name: "param10", type: "number", range: "0..32767", defaultValue: "0", required: true,
title: "10. Timer functionality (auto - off). " +
"This parameter allows to automatically switch off the device after specified time from switching on the light source. " +
"It may be useful when the Dimmer 2 is installed in the stairway.\n" +
"Available settings: 0 - Function disabled,\n1-32767 - time to turn off measured in seconds (1s-9.1h).\n" +
"Default value: 0."
input name: "param11", type: "enum", defaultValue: "255", required: true,
options: ["0" : "0",
"1" : "1",
"2" : "2",
"255" : "255"],
title: "11. ALL ON/ALL OFF function. " +
"Parameter allows for activation/deactivation of Z-Wave commands enabling/disabling all devices located in direct range of the main controller.\n" +
"Available settings:\n" +
"0 = All ON not active, All OFF not active,\n" +
"1 = All ON not active, All OFF active,\n" +
"2 = All ON active, All OFF not active,\n" +
"255 = All ON active, All OFF active.\n" +
"Default value: 255."
input name: "param13", type: "number", range: "0..2", defaultValue: "0", required: true,
title: "13. Force auto-calibration. " +
"Changing value of this parameter will force the calibration process. " +
"During the calibration parameter is set to 1 or 2 and switched to 0 upon completion.\n" +
"Available settings:\n" +
"0 = readout,\n" +
"1 = force auto-calibration of the load without FIBARO Bypass 2,\n" +
"2 = force auto-calibration of the load with FIBARO Bypass 2.\n" +
"Default value: 0."
input name: "param15", type: "number", range: "0..99", defaultValue: "30", required: true,
title: "15. Burnt out bulb detection. " +
"Function based on the sudden power variation of a specific value, interpreted as a LOAD ERROR.\n" +
"Available settings:\n0 - function disabled,\n" +
"1-99 - percentage value of power variation, compared to standard power consumption, measured during the calibration procedure (to be interpreted as load error/burnt out bulb).\n" +
"Default value: 30."
input name: "param16", type: "number", range: "0..255", defaultValue: "5", required: true,
title: "16. Time delay of a burnt out bulb (parameter 15) or overload (parameter 39) detection. " +
"Time of delay (in seconds) for power variation detection, interpreted as a LOAD ERROR or OVERLOAD detection (too much power connected to the Dimmer 2).\n" +
"Available settings:\n0 - detection of a burnt out bulb disabled,\n1-255 - delay time in seconds.\n" +
"Default value: 5."
input name: "param19", type: "number", range: "0..99", defaultValue: "0", required: true,
title: "19. Forced switch on brightness level. " +
"If the parameter is active, switching on the Dimmer 2 (S1 single click) will always set this brightness level.\n" +
"Available settings:\n0 - function disabled,\n1-99 - percentage level of brightness.\n" +
"Default value: 0."
paragraph = "GROUP 20 - Dimmer 2 operation - Switches"
input name: "param20", type: "number", range: "0..2", defaultValue: "0", required: true,
title: paragraph + "\n\n" +
"20. Switch type. " +
"Choose between momentary, toggle and roller blind switch.\n" +
"Available settings:\n" +
"0 = momentary switch,\n1 = toggle switch,\n2 = roller blind switch - two switches operate the Dimmer 2 (S1 to brighten, S2 to dim).\n" +
"Default value: 0."
input name: "param21", type: "number", range: "0..1", defaultValue: "0", required: true,
title: "21. The value sent to associated devices on single click. " +
"This parameter defines the value sent to devices associated with Dimmer 2 after its enabling.\n" +
"Available settings:\n" +
"0 = 0xFF value is sent, which will set associated devices to their last saved state,\n" +
"1 = current Dimmer 2 state is sent, which will synchronize brightness level of associated devices (other dimmers for example).\n" +
"Default value: 0."
input name: "param22", type: "number", range: "0..1", defaultValue: "0", required: true,
title: "22. Assign toggle switch status to the device status. " +
"By default each change of toggle switch position results in action of Dimmer 2 (switch on/off) regardless the physical connection of contacts.\n" +
"Available settings:\n" +
"0 = device changes status on switch status change,\n1 = device status is synchronized with switch status.\n" +
"Default value: 0."
input name: "param23", type: "number", range: "0..1", defaultValue: "1", required: true,
title: "23. Double click option - set the brightness level to MAX.\n" +
"Available settings:\n" +
"0 = double click disabled,\n" +
"1 = double click enabled.\n" +
"Default value: 1."
input name: "param24", type: "enum", defaultValue: "0", required: true,
options: ["0" : "0",
"1" : "1",
"2" : "2",
"4" : "4",
"8" : "8",
"16" : "16"],
title: "24. Command frames sent in 2nd and 3rd association groups (S1 associations). " +
"Parameter determines, which actions will not result in sending frames to association groups.\n" +
"Available settings:\n" +
"0 = all actions send to association groups,\n" +
"1 = do not send when switching ON (single click),\n" +
"2 = do not send when switching OFF (single click),\n" +
"4 = do not send when changing dimming level (holding and releasing),\n" +
"8 = do not send on double click,\n" +
"16 = send 0xFF value on double click.\n" +
"Default value: 0."
input name: "param25", type: "enum", defaultValue: "0", required: true,
options: ["0" : "0",
"1" : "1",
"2" : "2",
"4" : "4",
"8" : "8",
"16" : "16"],
title: "25. Command frames sent in 4th and 5th association groups (S2 associations). " +
"Parameter determines, which actions will not result in sending frames to association groups.\n" +
"Available settings:\n" +
"0 = all actions send to association groups,\n" +
"1 = do not send when switching ON (single click),\n" +
"2 = do not send when switching OFF (single click),\n" +
"4 = do not send when changing dimming level (holding and releasing),\n" +
"8 = do not send on double click,\n" +
"16 = send 0xFF value on double click.\n" +
"Default value: 0."
input name: "param26", type: "number", range: "0..1", defaultValue: "0", required: true,
title: "26. The function of 3-way switch. " +
"Switch no. 2 controls the Dimmer 2 additionally (in 3-way switch mode). Function disabled for parameter 20 set to 2 (roller blind switch).\n" +
"Available settings:\n" +
"0 = 3-way switch function for S2 disabled,\n" +
"1 = 3-way switch function for S2 enabled.\n" +
"Default value: 0."
input name: "param27", type: "enum", defaultValue: "15", required: true,
options: ["0" : "0",
"1" : "1",
"2" : "2",
"4" : "4",
"8" : "8",
"15" : "15"],
title: "27. Associations in Z-Wave network security mode. " +
"This parameter defines how commands are sent in speci ed association groups: as secure or non-secure. " +
"Parameter is active only in Z-Wave network security mode. It does not apply to 1st lifeline group.\n" +
"Available settings:\n" +
"0 = all groups (II-V) sent as non-secure,\n" +
"1 = 2nd group sent as secure,\n" +
"2 = 3rd group sent as secure,\n" +
"4 = 4th group sent as secure,\n" +
"8 = 5th group sent as secure,\n" +
"15 = all groups (II-V) sent as secure.\n" +
"Default value: 15."
input name: "param28", type: "number", range: "0..1", defaultValue: "0", required: true,
title: "28. Scene activation functionality.\n" +
"Available settings:\n" +
"0 = functionality deactivated,\n" +
"1 = functionality activated.\n" +
"Default value: 0.\n\n" +
"SCENE ID depends on the switch type configurations.\n" +
"Momentary switches:\n" +
"SCENE ID: S1 input:\n\t16 : 1 x click\n\t14 : 2 x click\n\t-- : 3 x click\n\t12 : hold\n\t13 : release\n" +
"SCENE ID: S2 input:\n\t26 : 1 x click\n\t24 : 2 x click\n\t25 : 3 x click\n\t22 : hold\n\t23 : release\n\n" +
"Toggle switches:\n" +
"SCENE ID: S1 input:\n\t10 : OFF to ON\n\t11 : ON to OFF\n\t14 : 2 x click\n\t-- : 3 x click\n" +
"SCENE ID: S2 input:\n\t20 : OFF to ON\n\t21 : ON to OFF\n\t24 : 2 x click\n\t25 : 3 x click\n\n" +
"Roller blinds switches:\n" +
"SCENE ID: S1 input:\n\t10 : turn ON (1 x click)\n\t13 : release\n\t14 : 2 x click\n\t-- : 3 x click\n\t17 : brightening\n" +
"SCENE ID: S2 input:\n\t11 : turn OFF (1 x click)\n\t13 : release\n\t14 : 2 x click\n\t15 : 3 x click\n\t18 : dimming"
input name: "param29", type: "number", range: "0..1", defaultValue: "0", required: true,
title: "29. Switch functionality of S1 and S2. " +
"This parameter allows for switching the role of keys connected to S1 and S2 without changes in connection.\n" +
"Available settings:\n" +
"0 = standard mode,\n" +
"1 = S1 operates as S2, S2 operates as S1.\n" +
"Default value: 0."
paragraph = "GROUP 30 - Dimmer 2 operation - Advanced functionality"
input name: "param30", type: "number", range: "0..2", defaultValue: "2", required: true,
title: paragraph + "\n\n" +
"30. Load control mode. " +
"This parameter allows to set the desired load control mode. " +
"The de- vice automatically adjusts correct control mode, but the installer may force its change using this parameter. " +
"Forced auto-calibration will set this parameters value to 2.\n" +
"Available settings:\n" +
"0 = forced leading edge control,\n" +
"1 = forced trailing edge control,\n" +
"2 = control mode selected automatically (based on auto-calibration).\n" +
"Default value: 2."
input name: "param32", type: "number", range: "0..2", defaultValue: "2", required: true,
title: "32. On/Off mode. " +
"This mode is necessary while connecting non-dimmable light sources. " +
"Setting this parameter to 1 automatically ignores brightening/dimming time settings. " +
"Forced auto-calibration will set this parameters value to 2.\n" +
"Available settings:\n" +
"0 = on/off mode disabled (dimming is possible),\n" +
"1 = on/off mode enabled (dimming is not possible),\n" +
"2 = mode selected automatically.\n" +
"Default value: 2."
input name: "param34", type: "number", range: "0..2", defaultValue: "1", required: true,
title: "34. Soft-Start functionality. " +
"Time required to warm up the lament of halogen bulb.\n" +
"Available settings:\n" +
"0 = no soft-start,\n" +
"1 = short soft-start (0.1s),\n" +
"2 = long soft-start (0.5s).\n" +
"Default value: 1."
input name: "param35", type: "number", range: "0..4", defaultValue: "1", required: true,
title: "35. Auto-calibration after power on. " +
"This parameter determines the trigger of auto-calibration procedure, e.g. power on, load error, etc.\n" +
"Available settings:\n" +
"0 = No auto-calibration of the load after power on,\n" +
"1 = Auto-calibration performed after first power on,\n" +
"2 = Auto-calibration performed after each power on,\n" +
"3 = Auto-calibration performed after first power on or after each LOAD ERROR alarm (no load, load failure, burnt out bulb), if parameter 37 is set to 1 also after alarms: SURGE (Dimmer 2 output overvoltage) and OVERCURRENT (Dimmer 2 output overcurrent),\n" +
"4 = Auto-calibration performed after each power on or after each LOAD ERROR alarm (no load, load failure, burnt out bulb), if parameter 37 is set to 1 also after alarms: SURGE (Dimmer 2 output overvoltage) and OVERCURRENT (Dimmer 2 output overcurrent).\n" +
"Default value: 1."
input name: "param37", type: "number", range: "0..1", defaultValue: "1", required: true,
title: "37. Behaviour of the Dimmer 2 after OVERCURRENT or SURGE. " +
"Occuring of errors related to surge or overcurrent results in turning off the output to prevent possible malfunction. " +
"By default the device performs three attempts to turn on the load (useful in case of momentary, short failures of the power supply).\n" +
"Available settings:\n" +
"0 = device permanently disabled until re-ena- bling by command or external switch,\n" +
"1 = three attempts to turn on the load.\n" +
"Default value: 1."
input name: "param39", type: "number", range: "0..350", defaultValue: "250", required: true,
title: "39. Power limit - OVERLOAD. " +
"Reaching the defined value will result in turning off the load. " +
"Additional apparent power limit of 350VA is active by default.\n" +
"Available settings:\n0 - functionality disabled,\n1-350 - 1-350W.\n" +
"Default value: 250."
paragraph = "GROUP 40 - Dimmer 2 operation - Alarms"
input name: "param40", type: "number", range: "0..3", defaultValue: "3", required: true,
title: paragraph + "\n\n" +
"40. Response to General Purpose Alarm.\n" +
"Available settings:\n" +
"0 = No reaction,\n" +
"1 = Turn on the load,\n" +
"2 = Turn off the load,\n" +
"3 = Load blinking.\n" +
"Default value: 3."
input name: "param41", type: "number", range: "0..3", defaultValue: "2", required: true,
title: "41. Response to Water Flooding Alarm.\n" +
"Available settings:\n" +
"0 = No reaction,\n" +
"1 = Turn on the load,\n" +
"2 = Turn off the load,\n" +
"3 = Load blinking.\n" +
"Default value: 2."
input name: "param42", type: "number", range: "0..3", defaultValue: "3", required: true,
title: "42. Response to Smoke, CO or CO2 Alarm.\n" +
"Available settings:\n" +
"0 = No reaction,\n" +
"1 = Turn on the load,\n" +
"2 = Turn off the load,\n" +
"3 = Load blinking.\n" +
"Default value: 3."
input name: "param43", type: "number", range: "0..3", defaultValue: "1", required: true,
title: "43. Response to Temperature Alarm.\n" +
"Available settings:\n" +
"0 = No reaction,\n" +
"1 = Turn on the load,\n" +
"2 = Turn off the load,\n" +
"3 = Load blinking.\n" +
"Default value: 1."
input name: "param44", type: "number", range: "1..32767", defaultValue: "600", required: true,
title: "44. Time of alarm state.\n" +
"Available settings: 1-32767 (1-32767 seconds).\n" +
"Default value: 600."
paragraph = "Alarm settings - reports"
input name: "param45", type: "number", range: "0..1", defaultValue: "1", required: true,
title: paragraph + "\n\n" +
"45. OVERLOAD alarm report (load power consumption too high).\n" +
"Available settings:\n" +
"0 = No reaction,\n" +
"1 = Send an alarm frame.\n" +
"Default value: 1."
input name: "param46", type: "number", range: "0..1", defaultValue: "1", required: true,
title: "46. LOAD ERROR alarm report (no load, load failure, burnt out bulb).\n" +
"Available settings:\n" +
"0 = No reaction,\n" +
"1 = Send an alarm frame.\n" +
"Default value: 1."
input name: "param47", type: "number", range: "0..1", defaultValue: "1", required: true,
title: "47. OVERCURRENT alarm report (short circuit, burnt out bulb causing overcurrent).\n" +
"Available settings:\n" +
"0 = No reaction,\n" +
"1 = Send an alarm frame.\n" +
"Default value: 1."
input name: "param48", type: "number", range: "0..1", defaultValue: "1", required: true,
title: "48. SURGE alarm report (Dimmer 2 output overvoltage).\n" +
"Available settings:\n" +
"0 = No reaction,\n" +
"1 = Send an alarm frame.\n" +
"Default value: 1."
input name: "param49", type: "number", range: "0..1", defaultValue: "1", required: true,
title: "49. OVERHEAT (critical temperature) and VOLTAGE DROP (low voltage) alarm report.\n" +
"Available settings:\n" +
"0 = No reaction,\n" +
"1 = Send an alarm frame.\n" +
"Default value: 1."
paragraph = "GROUP 50 - Active power and energy reports"
input name: "param50", type: "number", range: "0..100", defaultValue: "10", required: true,
title: paragraph + "\n\n" +
"50. Active power reports. " +
"The parameter defines the power level change that will result in a new power report being sent. " +
"The value is a percentage of the previous report.\n" +
"Available settings:\n0 - power reports disabled,\n1-100 (1-100%) - power report threshold.\n" +
"Default value: 10."
input name: "param52", type: "number", range: "0..32767", defaultValue: "3600", required: true,
title: "52. Periodic active power and energy reports. " +
"Parameter 52 defines a time period between consecutive reports. Timer is reset and counted from zero after each report.\n" +
"Available settings:\n0 - periodic reports disabled,\n1-32767 (1-32767 seconds).\n" +
"Default value: 3600."
input name: "param53", type: "number", range: "0..255", defaultValue: "10", required: true,
title: "53. Energy reports. " +
"Energy level change which will result in sending a new energy report.\n" +
"Available settings:\n0 - energy reports disabled,\n1-255 (0.01-2.55 kWh) - report triggering threshold.\n" +
"Default value: 10."
input name: "param54", type: "number", range: "0..1", defaultValue: "0", required: true,
title: "54. Self-measurement. " +
"The Dimmer 2 may include active power and energy consumed by itself in reports sent to the main controller.\n" +
"Available settings:\n" +
"0 = Self-measurement inactive,\n" +
"1 = Self-measurement active.\n" +
"Default value: 0."
input name: "param58", type: "number", range: "0..2", defaultValue: "0", required: true,
title: "58. Method of calculating the active power. This parameter defines how to calculate active power. " +
"It is useful in a case of 2-wire connection with light sources other than resistive.\n" +
"Available settings:\n" +
"0 = measurement based on the standard algorithm,\n" +
"1 = approximation based on the calibration data,\n" +
"2 = approximation based on the control angle.\n" +
"Default value: 0."
input name: "param59", type: "number", range: "0..500", defaultValue: "0", required: true,
title: "59. Approximated power at the maximum brightness level. " +
"This parameter determines the approximate value of the power that will be reported by the device at its maximum brightness level.\n" +
"Available settings: 0-500 (0-500W) - power consumed by the load at the maximum brightness level.\n" +
"Default value: 0."
input name: "paramAssociationGroup1", type: "bool", defaultValue: true, required: true,
title: "The Dimmer 2 provides the association of five groups.\n\n" +
"1st Association Group „Lifeline”,\n" +
"Default value: true"
input name: "paramAssociationGroup2", type: "bool", defaultValue: true, required: true,
title: "2nd Association Group „On/Off (S1)”,\n" +
"Default value: true"
input name: "paramAssociationGroup3", type: "bool", defaultValue: false, required: true,
title: "3rd Association Group „Dimmer (S1)”,\n" +
"Default value: false"
input name: "paramAssociationGroup4", type: "bool", defaultValue: false, required: true,
title: "4th Association Group „On/Off (S2)”,\n" +
"Default value: false"
input name: "paramAssociationGroup5", type: "bool", defaultValue: false, required: true,
title: "5th Association Group „Dimmer (S2)”.\n" +
"Default value: false"
}
}
def parse(String description) {
log.trace(description)
log.debug("RAW command: $description")
def result = null
if (description != "updated") {
def cmd = zwave.parse(description.replace("98C1", "9881"), [0x20: 1, 0x26: 3, 0x32: 3, 0x25: 1, 0x98: 1, 0x70: 1, 0x85: 2, 0x9B: 1, 0x90: 1, 0x73: 1, 0x30: 1, 0x28: 1, 0x72: 1])
if (cmd) {
result = zwaveEvent(cmd)
}
}
log.debug "Parsed '${description}' to ${result.inspect()}"
return result
}
def zwaveEvent(physicalgraph.zwave.commands.sceneactivationv1.SceneActivationSet cmd) {
log.debug( "Scene ID: $cmd.sceneId")
log.debug( "Dimming Duration: $cmd.dimmingDuration")
sendEvent(name: "scene", value: "$cmd.sceneId", data: [switchType: "$settings.param20"], descriptionText: "Scene id $cmd.sceneId was activated", isStateChange: true)
log.debug( "Scene id $cmd.sceneId was activated" )
}
// Devices that support the Security command class can send messages in an encrypted form;
// they arrive wrapped in a SecurityMessageEncapsulation command and must be unencapsulated
def zwaveEvent(physicalgraph.zwave.commands.securityv1.SecurityMessageEncapsulation cmd) {
log.trace(cmd)
def encapsulatedCommand = cmd.encapsulatedCommand([0x20: 1, 0x26: 3, 0x32: 3, 0x25: 1, 0x98: 1, 0x70: 1, 0x85: 2, 0x9B: 1, 0x90: 1, 0x73: 1, 0x30: 1, 0x28: 1, 0x72: 1]) // can specify command class versions here like in zwave.parse
if (encapsulatedCommand) {
return zwaveEvent(encapsulatedCommand)
} else {
log.warn "Unable to extract encapsulated cmd from $cmd"
createEvent(descriptionText: cmd.toString())
}
}
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
log.trace(cmd)
dimmerEvents(cmd)
}
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd) {
log.trace(cmd)
//dimmerEvents(cmd)
}
def zwaveEvent(physicalgraph.zwave.commands.switchmultilevelv3.SwitchMultilevelReport cmd) {
log.trace(cmd)
dimmerEvents(cmd)
}
def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd)
{
log.trace(cmd)
dimmerEvents(cmd)
}
def dimmerEvents(physicalgraph.zwave.Command cmd) {
log.trace(cmd)
def result = []
def value = (cmd.value ? "on" : "off")
def switchEvent = createEvent(name: "switch", value: value, descriptionText: "$device.displayName was turned $value")
result << switchEvent
if (cmd.value) {
result << createEvent(name: "level", value: cmd.value, unit: "%")
}
if (switchEvent.isStateChange) {
result << response(["delay 3000", zwave.meterV2.meterGet(scale: 2).format()])
}
return result
}
def zwaveEvent(physicalgraph.zwave.commands.meterv3.MeterReport cmd) {
log.trace(cmd)
if (cmd.meterType == 1) {
if (cmd.scale == 0) {
return createEvent(name: "energy", value: cmd.scaledMeterValue, unit: "kWh")
} else if (cmd.scale == 1) {
return createEvent(name: "energy", value: cmd.scaledMeterValue, unit: "kVAh")
} else if (cmd.scale == 2) {
return createEvent(name: "power", value: Math.round(cmd.scaledMeterValue), unit: "W")
} else {
return createEvent(name: "electric", value: cmd.scaledMeterValue, unit: ["pulses", "V", "A", "R/Z", ""][cmd.scale - 3])
}
}
}
def zwaveEvent(physicalgraph.zwave.Command cmd) {
log.trace(cmd)
log.debug "No handler for $cmd"
// Handles all Z-Wave commands we aren't interested in
createEvent(descriptionText: cmd.toString(), isStateChange: false)
}
def on() {
log.trace("on")
secureSequence([
zwave.basicV1.basicSet(value: 0xFF),
zwave.switchMultilevelV1.switchMultilevelGet()
])
}
def off() {
log.trace("off")
secureSequence([
zwave.basicV1.basicSet(value: 0x00),
zwave.switchMultilevelV1.switchMultilevelGet()
])
}
def poll() {
log.trace("poll")
secureSequence([
zwave.meterV2.meterGet(scale: 0),
zwave.meterV2.meterGet(scale: 2)
])
}
def refresh() {
log.trace("trace")
secureSequence([
zwave.meterV2.meterGet(scale: 0),
zwave.meterV2.meterGet(scale: 2)
])
}
def reset() {
log.trace("reset")
return secureSequence([
zwave.switchMultilevelV1.switchMultilevelGet(),
zwave.meterV2.meterReset(),
zwave.meterV2.meterGet(scale: 0),
zwave.meterV2.meterGet(scale: 2)
])
}
def setLevel(level) {
log.trace("setlevel")
if(level > 99) level = 99
secureSequence([
zwave.basicV1.basicSet(value: level),
zwave.switchMultilevelV1.switchMultilevelGet()
], 5000)
}
def configureAfterSecure() {
log.debug "configureAfterSecure()"
def cmds = secureSequence([
zwave.configurationV1.configurationSet(parameterNumber: 1, size: 1, scaledConfigurationValue: param1.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 2, size: 1, scaledConfigurationValue: param2.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 3, size: 1, scaledConfigurationValue: param3.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 4, size: 2, scaledConfigurationValue: param4.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 5, size: 1, scaledConfigurationValue: param5.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 6, size: 2, scaledConfigurationValue: param6.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 7, size: 1, scaledConfigurationValue: param7.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 8, size: 2, scaledConfigurationValue: param8.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 9, size: 1, scaledConfigurationValue: param9.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 10, size: 2, scaledConfigurationValue: param10.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 11, size: 2, scaledConfigurationValue: param11.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 13, size: 1, scaledConfigurationValue: param13.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 15, size: 1, scaledConfigurationValue: param15.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 16, size: 2, scaledConfigurationValue: param16.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 19, size: 1, scaledConfigurationValue: param19.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 20, size: 1, scaledConfigurationValue: param20.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 21, size: 1, scaledConfigurationValue: param21.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 22, size: 1, scaledConfigurationValue: param22.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 23, size: 1, scaledConfigurationValue: param23.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 24, size: 1, scaledConfigurationValue: param24.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 25, size: 1, scaledConfigurationValue: param25.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 26, size: 1, scaledConfigurationValue: param26.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 27, size: 1, scaledConfigurationValue: param27.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 28, size: 1, scaledConfigurationValue: param28.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 29, size: 1, scaledConfigurationValue: param29.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 30, size: 1, scaledConfigurationValue: param30.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 32, size: 1, scaledConfigurationValue: param32.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 34, size: 1, scaledConfigurationValue: param34.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 35, size: 1, scaledConfigurationValue: param35.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 37, size: 1, scaledConfigurationValue: param37.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 39, size: 2, scaledConfigurationValue: param39.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 40, size: 1, scaledConfigurationValue: param40.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 41, size: 1, scaledConfigurationValue: param41.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 42, size: 1, scaledConfigurationValue: param42.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 43, size: 1, scaledConfigurationValue: param43.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 44, size: 2, scaledConfigurationValue: param44.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 45, size: 1, scaledConfigurationValue: param45.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 46, size: 1, scaledConfigurationValue: param46.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 47, size: 1, scaledConfigurationValue: param47.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 48, size: 1, scaledConfigurationValue: param48.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 49, size: 1, scaledConfigurationValue: param49.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 50, size: 1, scaledConfigurationValue: param50.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 52, size: 2, scaledConfigurationValue: param52.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 53, size: 2, scaledConfigurationValue: param53.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 54, size: 1, scaledConfigurationValue: param54.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 58, size: 1, scaledConfigurationValue: param58.toInteger()),
zwave.configurationV1.configurationSet(parameterNumber: 59, size: 2, scaledConfigurationValue: param59.toInteger())
])
// Register for Group 1
if(paramAssociationGroup1) {
cmds << secure(zwave.associationV2.associationSet(groupingIdentifier:1, nodeId: [zwaveHubNodeId]))
}
else {
cmds << secure(zwave.associationV2.associationRemove(groupingIdentifier:1, nodeId: [zwaveHubNodeId]))
}
// Register for Group 2
if(paramAssociationGroup2) {
cmds << secure(zwave.associationV2.associationSet(groupingIdentifier:2, nodeId: [zwaveHubNodeId]))
}
else {
cmds << secure(zwave.associationV2.associationRemove(groupingIdentifier:2, nodeId: [zwaveHubNodeId]))
}
// Register for Group 3
if(paramAssociationGroup3) {
cmds << secure(zwave.associationV2.associationSet(groupingIdentifier:3, nodeId: [zwaveHubNodeId]))
}
else {
cmds << secure(zwave.associationV2.associationRemove(groupingIdentifier:3, nodeId: [zwaveHubNodeId]))
}
// Register for Group 4
if(paramAssociationGroup4) {
cmds << secure(zwave.associationV2.associationSet(groupingIdentifier:4, nodeId: [zwaveHubNodeId]))
}
else {
cmds << secure(zwave.associationV2.associationRemove(groupingIdentifier:4, nodeId: [zwaveHubNodeId]))
}
// Register for Group 5
if(paramAssociationGroups5) {
cmds << secure(zwave.associationV2.associationSet(groupingIdentifier:5, nodeId: [zwaveHubNodeId]))
}
else {
cmds << secure(zwave.associationV2.associationRemove(groupingIdentifier:5, nodeId: [zwaveHubNodeId]))
}
cmds
}
def configure() {
// Wait until after the secure exchange for this
log.debug "configure()"
}
def updated() {
log.debug "updated()"
response(["delay 2000"] + configureAfterSecure() + refresh())
}
private secure(physicalgraph.zwave.Command cmd) {
log.trace(cmd)
zwave.securityV1.securityMessageEncapsulation().encapsulate(cmd).format()
}
private secureSequence(commands, delay=200) {
log.debug "$commands"
delayBetween(commands.collect{ secure(it) }, delay)
}

View File

@@ -19,11 +19,6 @@ metadata {
capability "Sensor"
attribute "colorName", "string"
// indicates that device keeps track of heartbeat (in state.heartbeat)
attribute "heartbeat", "string"
}
// simulator metadata
@@ -75,9 +70,6 @@ metadata {
def parse(String description) {
//log.trace description
// save heartbeat (i.e. last time we got a message from device)
state.heartbeat = Calendar.getInstance().getTimeInMillis()
if (description?.startsWith("catchall:")) {
if(description?.endsWith("0100") ||description?.endsWith("1001") || description?.matches("on/off\\s*:\\s*1"))
{
@@ -132,7 +124,6 @@ def off() {
}
def refresh() {
sendEvent(name: "heartbeat", value: "alive", displayed:false)
[
"st rattr 0x${device.deviceNetworkId} ${endpointId} 6 0", "delay 500",
"st rattr 0x${device.deviceNetworkId} ${endpointId} 8 0", "delay 500",

View File

@@ -16,7 +16,7 @@
metadata {
// Automatically generated. Make future change here.
definition (name: "SmartPower Outlet", namespace: "smartthings", author: "SmartThings") {
definition (name: "SmartPower Outlet", namespace: "smartthings", author: "SmartThings", category: "C1") {
capability "Actuator"
capability "Switch"
capability "Power Meter"
@@ -25,9 +25,6 @@ metadata {
capability "Sensor"
capability "Health Check"
// indicates that device keeps track of heartbeat (in state.heartbeat)
attribute "heartbeat", "string"
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0B04,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3200", deviceJoinName: "Outlet"
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0B04,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3200-Sgb", deviceJoinName: "Outlet"
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0B04,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "4257050-RZHAC", deviceJoinName: "Outlet"
@@ -81,9 +78,6 @@ metadata {
def parse(String description) {
log.debug "description is $description"
// save heartbeat (i.e. last time we got a message from device)
state.heartbeat = Calendar.getInstance().getTimeInMillis()
def finalResult = zigbee.getKnownDescription(description)
//TODO: Remove this after getKnownDescription can parse it automatically
@@ -124,7 +118,6 @@ def on() {
}
def refresh() {
sendEvent(name: "heartbeat", value: "alive", displayed:false)
zigbee.onOffRefresh() + zigbee.refreshData("0x0B04", "0x050B")
}

View File

@@ -15,7 +15,7 @@
*/
metadata {
definition (name: "SmartSense Moisture Sensor",namespace: "smartthings", author: "SmartThings") {
definition (name: "SmartSense Moisture Sensor",namespace: "smartthings", author: "SmartThings", category: "C2") {
capability "Configuration"
capability "Battery"
capability "Refresh"

View File

@@ -15,7 +15,7 @@
*/
metadata {
definition (name: "SmartSense Motion Sensor", namespace: "smartthings", author: "SmartThings") {
definition (name: "SmartSense Motion Sensor", namespace: "smartthings", author: "SmartThings", category: "C2") {
capability "Motion Sensor"
capability "Configuration"
capability "Battery"

View File

@@ -15,7 +15,7 @@
*/
metadata {
definition (name: "SmartSense Multi Sensor", namespace: "smartthings", author: "SmartThings") {
definition (name: "SmartSense Multi Sensor", namespace: "smartthings", author: "SmartThings", category: "C2") {
capability "Three Axis"
capability "Battery"

View File

@@ -16,7 +16,7 @@
//DEPRECATED - Using the smartsense-multi-sensor.groovy DTH for this device. Users need to be moved before deleting this DTH
metadata {
definition (name: "SmartSense Open/Closed Accelerometer Sensor", namespace: "smartthings", author: "SmartThings") {
definition (name: "SmartSense Open/Closed Accelerometer Sensor", namespace: "smartthings", author: "SmartThings", category: "C2") {
capability "Battery"
capability "Configuration"
capability "Contact Sensor"

View File

@@ -14,7 +14,7 @@
*
*/
metadata {
definition (name: "SmartSense Temp/Humidity Sensor",namespace: "smartthings", author: "SmartThings") {
definition (name: "SmartSense Temp/Humidity Sensor",namespace: "smartthings", author: "SmartThings", category: "C2") {
capability "Configuration"
capability "Battery"
capability "Refresh"

View File

@@ -0,0 +1,42 @@
# Device Tiles Examples and Reference
This package contains examples of Device tiles, organized by tile type.
## Purpose
Each Device Handler shows example usages of a specific tile, and is meant to represent the variety of permutations that a tile can be configured.
The various tiles can be used by QA to test tiles on all supported mobile devices, and by developers as a reference implementation.
## Installation
1. Self-publish the Device Handlers in this package.
2. Self-publish the Device Tile Controller SmartApp. The SmartApp can be found [here](https://github.com/SmartThingsCommunity/SmartThingsPublic/blob/master/smartapps/smartthings/tile-ux/device-tile-controller.src/device-tile-controller.groovy).
3. Install the SmartApp from the Marketplace, under "My Apps".
4. Select the simulated devices you want to install and press "Done".
The simulated devices can then be found in the "Things" view of "My Home" in the mobile app.
You may wish to create a new room for these simulated devices for easy access.
## Usage
Each simulated device can be interacted with like other devices.
You can use the mobile app to interact with the tiles to see how they look and behave.
## Troubleshooting
If you get an error when installing the simulated devices using the controller SmartApp, ensure that you have published all the Device Handlers for yourself.
Also check live logging to see if there is a specific tile that is causing installation issues.
## FAQ
*Question: A tile isn't behaving as expected. What should I do?*
QA should create a JIRA ticket for any issues or inconsistencies of tiles across devices.
Developers may file a support ticket, and reference the specific tile and issue observed.
*Question: I'd like to contribute an example tile usage that would be helpful for testing and reference purposes. Can I do that?*
We recommend that you open an issue in the SmartThingsPublic repository describing the example tile and usage.
That way we can discuss with you the proposed change, and then if appropriate you can create a PR associated to the issue.

View File

@@ -22,7 +22,7 @@ metadata {
tiles(scale: 2) {
valueTile("currentColor", "device.color") {
state "default", label: '${currentValue}'
state "color", label: '${currentValue}', defaultState: true
}
controlTile("rgbSelector", "device.color", "color", height: 6, width: 6, inactiveLabel: false) {
@@ -41,6 +41,13 @@ def parse(String description) {
log.debug "Parsing '${description}'"
}
def setColor(value) {
log.debug "setting color: $value"
if (value.hex) { sendEvent(name: "color", value: value.hex) }
if (value.hue) { sendEvent(name: "hue", value: value.hue) }
if (value.saturation) { sendEvent(name: "saturation", value: value.saturation) }
}
def setSaturation(percent) {
log.debug "Executing 'setSaturation'"
sendEvent(name: "saturation", value: percent)

View File

@@ -39,7 +39,7 @@ metadata {
}
valueTile("rangeValue", "device.rangedLevel", height: 2, width: 2) {
state "default", label:'${currentValue}'
state "range", label:'${currentValue}', defaultState: true
}
controlTile("rangeSliderConstrained", "device.rangedLevel", "slider", height: 2, width: 4, range: "(40..60)") {

View File

@@ -41,17 +41,17 @@ metadata {
// standard flat tile with only a label
standardTile("flatLabel", "device.switch", width: 2, height: 2, decoration: "flat") {
state "default", label: 'On Action', action: "switch.on", backgroundColor: "#ffffff"
state "label", label: 'On Action', action: "switch.on", backgroundColor: "#ffffff", defaultState: true
}
// standard flat tile with icon and label
standardTile("flatIconLabel", "device.switch", width: 2, height: 2, decoration: "flat") {
state "default", label: 'Off Action', action: "switch.off", icon:"st.switches.switch.off", backgroundColor: "#ffffff"
state "iconLabel", label: 'Off Action', action: "switch.off", icon:"st.switches.switch.off", backgroundColor: "#ffffff", defaultState: true
}
// standard flat tile with only icon (Refreh text is IN the icon file)
standardTile("flatIcon", "device.switch", width: 2, height: 2, decoration: "flat") {
state "default", action:"refresh.refresh", icon:"st.secondary.refresh"
state "icon", action:"refresh.refresh", icon:"st.secondary.refresh", defaultState: true
}
// standard with defaultState = true
@@ -74,19 +74,19 @@ metadata {
// utility tiles to fill the spaces
standardTile("empty2x2", "null", width: 2, height: 2, decoration: "flat") {
state "default", label:''
state "emptySmall", label:'', defaultState: true
}
standardTile("empty4x2", "null", width: 4, height: 2, decoration: "flat") {
state "default", label:''
state "emptyBigger", label:'', defaultState: true
}
// multi-line text (explicit newlines)
standardTile("multiLine", "device.multiLine", width: 2, height: 2) {
state "default", label: '${currentValue}'
state "multiLine", label: '${currentValue}', defaultState: true
}
standardTile("multiLineWithIcon", "device.multiLine", width: 2, height: 2) {
state "default", label: '${currentValue}', icon: "st.switches.switch.off"
state "multiLineIcon", label: '${currentValue}', icon: "st.switches.switch.off", defaultState: true
}
main("actionRings")

View File

@@ -22,68 +22,68 @@ metadata {
tiles(scale: 2) {
valueTile("text", "device.text", width: 2, height: 2) {
state "default", label:'${currentValue}'
state "val", label:'${currentValue}', defaultState: true
}
valueTile("longText", "device.longText", width: 2, height: 2) {
state "default", label:'${currentValue}'
state "val", label:'${currentValue}', defaultState: true
}
valueTile("integer", "device.integer", width: 2, height: 2) {
state "default", label:'${currentValue}'
state "val", label:'${currentValue}', defaultState: true
}
valueTile("integerFloat", "device.integerFloat", width: 2, height: 2) {
state "default", label:'${currentValue}'
state "val", label:'${currentValue}', defaultState: true
}
valueTile("pi", "device.pi", width: 2, height: 2) {
state "default", label:'${currentValue}'
state "val", label:'${currentValue}', defaultState: true
}
valueTile("floatAsText", "device.floatAsText", width: 2, height: 2) {
state "default", label:'${currentValue}'
state "val", label:'${currentValue}', defaultState: true
}
valueTile("bgColor", "device.integer", width: 2, height: 2) {
state "default", label:'${currentValue}', backgroundColor: "#e86d13"
state "val", label:'${currentValue}', backgroundColor: "#e86d13", defaultState: true
}
valueTile("bgColorRange", "device.integer", width: 2, height: 2) {
state "default", label:'${currentValue}', backgroundColors: [
state "val", label:'${currentValue}', defaultState: true, backgroundColors: [
[value: 10, color: "#ff0000"],
[value: 90, color: "#0000ff"]
]
}
valueTile("bgColorRangeSingleItem", "device.integer", width: 2, height: 2) {
state "default", label:'${currentValue}', backgroundColors: [
state "val", label:'${currentValue}', defaultState: true, backgroundColors: [
[value: 10, color: "#333333"]
]
}
valueTile("bgColorRangeConflict", "device.integer", width: 2, height: 2) {
state "default", label:'${currentValue}', backgroundColors: [
state "valWithConflict", label:'${currentValue}', defaultState: true, backgroundColors: [
[value: 10, color: "#990000"],
[value: 10, color: "#000099"]
]
}
valueTile("noValue", "device.nada", width: 4, height: 2) {
state "default", label:'${currentValue}'
state "noval", label:'${currentValue}', defaultState: true
}
valueTile("multiLine", "device.multiLine", width: 3, height: 2) {
state "default", label: '${currentValue}'
state "val", label: '${currentValue}', defaultState: true
}
valueTile("multiLineWithIcon", "device.multiLine", width: 3, height: 2) {
state "default", label: '${currentValue}', icon: "st.switches.switch.off"
state "val", label: '${currentValue}', icon: "st.switches.switch.off", defaultState: true
}
main("text")
details([
"text", "longText", "integer",
"text", "longText", "integer",
"integerFloat", "pi", "floatAsText",
"bgColor", "bgColorRange", "bgColorRangeSingleItem",
"bgColorRangeConflict", "noValue",

View File

@@ -39,15 +39,15 @@ metadata {
attributeState "turningOff", label:'${name}', backgroundColor:"#ffffff", nextState:"turningOn"
}
tileAttribute("device.level", key: "SECONDARY_CONTROL") {
attributeState "default", icon: 'st.Weather.weather1', action:"randomizeLevel"
attributeState "level", icon: 'st.Weather.weather1', action:"randomizeLevel", defaultState: true
}
tileAttribute("device.level", key: "SLIDER_CONTROL") {
attributeState "default", action:"switch level.setLevel"
attributeState "level", action:"switch level.setLevel", defaultState: true
}
}
multiAttributeTile(name:"valueTile", type:"generic", width:6, height:4) {
tileAttribute("device.level", key: "PRIMARY_CONTROL") {
attributeState "default", label:'${currentValue}', backgroundColors:[
attributeState "level", label:'${currentValue}', defaultState: true, backgroundColors:[
[value: 0, color: "#ff0000"],
[value: 20, color: "#ffff00"],
[value: 40, color: "#00ff00"],
@@ -69,34 +69,34 @@ metadata {
}
multiAttributeTile(name:"lengthyTile", type:"generic", width:6, height:4) {
tileAttribute("device.lengthyText", key: "PRIMARY_CONTROL") {
attributeState "default", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821"
attributeState "lengthyText", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821", defaultState: true
}
tileAttribute("device.lengthyText", key: "SECONDARY_CONTROL") {
attributeState "default", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821"
attributeState "lengthyText", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821", defaultState: true
}
}
multiAttributeTile(name:"multilineTile", type:"generic", width:6, height:4) {
tileAttribute("device.multilineText", key: "PRIMARY_CONTROL") {
attributeState "default", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821"
attributeState "multiLineText", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821", defaultState: true
}
tileAttribute("device.multilineText", key: "SECONDARY_CONTROL") {
attributeState "default", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821"
attributeState "multiLineText", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821", defaultState: true
}
}
multiAttributeTile(name:"lengthyTileWithIcon", type:"generic", width:6, height:4) {
tileAttribute("device.lengthyText", key: "PRIMARY_CONTROL") {
attributeState "default", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821", icon: "st.switches.switch.on"
attributeState "lengthyText", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821", icon: "st.switches.switch.on", defaultState: true
}
tileAttribute("device.lengthyText", key: "SECONDARY_CONTROL") {
attributeState "default", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821", icon: "st.switches.switch.on"
attributeState "lengthyText", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821", icon: "st.switches.switch.on", defaultState: true
}
}
multiAttributeTile(name:"multilineTileWithIcon", type:"generic", width:6, height:4) {
tileAttribute("device.multilineText", key: "PRIMARY_CONTROL") {
attributeState "default", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821", icon: "st.switches.switch.on"
attributeState "multilineText", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821", icon: "st.switches.switch.on", defaultState: true
}
tileAttribute("device.multilineText", key: "SECONDARY_CONTROL") {
attributeState "default", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821", icon: "st.switches.switch.on"
attributeState "multilineText", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821", icon: "st.switches.switch.on", defaultState: true
}
}

View File

@@ -96,10 +96,10 @@ metadata {
}
standardTile("reset", "device.reset", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "default", label:"Reset Color", action:"reset", icon:"st.lights.philips.hue-single"
state "reset", label:"Reset Color", action:"reset", icon:"st.lights.philips.hue-single", defaultState: true
}
standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
state "refresh", label:"", action:"refresh.refresh", icon:"st.secondary.refresh", defaultState: true
}
main(["switch"])
@@ -173,7 +173,6 @@ def setColor(value) {
def reset() {
log.debug "Executing 'reset'"
setAdjustedColor([level:100, hex:"#90C638", saturation:56, hue:23])
//parent.poll()
}
def setAdjustedColor(value) {
@@ -189,7 +188,6 @@ def setAdjustedColor(value) {
def refresh() {
log.debug "Executing 'refresh'"
//parent.manualRefresh()
}
def adjustOutgoingHue(percent) {
@@ -208,4 +206,3 @@ def adjustOutgoingHue(percent) {
log.info "percent: $percent, adjusted: $adjusted"
adjusted
}

View File

@@ -37,10 +37,10 @@ metadata {
attributeState("stopped", label:"Stopped", action:"music Player.play", nextState: "playing")
}
tileAttribute("device.status", key: "PREVIOUS_TRACK") {
attributeState("default", action:"music Player.previousTrack")
attributeState("status", action:"music Player.previousTrack", defaultState: true)
}
tileAttribute("device.status", key: "NEXT_TRACK") {
attributeState("default", action:"music Player.nextTrack")
attributeState("status", action:"music Player.nextTrack", defaultState: true)
}
tileAttribute ("device.level", key: "SLIDER_CONTROL") {
attributeState("level", action:"music Player.setLevel")
@@ -50,7 +50,7 @@ metadata {
attributeState("muted", action:"music Player.unmute", nextState: "unmuted")
}
tileAttribute("device.trackDescription", key: "MARQUEE") {
attributeState("default", label:"${currentValue}")
attributeState("trackDescription", label:"${currentValue}", defaultState: true)
}
}

View File

@@ -32,14 +32,14 @@ metadata {
tiles(scale: 2) {
multiAttributeTile(name:"thermostatFull", type:"thermostat", width:6, height:4) {
tileAttribute("device.temperature", key: "PRIMARY_CONTROL") {
attributeState("default", label:'${currentValue}', unit:"dF")
attributeState("temp", label:'${currentValue}', unit:"dF", defaultState: true)
}
tileAttribute("device.temperature", key: "VALUE_CONTROL") {
attributeState("VALUE_UP", action: "tempUp")
attributeState("VALUE_DOWN", action: "tempDown")
}
tileAttribute("device.humidity", key: "SECONDARY_CONTROL") {
attributeState("default", label:'${currentValue}%', unit:"%")
attributeState("humidity", label:'${currentValue}%', unit:"%", defaultState: true)
}
tileAttribute("device.thermostatOperatingState", key: "OPERATING_STATE") {
attributeState("idle", backgroundColor:"#44b621")
@@ -53,15 +53,16 @@ metadata {
attributeState("auto", label:'${name}')
}
tileAttribute("device.heatingSetpoint", key: "HEATING_SETPOINT") {
attributeState("default", label:'${currentValue}', unit:"dF")
attributeState("heatingSetpoint", label:'${currentValue}', unit:"dF", defaultState: true)
}
tileAttribute("device.coolingSetpoint", key: "COOLING_SETPOINT") {
attributeState("default", label:'${currentValue}', unit:"dF")
attributeState("coolingSetpoint", label:'${currentValue}', unit:"dF", defaultState: true)
}
}
multiAttributeTile(name:"thermostatNoHumidity", type:"thermostat", width:6, height:4) {
tileAttribute("device.temperature", key: "PRIMARY_CONTROL") {
attributeState("default", label:'${currentValue}', unit:"dF")
attributeState("coolingSetpoint", label:'${currentValue}', unit:"dF", defaultState: true)
attributeState("temp", label:'${currentValue}', unit:"dF")
}
tileAttribute("device.temperature", key: "VALUE_CONTROL") {
attributeState("VALUE_UP", action: "tempUp")
@@ -79,15 +80,16 @@ metadata {
attributeState("auto", label:'${name}')
}
tileAttribute("device.heatingSetpoint", key: "HEATING_SETPOINT") {
attributeState("default", label:'${currentValue}', unit:"dF")
attributeState("coolingSetpoint", label:'${currentValue}', unit:"dF", defaultState: true)
attributeState("heatingSetpoint", label:'${currentValue}', unit:"dF")
}
tileAttribute("device.coolingSetpoint", key: "COOLING_SETPOINT") {
attributeState("default", label:'${currentValue}', unit:"dF")
attributeState("coolingSetpoint", label:'${currentValue}', unit:"dF", defaultState: true)
}
}
multiAttributeTile(name:"thermostatBasic", type:"thermostat", width:6, height:4) {
tileAttribute("device.temperature", key: "PRIMARY_CONTROL") {
attributeState("default", label:'${currentValue}', unit:"dF",
attributeState("temp", label:'${currentValue}', unit:"dF", defaultState: true,
backgroundColors:[
[value: 31, color: "#153591"],
[value: 44, color: "#1e9cbb"],
@@ -118,30 +120,30 @@ metadata {
)
}
standardTile("tempDown", "device.temperature", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "default", label:'down', action:"tempDown"
state "tempDown", label:'down', action:"tempDown", defaultState: true
}
standardTile("tempUp", "device.temperature", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "default", label:'up', action:"tempUp"
state "tempUp", label:'up', action:"tempUp", defaultState: true
}
valueTile("heatingSetpoint", "device.heatingSetpoint", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "heat", label:'${currentValue} heat', unit: "F", backgroundColor:"#ffffff"
}
standardTile("heatDown", "device.temperature", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "default", label:'down', action:"heatDown"
state "heatDown", label:'down', action:"heatDown", defaultState: true
}
standardTile("heatUp", "device.temperature", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "default", label:'up', action:"heatUp"
state "heatUp", label:'up', action:"heatUp", defaultState: true
}
valueTile("coolingSetpoint", "device.coolingSetpoint", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "cool", label:'${currentValue} cool', unit:"F", backgroundColor:"#ffffff"
}
standardTile("coolDown", "device.temperature", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "default", label:'down', action:"coolDown"
state "coolDown", label:'down', action:"coolDown", defaultState: true
}
standardTile("coolUp", "device.temperature", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "default", label:'up', action:"coolUp"
state "coolUp", label:'up', action:"coolUp", defaultState: true
}
standardTile("mode", "device.thermostatMode", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {

View File

@@ -22,8 +22,9 @@ metadata {
capability "Switch"
capability "Switch Level"
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000", outClusters: "0000,0019"
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000", outClusters: "0000,0019", manufacturer: "CREE", model: "Connected A-19 60W Equivalent", deviceJoinName: "Cree Connected Bulb"
//fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000", outClusters: "0000,0019"
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000", outClusters: "0019"
//fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000", outClusters: "0000,0019", manufacturer: "CREE", model: "Connected A-19 60W Equivalent", deviceJoinName: "Cree Connected Bulb"
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Classic A60 W clear", deviceJoinName: "OSRAM LIGHTIFY LED Smart Connected Light"
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Classic A60 W clear - LIGHTIFY", deviceJoinName: "OSRAM LIGHTIFY LED Smart Connected Light"
fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 1000", outClusters: "0019", manufacturer: "Philips", model: "LWB006", deviceJoinName: "Philips Hue White"

View File

@@ -95,11 +95,17 @@ def zwaveEvent(physicalgraph.zwave.commands.hailv1.Hail cmd) {
}
def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) {
if (state.manufacturer != cmd.manufacturerName) {
updateDataValue("manufacturer", cmd.manufacturerName)
}
log.debug "manufacturerId: ${cmd.manufacturerId}"
log.debug "manufacturerName: ${cmd.manufacturerName}"
log.debug "productId: ${cmd.productId}"
log.debug "productTypeId: ${cmd.productTypeId}"
def msr = String.format("%04X-%04X-%04X", cmd.manufacturerId, cmd.productTypeId, cmd.productId)
updateDataValue("MSR", msr)
updateDataValue("manufacturer", cmd.manufacturerName)
createEvent([descriptionText: "$device.displayName MSR: $msr", isStateChange: false])
}
def zwaveEvent(physicalgraph.zwave.Command cmd) {
// Handles all Z-Wave commands we aren't interested in
[:]

View File

@@ -0,0 +1,252 @@
/**
* Gidjit Hub
*
* Copyright 2016 Matthew Page
*
* 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.
*
*/
definition(
name: "Gidjit Hub",
namespace: "com.gidjit.smartthings.hub",
author: "Matthew Page",
description: "Act as an endpoint so user's of Gidjit can quickly access and control their devices and execute routines. Users can do this quickly as Gidjit filters these actions based on their environment",
category: "Convenience",
iconUrl: "http://www.gidjit.com/appicon.png",
iconX2Url: "http://www.gidjit.com/appicon@2x.png",
iconX3Url: "http://www.gidjit.com/appicon@3x.png",
oauth: [displayName: "Gidjit", displayLink: "www.gidjit.com"])
preferences {
section ("Allow Gidjit to have access, there by allowing you to quickly control and monitor the following devices") {
input "switches", "capability.switch", title: "Control/Monitor your switches", multiple: true, required: false
input "thermostats", "capability.thermostat", title: "Control/Monitor your thermostats", multiple: true, required: false
input "windowShades", "capability.windowShade", title: "Control/Monitor your window shades", multiple: true, required: false //windowShade
//input "bulbs", "capability.colorControl", title: "Control your lights", multiple: true, required: false //windowShade
}
}
mappings {
path("/structureinfo") {
action: [
GET: "structureInfo"
]
}
path("/helloactions") {
action: [
GET: "helloActions"
]
}
path("/helloactions/:label") {
action: [
PUT: "executeAction"
]
}
path("/switch/:id/:command") {
action: [
PUT: "updateSwitch"
]
}
path("/thermostat/:id/:command") {
action: [
PUT: "updateThermostat"
]
}
path("/windowshade/:id/:command") {
action: [
PUT: "updateWindowShade"
]
}
path("/acquiredata/:id") {
action: [
GET: "acquiredata"
]
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def initialize() {
// subscribe to attributes, devices, locations, etc.
}
def helloActions() {
def actions = location.helloHome?.getPhrases()*.label
if(!actions) {
return []
}
return actions
}
def executeAction() {
def actions = location.helloHome?.getPhrases()*.label
def a = actions?.find() { it == params.label }
if (!a) {
httpError(400, "invalid label $params.label")
return
}
location.helloHome?.execute(params.label)
}
/* this is the primary function called to query at the structure and its devices */
def structureInfo() { //list all devices
def list = [:]
def currId = location.id
list[currId] = [:]
list[currId].name = location.name
list[currId].id = location.id
list[currId].temperatureScale = location.temperatureScale
list[currId].devices = [:]
def setValues = {
if (params.brief) {
return [id: it.id, name: it.displayName]
}
def newList = [id: it.id, name: it.displayName, suppCapab: it.capabilities.collect {
"$it.name"
}, suppAttributes: it.supportedAttributes.collect {
"$it.name"
}, suppCommands: it.supportedCommands.collect {
"$it.name"
}]
return newList
}
switches?.each {
list[currId].devices[it.id] = setValues(it)
}
thermostats?.each {
list[currId].devices[it.id] = setValues(it)
}
windowShades?.each {
list[currId].devices[it.id] = setValues(it)
}
return list
}
/* This function returns all of the current values of the specified Devices attributes */
def acquiredata() {
def resp = [:]
if (!params.id) {
httpError(400, "invalid id $params.id")
return
}
def dev = switches.find() { it.id == params.id } ?: windowShades.find() { it.id == params.id } ?:
thermostats.find() { it.id == params.id }
if (!dev) {
httpError(400, "invalid id $params.id")
return
}
def att = dev.supportedAttributes
att.each {
resp[it.name] = dev.currentValue("$it.name")
}
return resp
}
void updateSwitch() {
// use the built-in request object to get the command parameter
def command = params.command
def sw = switches.find() { it.id == params.id }
if (!sw) {
httpError(400, "invalid id $params.id")
return
}
switch(command) {
case "on":
if ( sw.currentSwitch != "on" ) {
sw.on()
}
break
case "off":
if ( sw.currentSwitch != "off" ) {
sw.off()
}
break
default:
httpError(400, "$command is not a valid")
}
}
void updateThermostat() {
// use the built-in request object to get the command parameter
def command = params.command
def therm = thermostats.find() { it.id == params.id }
if (!therm || !command) {
httpError(400, "invalid id $params.id")
return
}
def passComm = [
"off",
"heat",
"emergencyHeat",
"cool",
"fanOn",
"fanAuto",
"fanCirculate",
"auto"
]
def passNumParamComm = [
"setHeatingSetpoint",
"setCoolingSetpoint",
]
def passStringParamComm = [
"setThermostatMode",
"setThermostatFanMode",
]
if (command in passComm) {
therm."$command"()
} else if (command in passNumParamComm && params.p1 && params.p1.isFloat()) {
therm."$command"(Float.parseFloat(params.p1))
} else if (command in passStringParamComm && params.p1) {
therm."$command"(params.p1)
} else {
httpError(400, "$command is not a valid command")
}
}
void updateWindowShade() {
// use the built-in request object to get the command parameter
def command = params.command
def ws = windowShades.find() { it.id == params.id }
if (!ws || !command) {
httpError(400, "invalid id $params.id")
return
}
def passComm = [
"open",
"close",
"presetPosition",
]
if (command in passComm) {
ws."$command"()
} else {
httpError(400, "$command is not a valid command")
}
}
// TODO: implement event handlers

View File

@@ -4,29 +4,33 @@
import java.text.DecimalFormat
import groovy.json.JsonSlurper
private apiUrl() { "https://api.netatmo.com" }
private getVendorName() { "netatmo" }
private getVendorAuthPath() { "https://api.netatmo.com/oauth2/authorize?" }
private getVendorTokenPath(){ "https://api.netatmo.com/oauth2/token" }
private getApiUrl() { "https://api.netatmo.com" }
private getVendorName() { "netatmo" }
private getVendorAuthPath() { "${apiUrl}/oauth2/authorize?" }
private getVendorTokenPath(){ "${apiUrl}/oauth2/token" }
private getVendorIcon() { "https://s3.amazonaws.com/smartapp-icons/Partner/netamo-icon-1%402x.png" }
private getClientId() { appSettings.clientId }
private getClientSecret() { appSettings.clientSecret }
private getServerUrl() { "https://graph.api.smartthings.com" }
private getClientId() { appSettings.clientId }
private getClientSecret() { appSettings.clientSecret }
private getServerUrl() { appSettings.serverUrl }
private getShardUrl() { return getApiServerUrl() }
private getCallbackUrl() { "${serverUrl}/oauth/callback" }
private getBuildRedirectUrl() { "${serverUrl}/oauth/initialize?appId=${app.id}&access_token=${state.accessToken}&apiServerUrl=${shardUrl}" }
// Automatically generated. Make future change here.
definition(
name: "Netatmo (Connect)",
namespace: "dianoga",
author: "Brian Steere",
description: "Netatmo Integration",
category: "SmartThings Labs",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/netamo-icon-1.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/netamo-icon-1%402x.png",
oauth: true,
singleInstance: true
name: "Netatmo (Connect)",
namespace: "dianoga",
author: "Brian Steere",
description: "Netatmo Integration",
category: "SmartThings Labs",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/netamo-icon-1.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/netamo-icon-1%402x.png",
oauth: true,
singleInstance: true
){
appSetting "clientId"
appSetting "clientSecret"
appSetting "serverUrl"
}
preferences {
@@ -35,35 +39,52 @@ preferences {
}
mappings {
path("/receivedToken"){action: [POST: "receivedToken", GET: "receivedToken"]}
path("/receiveToken"){action: [POST: "receiveToken", GET: "receiveToken"]}
path("/auth"){action: [GET: "auth"]}
path("/oauth/initialize") {action: [GET: "oauthInitUrl"]}
path("/oauth/callback") {action: [GET: "callback"]}
}
def authPage() {
log.debug "In authPage"
if(canInstallLabs()) {
def description = null
if (state.vendorAccessToken == null) {
log.debug "About to create access token."
def description
def uninstallAllowed = false
def oauthTokenProvided = false
createAccessToken()
description = "Tap to enter Credentials."
if (!state.accessToken) {
log.debug "About to create access token."
state.accessToken = createAccessToken()
}
return dynamicPage(name: "Credentials", title: "Authorize Connection", nextPage:"listDevices", uninstall: true, install:false) {
section { href url:buildRedirectUrl("auth"), style:"embedded", required:false, title:"Connect to ${getVendorName()}:", description:description }
if (canInstallLabs()) {
def redirectUrl = getBuildRedirectUrl()
log.debug "Redirect url = ${redirectUrl}"
if (state.authToken) {
description = "Tap 'Next' to proceed"
uninstallAllowed = true
oauthTokenProvided = true
} else {
description = "Click to enter Credentials."
}
if (!oauthTokenProvided) {
log.debug "Show the login page"
return dynamicPage(name: "Credentials", title: "Authorize Connection", nextPage:"listDevices", uninstall: uninstallAllowed, install:false) {
section() {
paragraph "Tap below to log in to the netatmo and authorize SmartThings access."
href url:redirectUrl, style:"embedded", required:false, title:"Connect to ${getVendorName()}:", description:description
}
}
} else {
description = "Tap 'Next' to proceed"
return dynamicPage(name: "Credentials", title: "Credentials Accepted!", nextPage:"listDevices", uninstall: true, install:false) {
section { href url: buildRedirectUrl("receivedToken"), style:"embedded", required:false, title:"${getVendorName()} is now connected to SmartThings!", description:description }
log.debug "Show the devices page"
return dynamicPage(name: "Credentials", title: "Credentials Accepted!", nextPage:"listDevices", uninstall: uninstallAllowed, install:false) {
section() {
input(name:"Devices", style:"embedded", required:false, title:"${getVendorName()} is now connected to SmartThings!", description:description)
}
}
}
}
else
{
} else {
def upgradeNeeded = """To use SmartThings Labs, your Hub should be completely up to date.
To update your Hub, access Location Settings in the Main Menu (tap the gear next to your location name), select your Hub, and choose "Update Hub"."""
@@ -78,229 +99,175 @@ To update your Hub, access Location Settings in the Main Menu (tap the gear next
}
}
def auth() {
redirect location: oauthInitUrl()
}
def oauthInitUrl() {
log.debug "In oauthInitUrl"
/* OAuth Step 1: Request access code with our client ID */
state.oauthInitState = UUID.randomUUID().toString()
def oauthParams = [ response_type: "code",
client_id: getClientId(),
state: state.oauthInitState,
redirect_uri: buildRedirectUrl("receiveToken") ,
scope: "read_station"
]
return getVendorAuthPath() + toQueryString(oauthParams)
}
def buildRedirectUrl(endPoint) {
log.debug "In buildRedirectUrl"
return getServerUrl() + "/api/token/${state.accessToken}/smartapps/installations/${app.id}/${endPoint}"
}
def receiveToken() {
log.debug "In receiveToken"
def oauthParams = [
client_secret: getClientSecret(),
response_type: "code",
client_id: getClientId(),
grant_type: "authorization_code",
redirect_uri: buildRedirectUrl('receiveToken'),
code: params.code,
client_secret: getClientSecret(),
state: state.oauthInitState,
redirect_uri: getCallbackUrl(),
scope: "read_station"
]
def tokenUrl = getVendorTokenPath()
def params = [
uri: tokenUrl,
contentType: 'application/x-www-form-urlencoded',
body: oauthParams,
]
log.debug params
log.debug "REDIRECT URL: ${getVendorAuthPath() + toQueryString(oauthParams)}"
/* OAuth Step 2: Request access token with our client Secret and OAuth "Code" */
try {
httpPost(params) { response ->
log.debug response.data
def slurper = new JsonSlurper();
redirect (location: getVendorAuthPath() + toQueryString(oauthParams))
}
response.data.each {key, value ->
def data = slurper.parseText(key);
log.debug "Data: $data"
def callback() {
log.debug "callback()>> params: $params, params.code ${params.code}"
state.vendorRefreshToken = data.refresh_token
state.vendorAccessToken = data.access_token
state.vendorTokenExpires = now() + (data.expires_in * 1000)
return
def code = params.code
def oauthState = params.state
if (oauthState == state.oauthInitState) {
def tokenParams = [
client_secret: getClientSecret(),
client_id : getClientId(),
grant_type: "authorization_code",
redirect_uri: getCallbackUrl(),
code: code,
scope: "read_station"
]
log.debug "TOKEN URL: ${getVendorTokenPath() + toQueryString(tokenParams)}"
def tokenUrl = getVendorTokenPath()
def params = [
uri: tokenUrl,
contentType: 'application/x-www-form-urlencoded',
body: tokenParams
]
log.debug "PARAMS: ${params}"
httpPost(params) { resp ->
def slurper = new JsonSlurper()
resp.data.each { key, value ->
def data = slurper.parseText(key)
state.refreshToken = data.refresh_token
state.authToken = data.access_token
state.tokenExpires = now() + (data.expires_in * 1000)
log.debug "swapped token: $resp.data"
}
}
} catch (Exception e) {
log.debug "Error: $e"
// Handle success and failure here, and render stuff accordingly
if (state.authToken) {
success()
} else {
fail()
}
} else {
log.error "callback() failed oauthState != state.oauthInitState"
}
}
log.debug "State: $state"
def success() {
log.debug "in success"
def message = """
<p>We have located your """ + getVendorName() + """ account.</p>
<p>Tap 'Done' to continue to Devices.</p>
"""
connectionStatus(message)
}
if ( !state.vendorAccessToken ) { //We didn't get an access token, bail on install
return
def fail() {
log.debug "in fail"
def message = """
<p>The connection could not be established!</p>
<p>Click 'Done' to return to the menu.</p>
"""
connectionStatus(message)
}
def connectionStatus(message, redirectUrl = null) {
def redirectHtml = ""
if (redirectUrl) {
redirectHtml = """
<meta http-equiv="refresh" content="3; url=${redirectUrl}" />
"""
}
/* OAuth Step 3: Use the access token to call into the vendor API throughout your code using state.vendorAccessToken. */
def html = """
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>${getVendorName()} Connection</title>
<style type="text/css">
* { box-sizing: border-box; }
@font-face {
font-family: 'Swiss 721 W01 Thin';
src: url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.eot');
src: url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.eot?#iefix') format('embedded-opentype'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.woff') format('woff'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.ttf') format('truetype'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.svg#swis721_th_btthin') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'Swiss 721 W01 Light';
src: url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.eot');
src: url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.eot?#iefix') format('embedded-opentype'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.woff') format('woff'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.ttf') format('truetype'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.svg#swis721_lt_btlight') format('svg');
font-weight: normal;
font-style: normal;
}
.container {
width: 100%;
padding: 40px;
/*background: #eee;*/
text-align: center;
}
img {
vertical-align: middle;
}
img:nth-child(2) {
margin: 0 30px;
}
p {
font-size: 2.2em;
font-family: 'Swiss 721 W01 Thin';
text-align: center;
color: #666666;
margin-bottom: 0;
}
/*
p:last-child {
margin-top: 0px;
}
*/
span {
font-family: 'Swiss 721 W01 Light';
}
</style>
</head>
<body>
<div class="container">
<img src=""" + getVendorIcon() + """ alt="Vendor icon" />
<img src="https://s3.amazonaws.com/smartapp-icons/Partner/support/connected-device-icn%402x.png" alt="connected device icon" />
<img src="https://s3.amazonaws.com/smartapp-icons/Partner/support/st-logo%402x.png" alt="SmartThings logo" />
<p>We have located your """ + getVendorName() + """ account.</p>
<p>Tap 'Done' to process your credentials.</p>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>${getVendorName()} Connection</title>
<style type="text/css">
* { box-sizing: border-box; }
@font-face {
font-family: 'Swiss 721 W01 Thin';
src: url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.eot');
src: url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.eot?#iefix') format('embedded-opentype'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.woff') format('woff'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.ttf') format('truetype'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.svg#swis721_th_btthin') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'Swiss 721 W01 Light';
src: url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.eot');
src: url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.eot?#iefix') format('embedded-opentype'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.woff') format('woff'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.ttf') format('truetype'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.svg#swis721_lt_btlight') format('svg');
font-weight: normal;
font-style: normal;
}
.container {
width: 100%;
padding: 40px;
/*background: #eee;*/
text-align: center;
}
img {
vertical-align: middle;
}
img:nth-child(2) {
margin: 0 30px;
}
p {
font-size: 2.2em;
font-family: 'Swiss 721 W01 Thin';
text-align: center;
color: #666666;
margin-bottom: 0;
}
/*
p:last-child {
margin-top: 0px;
}
*/
span {
font-family: 'Swiss 721 W01 Light';
}
</style>
</head>
<body>
<div class="container">
<img src=""" + getVendorIcon() + """ alt="Vendor icon" />
<img src="https://s3.amazonaws.com/smartapp-icons/Partner/support/connected-device-icn%402x.png" alt="connected device icon" />
<img src="https://s3.amazonaws.com/smartapp-icons/Partner/support/st-logo%402x.png" alt="SmartThings logo" />
${message}
</div>
</body>
</html>
"""
"""
render contentType: 'text/html', data: html
}
def receivedToken() {
log.debug "In receivedToken"
def html = """
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Withings Connection</title>
<style type="text/css">
* { box-sizing: border-box; }
@font-face {
font-family: 'Swiss 721 W01 Thin';
src: url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.eot');
src: url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.eot?#iefix') format('embedded-opentype'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.woff') format('woff'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.ttf') format('truetype'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-thin-webfont.svg#swis721_th_btthin') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'Swiss 721 W01 Light';
src: url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.eot');
src: url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.eot?#iefix') format('embedded-opentype'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.woff') format('woff'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.ttf') format('truetype'),
url('https://s3.amazonaws.com/smartapp-icons/Partner/fonts/swiss-721-light-webfont.svg#swis721_lt_btlight') format('svg');
font-weight: normal;
font-style: normal;
}
.container {
width: 560px;
padding: 40px;
/*background: #eee;*/
text-align: center;
}
img {
vertical-align: middle;
}
img:nth-child(2) {
margin: 0 30px;
}
p {
font-size: 2.2em;
font-family: 'Swiss 721 W01 Thin';
text-align: center;
color: #666666;
margin-bottom: 0;
}
/*
p:last-child {
margin-top: 0px;
}
*/
span {
font-family: 'Swiss 721 W01 Light';
}
</style>
</head>
<body>
<div class="container">
<img src=""" + getVendorIcon() + """ alt="Vendor icon" />
<img src="https://s3.amazonaws.com/smartapp-icons/Partner/support/connected-device-icn%402x.png" alt="connected device icon" />
<img src="https://s3.amazonaws.com/smartapp-icons/Partner/support/st-logo%402x.png" alt="SmartThings logo" />
<p>Tap 'Done' to continue to Devices.</p>
</div>
</body>
</html>
"""
render contentType: 'text/html', data: html
}
// "
def refreshToken() {
log.debug "In refreshToken"
@@ -308,8 +275,8 @@ def refreshToken() {
client_secret: getClientSecret(),
client_id: getClientId(),
grant_type: "refresh_token",
refresh_token: state.vendorRefreshToken
]
refresh_token: state.refreshToken
]
def tokenUrl = getVendorTokenPath()
def params = [
@@ -318,7 +285,7 @@ def refreshToken() {
body: oauthParams,
]
/* OAuth Step 2: Request access token with our client Secret and OAuth "Code" */
// OAuth Step 2: Request access token with our client Secret and OAuth "Code"
try {
httpPost(params) { response ->
def slurper = new JsonSlurper();
@@ -327,9 +294,9 @@ def refreshToken() {
def data = slurper.parseText(key);
log.debug "Data: $data"
state.vendorRefreshToken = data.refresh_token
state.vendorAccessToken = data.access_token
state.vendorTokenExpires = now() + (data.expires_in * 1000)
state.refreshToken = data.refresh_token
state.accessToken = data.access_token
state.tokenExpires = now() + (data.expires_in * 1000)
return true
}
@@ -338,9 +305,8 @@ def refreshToken() {
log.debug "Error: $e"
}
log.debug "State: $state"
if ( !state.vendorAccessToken ) { //We didn't get an access token
// We didn't get an access token
if ( !state.accessToken ) {
return false
}
}
@@ -482,13 +448,13 @@ def listDevices() {
}
def apiGet(String path, Map query, Closure callback) {
if(now() >= state.vendorTokenExpires) {
if(now() >= state.tokenExpires) {
refreshToken();
}
query['access_token'] = state.vendorAccessToken
query['access_token'] = state.accessToken
def params = [
uri: apiUrl(),
uri: getApiUrl(),
path: path,
'query': query
]

View File

@@ -1,88 +0,0 @@
/**
* Copyright 2015 SmartThings
*
* 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.
*/
definition(
name: "Fibaro Dimmer Scenes",
namespace: "My Apps",
author: "Elnar Hajiyev",
description: "Smart app that allows to control switches with changes of Fibaro Dimmer Scenes.",
category: "Convenience",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/light_outlet.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/light_outlet@2x.png"
)
preferences {
section("Listen to scenes from this Fibaro Dimmer devices...") {
input "fibaroDevicesSet", "capability.switch", title: "Fibaro Dimmers?", multiple: true, required: true
}
section("When any of these scenes are activated...") {
input "scenesSet1", "enum", title: "Fibaro Dimmer scenes (set 1)?", multiple: true, required: false,
options: ["10","11","12","13", "14", "15", "16", "17", "18", "20", "21", "22", "23", "24", "25", "26"]
}
section("Turn on all of these switches") {
input "switchesSet1", "capability.switch", multiple: true, required: false
}
section("When any of these scenes are activated...") {
input "scenesSet2", "enum", title: "Fibaro Dimmer scenes (set 2)?", multiple: true, required: false,
options: ["10","11","12","13", "14", "15", "16", "17", "18", "20", "21", "22", "23", "24", "25", "26"]
}
section("Turn off all of these switches") {
input "switchesSet2", "capability.switch", multiple: true, required: false
}
section("When any of these scenes are activated...") {
input "scenesSet3", "enum", title: "Fibaro Dimmer scenes (set 3)?", multiple: true, required: false,
options: ["10","11","12","13", "14", "15", "16", "17", "18", "20", "21", "22", "23", "24", "25", "26"]
}
section("Toggle all of these switches") {
input "switchesSet3", "capability.switch", multiple: true, required: false
}
}
def installed()
{
subscribe(fibaroDevicesSet, "scene", sceneHandler, [filterEvents: false])
}
def updated()
{
unsubscribe()
subscribe(fibaroDevicesSet, "scene", sceneHandler, [filterEvents: false])
}
def sceneHandler(evt) {
log.debug evt.value
log.debug evt.data
if(scenesSet1 && scenesSet1.contains(evt.value)) {
switchesSet1.on()
}
else if(scenesSet2 && scenesSet2.contains(evt.value)) {
switchesSet2.off()
}
else if(scenesSet3 && scenesSet3.contains(evt.value)) {
toggle(switchesSet3)
}
}
def toggle(devices) {
log.debug "toggle: $devices = ${devices*.currentValue('switch')}"
if (devices*.currentValue('switch').contains('off')) {
devices.on()
}
else if (devices*.currentValue('switch').contains('on')) {
devices.off()
}
else {
devices.on()
}
}

View File

@@ -370,9 +370,7 @@ def parse_api_response(resp, message) {
}
}
def getServerUrl() {
return "https://graph.api.smartthings.com"
}
def getServerUrl() { return getApiServerUrl() }
def debugEvent(message, displayEvent) {
def results = [

View File

@@ -0,0 +1,345 @@
/**
* SmartThings service for Prempoint
*
* Author: Prempoint Inc. (c) 2016
*
*/
definition(
name: "Prempoint",
namespace: "prempoint.com",
author: "Prempoint Inc.",
description: "SmartThings service for Prempoint",
category: "Connections",
iconUrl: "http://www.prempoint.com/images/social_app_emblem_50x50.png",
iconX2Url: "http://www.prempoint.com/images/social_app_emblem_100x100.png",
iconX3Url: "http://www.prempoint.com/images/social_app_emblem_150x150.png",
oauth: [displayName: "Prempoint", displayLink: "http://www.prempoint.com/"])
preferences {
section("Allow Prempoint to Control & Access These Things...") {
input "switches", "capability.switch", title: "Which Switches?", multiple: true, required: false
input "locks", "capability.lock", title: "Which Locks?", multiple: true, required: false
input "garagedoors", "capability.garageDoorControl", title: "Which Garage Doors?", multiple: true, required: false
//input "doors", "capability.doorControl", title: "Which Doors?", multiple: true, required: false
input "cameras", "capability.imageCapture", title: "Which Cameras?", multiple: true, required: false
}
}
mappings {
path("/list") {
action: [
GET: "listDevices"
]
}
path("/switches") {
action: [
GET: "listSwitches"
]
}
path("/switches/:id") {
action: [
GET: "showSwitch"
]
}
path("/switches/:id/:command") {
action: [
GET: "updateSwitch"
]
}
path("/switches/:id/:command/:level") {
action: [
GET: "updateSwitch"
]
}
path("/locks") {
action: [
GET: "listLocks"
]
}
path("/locks/:id") {
action: [
GET: "showLock"
]
}
path("/locks/:id/:command") {
action: [
GET: "updateLock"
]
}
path("/doors/:id") {
action: [
GET: "showDoor"
]
}
path("/doors/:id/:command") {
action: [
GET: "updateDoor"
]
}
path("/garagedoors/:id") {
action: [
GET: "showGarageDoor"
]
}
path("/garagedoors/:id/:command") {
action: [
GET: "updateGarageDoor"
]
}
path("/cameras/:id") {
action: [
GET: "showCamera"
]
}
path("/cameras/:id/:command") {
action: [
GET: "updateCamera"
]
}
}
def installed() {}
def updated() {}
def listDevices() {
log.debug "entering listDevices"
//return listSwitches() + listLocks() + listGarageDoors() + listDoors() + listCameras()
return listSwitches() + listLocks() + listGarageDoors() + listCameras()
}
//switches
def listSwitches() {
log.debug "entering listSwitches"
switches.collect{showDevice(it,"switch")}
}
def showSwitch() {
log.debug "entering showSwitches"
show(switches, "switch")
}
def updateSwitch() {
log.debug "entering updateSwitches"
update(switches, "switch")
}
//locks
def listLocks() {
log.debug "entering listLocks"
locks.collect{showDevice(it,"lock")}
}
def showLock() {
log.debug "entering showLock"
show(locks, "lock")
}
def updateLock() {
log.debug "entering updateLock"
update(locks, "lock")
}
//doors
def listDoors() {
log.debug "entering listDoors"
locks.collect{showDevice(it,"door")}
}
def showDoor() {
log.debug "entering showDoors"
show(doors, "door")
}
def updateDoor() {
log.debug "entering updateDoor"
update(doors, "door")
}
//garagedoors
def listGarageDoors() {
log.debug "entering listGarageDoors"
locks.collect{showDevice(it,"garagedoor")}
}
def showGarageDoor() {
log.debug "entering showGarageDoors"
show(garagedoors, "garagedoor")
}
def updateGarageDoor() {
log.debug "entering updateGarageDoor"
update(gargedoors, "garagedoor")
}
//cameras
def listCameras() {
log.debug "entering listCameras"
cameras.collect{showDevice(it,"image")}
}
def showCamera() {
log.debug "entering showCameras"
show(cameras, "camera")
}
def updateCamera() {
log.debug "entering updateCamera"
update(cameras, "camera")
}
def deviceHandler(evt) {}
private update(devices, type) {
def rc = null
//def command = request.JSON?.command
def command = params.command
log.debug "update, request: params: ${params}, devices: $devices.id type=$type command=$command"
// Process the command.
if (command)
{
def dev = devices.find { it.id == params.id }
if (!dev) {
httpError(404, "Device not found: $params.id")
} else if (type == "switch") {
switch(command) {
case "on":
rc = dev.on()
break
case "off":
rc = dev.off()
break
default:
httpError(400, "Device command=$command is not a valid for device=$it.id $dev")
}
} else if (type == "lock") {
switch(command) {
case "lock":
rc = dev.lock()
break
case "unlock":
rc = dev.unlock()
break
default:
httpError(400, "Device command=$command is not a valid for device:=$it.id $dev")
}
} else if (type == "door") {
switch(command) {
case "open":
rc = dev.open()
break
case "close":
rc = dev.close()
break
default:
httpError(400, "Device command=$command is not a valid for device=$it.id $dev")
}
} else if (type == "garagedoor") {
switch(command) {
case "open":
rc = dev.open()
break
case "close":
rc = dev.close()
break
default:
httpError(400, "Device command=$command is not a valid for device=$it.id $dev")
}
} else if (type == "camera") {
switch(command) {
case "take":
rc = dev.take()
log.debug "Device command=$command device=$it.id $dev current image=$it.currentImage"
break
default:
httpError(400, "Device command=$command is not a valid for device=$it.id $dev")
}
}
log.debug "executed device=$it.id $dev command=$command rc=$rc"
// Check that the device is a switch that is currently on, supports 'setLevel"
// and that a level was specified.
int level = params.level ? params.level as int : -1;
if ((type == "switch") && (dev.currentValue('switch') == "on") && hasLevel(dev) && (level != -1)) {
log.debug "device about to setLevel=$level"
dev.setLevel(level);
}
// Show the device info if necessary.
if (rc == null) {
rc = showDevice(dev, type)
}
}
return rc
}
private show(devices, type) {
def dev = devices.find { it.id == params.id }
if (!dev) {
httpError(404, "Device not found")
} else {
// Show the device info.
showDevice(dev, type)
}
}
private showDevice(it, type) {
def props = null
// Get the current state for the device type.
def state = [it.currentState(type)]
// Check that whether the a switch device with level support is located and update the returned device type.
def devType = type
if (type == "switch" && hasLevel(it)) {
// Assign "switchWithLevel" to device type.
devType = "switchWithLevel"
// Add the level state.
def levelState = it.currentState("level")
if (levelState) {
state.add(levelState)
}
}
log.debug "device label=$it.label type=$devType"
// Assign the device item properties if appropriate.
if (it) {
props = [id: it.id, label: it.label, type: devType, state: state]
// Add the hub information to the device properties
// if appropriate.
if (it.hub) {
props.put("location", it.hub.hub.location)
}
if (it.currentImage) {
props.put("currentImage", it.currentImage)
}
}
return props
}
private hasLevel(device) {
// Default return value.
def rc = false;
// Get the device supported commands.
def supportedCommands = device.supportedCommands
// Check to see if the "setLevel" was found and assign
// the appropriate return value.
if (supportedCommands) {
// Find the "setLevel" command.
rc = supportedCommands.toString().indexOf("setLevel") != -1
}
log.debug "hasLevel device label=$device.label supportedCommands=$supportedCommands rc=$rc"
return rc
}

View File

@@ -21,6 +21,12 @@ preferences()
section("Allow Simple Control to Monitor and Control These Things...")
{
input "switches", "capability.switch", title: "Which Switches?", multiple: true, required: false
input "locks", "capability.lock", title: "Which Locks?", multiple: true, required: false
input "thermostats", "capability.thermostat", title: "Which Thermostats?", multiple: true, required: false
input "doorControls", "capability.doorControl", title: "Which Door Controls?", multiple: true, required: false
input "colorControls", "capability.colorControl", title: "Which Color Controllers?", multiple: true, required: false
input "musicPlayers", "capability.musicPlayer", title: "Which Music Players?", multiple: true, required: false
input "switchLevels", "capability.switchLevel", title: "Which Adjustable Switches?", multiple: true, required: false
}
page(name: "mainPage", title: "Simple Control Setup", content: "mainPage", refreshTimeout: 5)
@@ -31,12 +37,17 @@ preferences()
mappings {
path("/devices") {
action: [
GET: "getDevices"
]
}
path("/:deviceType/devices") {
action: [
GET: "getDevices",
POST: "handleDevicesWithIDs"
]
}
path("/device/:id") {
}
path("/device/:deviceType/:id") {
action: [
GET: "getDevice",
POST: "updateDevice"
@@ -93,33 +104,40 @@ def handleDevicesWithIDs()
//log.debug("ids: ${ids}")
def command = data?.command
def arguments = data?.arguments
def type = params?.deviceType
//log.debug("device type: ${type}")
if (command)
{
def success = false
def statusCode = 404
//log.debug("command ${command}, arguments ${arguments}")
for (devId in ids)
{
def device = allDevices.find { it.id == devId }
if (device) {
if (arguments) {
//log.debug("device: ${device}")
// Check if we have a device that responds to the specified command
if (validateCommand(device, type, command)) {
if (arguments) {
device."$command"(*arguments)
} else {
device."$command"()
}
success = true
}
else {
device."$command"()
}
statusCode = 200
} else {
//log.debug("device not found ${devId}")
statusCode = 403
}
}
if (success)
def responseData = "{}"
switch (statusCode)
{
render status: 200, data: "{}"
}
else
{
render status: 404, data: '{"msg": "Device not found"}'
case 403:
responseData = '{"msg": "Access denied. This command is not supported by current capability."}'
break
case 404:
responseData = '{"msg": "Device not found"}'
break
}
render status: statusCode, data: responseData
}
else
{
@@ -164,25 +182,101 @@ def updateDevice()
def data = request.JSON
def command = data?.command
def arguments = data?.arguments
def type = params?.deviceType
//log.debug("device type: ${type}")
//log.debug("updateDevice, params: ${params}, request: ${data}")
if (!command) {
render status: 400, data: '{"msg": "command is required"}'
} else {
def statusCode = 404
def device = allDevices.find { it.id == params.id }
if (device) {
if (arguments) {
device."$command"(*arguments)
// Check if we have a device that responds to the specified command
if (validateCommand(device, type, command)) {
if (arguments) {
device."$command"(*arguments)
}
else {
device."$command"()
}
statusCode = 200
} else {
device."$command"()
statusCode = 403
}
render status: 204, data: "{}"
} else {
render status: 404, data: '{"msg": "Device not found"}'
}
def responseData = "{}"
switch (statusCode)
{
case 403:
responseData = '{"msg": "Access denied. This command is not supported by current capability."}'
break
case 404:
responseData = '{"msg": "Device not found"}'
break
}
render status: statusCode, data: responseData
}
}
/**
* Validating the command passed by the user based on capability.
* @return boolean
*/
def validateCommand(device, deviceType, command) {
//log.debug("validateCommand ${command}")
def capabilityCommands = getDeviceCapabilityCommands(device.capabilities)
//log.debug("capabilityCommands: ${capabilityCommands}")
def currentDeviceCapability = getCapabilityName(deviceType)
//log.debug("currentDeviceCapability: ${currentDeviceCapability}")
if (capabilityCommands[currentDeviceCapability]) {
return command in capabilityCommands[currentDeviceCapability] ? true : false
} else {
// Handling other device types here, which don't accept commands
httpError(400, "Bad request.")
}
}
/**
* Need to get the attribute name to do the lookup. Only
* doing it for the device types which accept commands
* @return attribute name of the device type
*/
def getCapabilityName(type) {
switch(type) {
case "switches":
return "Switch"
case "locks":
return "Lock"
case "thermostats":
return "Thermostat"
case "doorControls":
return "Door Control"
case "colorControls":
return "Color Control"
case "musicPlayers":
return "Music Player"
case "switchLevels":
return "Switch Level"
default:
return type
}
}
/**
* Constructing the map over here of
* supported commands by device capability
* @return a map of device capability -> supported commands
*/
def getDeviceCapabilityCommands(deviceCapabilities) {
def map = [:]
deviceCapabilities.collect {
map[it.name] = it.commands.collect{ it.name.toString() }
}
return map
}
def listSubscriptions()
{
//log.debug "listSubscriptions()"
@@ -361,7 +455,13 @@ def agentDiscovery(params=[:])
}
section("Allow Simple Control to Monitor and Control These Things...")
{
input "switches", "capability.switch", title: "Which Switches?", multiple: true, required: false
input "switches", "capability.switch", title: "Which Switches?", multiple: true, required: false
input "locks", "capability.lock", title: "Which Locks?", multiple: true, required: false
input "thermostats", "capability.thermostat", title: "Which Thermostats?", multiple: true, required: false
input "doorControls", "capability.doorControl", title: "Which Door Controls?", multiple: true, required: false
input "colorControls", "capability.colorControl", title: "Which Color Controllers?", multiple: true, required: false
input "musicPlayers", "capability.musicPlayer", title: "Which Music Players?", multiple: true, required: false
input "switchLevels", "capability.switchLevel", title: "Which Adjustable Switches?", multiple: true, required: false
}
}
}
@@ -672,5 +772,3 @@ def List getRealHubFirmwareVersions()
}

View File

@@ -0,0 +1,55 @@
/**
* Copyright 2015 SmartThings
*
* 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.
*
* Big Turn ON
*
* Author: SmartThings
*/
definition(
name: "불을 켜라",
namespace: "smartthings",
author: "SmartThings",
description: "Turn your lights on when the SmartApp is tapped or activated.",
category: "Convenience",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/light_outlet.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/light_outlet@2x.png"
)
preferences {
section("When I touch the app, turn on...") {
input "switches", "capability.switch", multiple: true
}
}
def installed()
{
subscribe(location, changedLocationMode)
subscribe(app, appTouch)
}
def updated()
{
unsubscribe()
subscribe(location, changedLocationMode)
subscribe(app, appTouch)
}
def changedLocationMode(evt) {
log.debug "changedLocationMode: $evt"
switches?.on()
}
def appTouch(evt) {
log.debug "appTouch: $evt"
switches?.on()
}

View File

@@ -297,8 +297,8 @@ private getTimeOk() {
def result = true
if (starting && ending) {
def currTime = now()
def start = timeToday(starting).time
def stop = timeToday(ending).time
def start = timeToday(starting, location.timeZone).time
def stop = timeToday(ending, location.timeZone).time
result = start < stop ? currTime >= start && currTime <= stop : currTime <= stop || currTime >= start
}
log.trace "timeOk = $result"

View File

@@ -73,7 +73,8 @@ def temperatureHandler(evt) {
// TODO: Send "Temperature back to normal" SMS, turn switch off
} else {
log.debug "Temperature dropped below $tooCold: sending SMS to $phone1 and activating $mySwitch"
send("${temperatureSensor1.displayName} is too cold, reporting a temperature of ${evt.value}${evt.unit?:"F"}")
def tempScale = location.temperatureScale ?: "F"
send("${temperatureSensor1.displayName} is too cold, reporting a temperature of ${evt.value}${evt.unit?:tempScale}")
switch1?.on()
}
}

View File

@@ -73,7 +73,8 @@ def temperatureHandler(evt) {
// TODO: Send "Temperature back to normal" SMS, turn switch off
} else {
log.debug "Temperature rose above $tooHot: sending SMS to $phone1 and activating $mySwitch"
send("${temperatureSensor1.displayName} is too hot, reporting a temperature of ${evt.value}${evt.unit?:"F"}")
def tempScale = location.temperatureScale ?: "F"
send("${temperatureSensor1.displayName} is too hot, reporting a temperature of ${evt.value}${evt.unit?:tempScale}")
switch1?.on()
}
}

View File

@@ -27,7 +27,6 @@ definition(
) {
appSetting "clientId"
appSetting "clientSecret"
appSetting "serverUrl"
}
preferences {
@@ -192,7 +191,7 @@ def getSmartThingsClientId() {
return "pREqugabRetre4EstetherufrePumamExucrEHuc"
}
def getServerUrl() { appSettings.serverUrl }
def getServerUrl() { getApiServerUrl() }
def buildRedirectUrl()
{

View File

@@ -339,7 +339,7 @@ def initialize() {
state.aux = 0
if (selectedhubs || selectedactivities) {
addDevice()
runEvery5Minutes("discovery")
runEvery5Minutes("poll")
}
}
@@ -394,9 +394,9 @@ def discovery() {
}
} catch (java.net.SocketTimeoutException e) {
log.warn "Connection to the hub timed out. Please restart the hub and try again."
state.resethub = true
state.resethub = true
} catch (e) {
log.warn "Hostname in certificate didn't match. Please try again later."
log.info "Logitech Harmony - Error: $e"
}
return null
}
@@ -474,7 +474,7 @@ def activity(dni,mode) {
def poll() {
// GET THE LIST OF ACTIVITIES
if (state.HarmonyAccessToken) {
getActivityList()
getActivityList()
def Params = [auth: state.HarmonyAccessToken]
def url = "https://home.myharmony.com/cloudapi/state?${toQueryString(Params)}"
try {
@@ -520,14 +520,17 @@ def poll() {
return "Poll completed $map - $state.hubs"
}
} catch (groovyx.net.http.HttpResponseException e) {
if (e.statusCode == 401) { // token is expired
state.remove("HarmonyAccessToken")
return "Harmony Access token has expired"
}
} catch(Exception e) {
log.trace e
}
}
if (e.statusCode == 401) { // token is expired
state.remove("HarmonyAccessToken")
log.warn "Harmony Access token has expired"
}
} catch (java.net.SocketTimeoutException e) {
log.warn "Connection to the hub timed out. Please restart the hub and try again."
state.resethub = true
} catch (e) {
log.info "Logitech Harmony - Error: $e"
}
}
}

View File

@@ -273,7 +273,7 @@ def scheduleCheck(evt) {
else {
if(people){
//don't turn off lights if anyone is home
if(someoneIsHome()){
if(someoneIsHome){
log.debug("Stopping Check for Light")
unschedule()
}