Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
708 commits
Select commit Hold shift + click to select a range
9cfe193
v2.0.1
alyc100 Jan 17, 2017
f794c1a
Add files via upload
alyc100 Jan 17, 2017
08a9901
Add files via upload
alyc100 Jan 17, 2017
1bf89e2
Delete neato_findme_icon.jpg
alyc100 Jan 17, 2017
fcc93d0
Add files via upload
alyc100 Jan 17, 2017
ed22db2
v1.0 BETA Release 7e - Bug fix. Mark device as Connected after offlin…
alyc100 Jan 17, 2017
d2bc8d1
More tweaks to bed presence logic.
alyc100 Jan 17, 2017
e8b01ae
More tweaks to bed presence logic.
alyc100 Jan 17, 2017
1b38d29
v1.5 - Find Me support and stats reporting for D5. Minor tweaks to st…
alyc100 Jan 17, 2017
ad05c93
v1.1.7b - Clean up display and formatting for multiple Botvacs.
alyc100 Jan 17, 2017
255c1b0
v1.0 BETA Release 7f - Bug fix. Out of Bed detection.
alyc100 Jan 17, 2017
605d4e5
Minor fix
alyc100 Jan 19, 2017
aa2aa44
v1.0 BETA Release 8 - Sleep score stored as 'battery' capability for…
alyc100 Jan 19, 2017
1b73a68
v1.0 BETA Release 6 - Added notification framework with option screen.
alyc100 Jan 19, 2017
fc4ef20
Minor fix
alyc100 Jan 19, 2017
48c6ce7
Change scheduler method
alyc100 Jan 19, 2017
3a264ea
Increase chart height to stop unintentional scrolling
alyc100 Jan 19, 2017
a766850
Increase HTML tile height to stop unintentional scrolling
alyc100 Jan 19, 2017
66a457c
Chart height adjust
alyc100 Jan 19, 2017
5c1cf9f
Chart height adjust
alyc100 Jan 19, 2017
c5348eb
Chart height adjust
alyc100 Jan 19, 2017
b085f76
v1.0 BETA Release 8b - Ensure one sleep score notification per day.
alyc100 Jan 20, 2017
2fdc7c0
Fix typos in release history
alyc100 Jan 24, 2017
4018db0
v1.5b - Better error handling for maps.
alyc100 Jan 24, 2017
0141963
v1.5.1 - Sq ft display on maps and stats.
alyc100 Jan 24, 2017
a23db70
Minor comment formatting
alyc100 Jan 24, 2017
5ad8c7a
v1.0 BETA Release 8c - Stop Infinite Loop / Divide by Errors.
alyc100 Jan 25, 2017
91901bb
Update version number
alyc100 Jan 25, 2017
8a6ef40
v2.2.5 - Stop notifications when total power and cost values are TBD …
alyc100 Jan 25, 2017
ba7e5ad
v1.0 - Remove BETA label
alyc100 Jan 26, 2017
a7e7eb7
v1.0 - Remove BETA label
alyc100 Jan 26, 2017
3baa152
Tile re-org.
alyc100 Jan 26, 2017
8d28b26
v1.0b - Token renew error fix.
alyc100 Jan 26, 2017
7943222
v1.0b - Token renew error fix.
alyc100 Jan 26, 2017
2cc6db9
Minor fix
alyc100 Jan 26, 2017
53d516f
Revert accidental BETA checkin to main branch
alyc100 Jan 26, 2017
b40e0b6
v1.2
alyc100 Feb 23, 2017
2e5d313
1.2b - Critical error fix that stopped cleaning completely.
alyc100 Mar 2, 2017
0872484
1.2c - Bug fix. Schedule ignored when SS notifications are turned off…
alyc100 Mar 6, 2017
af738eb
v2.0c - Fix to boost mode.
alyc100 Mar 10, 2017
47dd1c8
v1.2d - Bug fix. Schedule not reset automatically when clean starts i…
alyc100 Mar 16, 2017
5d4dfdd
Minor fixes.
alyc100 Mar 16, 2017
0550115
Minor fix
alyc100 Mar 16, 2017
fef251e
v1.2e - Bug fix. Enforce single instance of app.
alyc100 Mar 16, 2017
412a10c
v1.2f - Bug fix. Neato Botvac null pointer when start delay is set.
alyc100 Mar 23, 2017
8210148
1.2f - Bug fix. Neato Botvac null pointer when start delay is set.
alyc100 Mar 23, 2017
cb6dfc4
V1.5.1b
alyc100 Mar 31, 2017
36a3730
v2.7 - Support for new Hive Beekeeper API - Authors: Tom Beech, Alex …
alyc100 May 30, 2017
e5c0bff
Support for new Hive Beekeeper API
alyc100 May 30, 2017
b6d484b
Update for Hive Beekeeper API
alyc100 May 30, 2017
c771eca
Update for Hive Beekeeper API
alyc100 May 30, 2017
471f833
Updated for Hive Beekeeper API
alyc100 May 30, 2017
6dc8077
Fix wrong version number in text.
alyc100 May 30, 2017
90284ed
v1.2g - Null pointer fix on smartschedule with no trigger.
alyc100 May 31, 2017
6a1674c
Bug fix. Refresh bug prevents installation of Hive devices.
alyc100 May 31, 2017
f7c75ac
Bug fix. Refresh bug prevents installation of Hive devices.
alyc100 May 31, 2017
0cb97af
Bug fix. Refresh bug prevents installation of Hive devices.
alyc100 May 31, 2017
e4077c1
Bug fix. Refresh bug prevents installation of Hive devices.
alyc100 May 31, 2017
c71e1d8
Bug fix. Refresh bug prevents installation of Hive devices.
alyc100 May 31, 2017
c30db86
Update hive-active-light.groovy
alyc100 May 31, 2017
23928ec
Bug fix. Refresh bug prevents installation of Hive devices.
alyc100 May 31, 2017
f691348
Bug fix. Refresh bug prevents installation of Hive devices.
alyc100 May 31, 2017
b7f90be
Delete thermostat-mode-automation.groovy
alyc100 May 31, 2017
1713af1
Delete auto-mode-for-thermostats.groovy
alyc100 May 31, 2017
b283392
Delete hive-active-heating.groovy
alyc100 May 31, 2017
d6ab76c
Delete hive-active-hot-water.groovy
alyc100 May 31, 2017
2fd8a82
Delete hive-contact-sensor.groovy
alyc100 May 31, 2017
83fc8c0
Delete hive-multi-zone-active-heating.groovy
alyc100 May 31, 2017
a64b9eb
Delete neato-botvac-connected.groovy
alyc100 May 31, 2017
b366619
Delete ovo-energy-meter.groovy
alyc100 May 31, 2017
657780d
Make sure to not send empty values with events
unixbeast Jun 19, 2017
0584cc4
Merge pull request #19 from unixbeast/patch-1
alyc100 Jun 20, 2017
bf7c188
Version text change
alyc100 Jun 28, 2017
f939b61
v1.2h - Bug fix. Fix to smart schedule event handler typo preventing …
alyc100 Jul 6, 2017
037bfa1
Minor fixes
alyc100 Jul 6, 2017
d129519
Add files via upload
alyc100 Jul 18, 2017
fe02a6f
v1.6 - Add support for D7 including Maps and FindMe
alyc100 Sep 6, 2017
cffba5b
1.7 - Add support for D5 Extra Care. Add support for D7 Eco/Turbo.
alyc100 Sep 6, 2017
ff828d5
v1.7a - Fix support for D7 Eco/Turbo.
alyc100 Sep 6, 2017
def4857
1.7b - D7 remove navigation mode it's not supported.
alyc100 Sep 6, 2017
5b09ea8
Disable setting device to Offline on unexpected API response.
alyc100 Sep 17, 2017
5a71a77
v1.2.1 BETA - Allow option for a SmartSchedule 'day' be measured from…
alyc100 Sep 20, 2017
679007b
v1.2.1b - Fix to setting Smart Home Monitor.
alyc100 Oct 14, 2017
b221795
Added support for Hive Active Light Colour Bulb
alyc100 Oct 30, 2017
c1ea327
Minor fixes
alyc100 Oct 30, 2017
e97fe31
Comment changes
alyc100 Oct 30, 2017
a794b25
v2.8 - Support for Hive Active Light Colour Tuneable device.
alyc100 Oct 30, 2017
4d95172
Version info update
alyc100 Oct 30, 2017
9beeb98
v1.0 Update Hive Colour Bulb device to support new Hive Beekeeper API
alyc100 Oct 30, 2017
3ad8bd5
Remove duplicate device handler
alyc100 Oct 30, 2017
68b965c
v3.0 - Version refactor to reflect BeeKeeper API update.
alyc100 Oct 30, 2017
f7623ba
v3.0 - Version refactor to reflect BeeKeeper API update.
alyc100 Oct 30, 2017
6a6d415
Rename hive.activeplug.groovy to hive-activeplug.groovy
alyc100 Oct 30, 2017
cd4679e
Delete hive-heating-v2-0.groovy
alyc100 Oct 30, 2017
e7585b0
Delete hive-hot-water-v2-0.groovy
alyc100 Oct 30, 2017
3bfdc2e
Update hive-colour-light.groovy
alyc100 Oct 30, 2017
afefba6
v3.0 - Version refactor to reflect BeeKeeper API update.
alyc100 Oct 30, 2017
1176642
v3.0 - Support for Hive Active Light Colour Tuneable device.
alyc100 Oct 30, 2017
5e3b223
v3.0 - Support for Hive Active Light Colour Tuneable device.
alyc100 Oct 30, 2017
918c4fe
v3.0 Update Hive Colour Bulb device to support new Hive Beekeeper API
alyc100 Oct 30, 2017
cb90c11
v3.0 Update Hive Colour Bulb device to support new Hive Beekeeper API
alyc100 Oct 30, 2017
b3488ad
Cleanup
alyc100 Oct 30, 2017
e0aa678
Delete hive-activeplug.groovy
alyc100 Oct 30, 2017
ed85885
Delete hive-tuneable-light.groovy
alyc100 Oct 30, 2017
5dc38c6
Delete hive-colour-light.groovy
alyc100 Oct 30, 2017
92a01d8
Delete hive-active-light.groovy
alyc100 Oct 30, 2017
c2c9d01
v3.0 - Version refactor to reflect BeeKeeper API update.
alyc100 Oct 30, 2017
0b258b3
v3.0 - Version refactor to reflect BeeKeeper API update.
alyc100 Oct 30, 2017
dc2953b
Delete mihome-light-switch.groovy
alyc100 Oct 30, 2017
5dc50d5
v3.0b Bug fix. Typo for colour change HTTP request.
alyc100 Nov 1, 2017
b8d95f8
v1.1 - Add back up method for determining sleep event if presence val…
alyc100 Nov 14, 2017
868a45d
Comment amendments
alyc100 Nov 14, 2017
dd8baae
v1.0 BETA Release 3 - Add boost functionality.
alyc100 Dec 10, 2017
322ebdd
v1.8 - Added support for maps for D3 and D5 models with firmware v4.x
alyc100 Dec 21, 2017
e70f1ed
Error code text updates
alyc100 Dec 21, 2017
d168e11
v1.2.1c - Attempt to remove null reference when Botvac is removed.
alyc100 Jan 5, 2018
26245bf
Update version text
alyc100 Jan 5, 2018
20e9065
v1.2.1d - Another attempt to remove null device.
alyc100 Jan 5, 2018
37a6160
v1.2.1e - Fix null pointer exception on new installations.
alyc100 Jan 6, 2018
d195c06
v1.2.2 - Allow contact sensors to restrict Botvac start.
alyc100 Jan 18, 2018
cc06e7e
v1.2.3 - Allow contact sensors to trigger clean if conditions are met.
alyc100 Jan 19, 2018
5ffb688
v1.2.3 - Allow contact sensors to trigger clean if conditions are met.
alyc100 Jan 19, 2018
c28fdb3
v2.4.3 - Enable chart display when API returns corrupt historic data.
alyc100 Feb 18, 2018
75cb668
Update mihome-connect.groovy
Mark-C-uk Feb 20, 2018
c6cd48d
Merge pull request #20 from Mark-C-uk/patch-1
alyc100 Feb 20, 2018
119b52f
v1.8.1 - Fix support for D7 with houseCleaning basic-3 support.
alyc100 Apr 14, 2018
593fa70
Add files via upload
alyc100 Apr 18, 2018
a86a22c
Delete neato_floorplan_icon.png
alyc100 Apr 18, 2018
13d6e2a
Add files via upload
alyc100 Apr 18, 2018
8c916cd
Add files via upload
alyc100 Apr 18, 2018
179488d
Delete neato_floorplan_icon.png
alyc100 Apr 18, 2018
fbbab5e
Add files via upload
alyc100 Apr 18, 2018
6b425a6
Delete neato_floormap_icon.png
alyc100 Apr 18, 2018
f810ec3
Add files via upload
alyc100 Apr 18, 2018
a79563a
v1.9 - Support for D7 persistent map cleaning and deep cleaning mode.
alyc100 Apr 18, 2018
a4b6410
v1.2.4 - Show restriction summary text in app when contact sensor res…
alyc100 Apr 18, 2018
53a481f
v1.9b - Incorrect Persistent Map mode label fix.
alyc100 Apr 18, 2018
1df47cb
v2.5 - Remove OVO Live API
alyc100 Jun 1, 2018
75bde3e
v2.5 - Remove OVO Live API
alyc100 Jun 1, 2018
a58c5e5
v1.2.4b
alyc100 Jun 28, 2018
68e856d
v2.1.4b
alyc100 Jun 28, 2018
c95f031
V2.0.1c bug fix. Stop SSL error
alyc100 Jul 31, 2018
4ff84d0
V2.0.2
alyc100 Aug 6, 2018
0f052eb
MiHome(Connect) v2.0.2b
alyc100 Aug 7, 2018
7baddb9
Add files via upload
alyc100 Sep 21, 2018
0138f59
v.1.9.2 Neato device handler.
alyc100 Sep 21, 2018
6513cd2
v1.9.2b - Reduce the CAPS on Android tile labels.
alyc100 Sep 23, 2018
905bd1d
v3.1 - First attempt at New Smartthings App compatibility
alyc100 Oct 8, 2018
c5343ce
v1.10 - Initial compatibility with New Smartthings App
alyc100 Oct 8, 2018
2bfcbca
v1.0 BETA Release 5 - Initial New Smartthings App compatibility
alyc100 Oct 8, 2018
5a1b58b
New Smartthings App compatibility
alyc100 Oct 10, 2018
f2c39af
Add status as attribute to device handler.
alyc100 Oct 25, 2018
9d246e8
v1.10b
alyc100 Nov 1, 2018
e413992
Neato Botvac Connected Series v1.11
alyc100 Nov 11, 2018
f1d623d
v1.12
alyc100 Dec 20, 2018
288c5a2
1.12b
alyc100 Dec 23, 2018
24e2a5d
v1.12b
alyc100 Dec 23, 2018
7fa9e4c
v1.2.5
alyc100 Sep 5, 2019
9076f6b
v1.2.5 - Fix to deletion bug
alyc100 Sep 5, 2019
cb1444b
v1.2 - Fix to long Secret Key format
alyc100 Sep 5, 2019
31d2908
1.13
alyc100 Sep 5, 2019
0b7b076
v1.13 - Remove logging for Secret Key
alyc100 Sep 5, 2019
5864819
v1.13 - Add update instruction via notification
alyc100 Sep 5, 2019
07ad068
Add files via upload
alyc100 Sep 5, 2019
1fd4988
Add files via upload
alyc100 Sep 5, 2019
68bb2e1
Delete surepetcare-petdoor.png
alyc100 Sep 5, 2019
b0312bb
Delete surepetcare-catflap.png
alyc100 Sep 5, 2019
e6c7ff3
Add files via upload
alyc100 Sep 5, 2019
e926731
Add files via upload
alyc100 Sep 5, 2019
e4447bd
Add files via upload
alyc100 Sep 5, 2019
2095a13
Delete surepetcare-inside-location.png
alyc100 Sep 5, 2019
078ae8b
Delete surepetcare-outside-location.png
alyc100 Sep 5, 2019
f60e48c
Add files via upload
alyc100 Sep 5, 2019
af03cc1
Add files via upload
alyc100 Sep 6, 2019
5c6a402
Delete surepetcare-hub.png
alyc100 Sep 6, 2019
f5f040b
Add files via upload
alyc100 Sep 6, 2019
360b90c
Add files via upload
alyc100 Sep 6, 2019
6872146
Delete surepetcare-hub-icon.png
alyc100 Sep 6, 2019
2d8338a
Delete surepetcare-hub-bright.png
alyc100 Sep 6, 2019
7ee445c
Delete surepetcare-hub-dim.png
alyc100 Sep 6, 2019
b6d7cf9
Delete surepetcare-hub-off.png
alyc100 Sep 6, 2019
ee60ef7
Add files via upload
alyc100 Sep 6, 2019
e389d4b
Add files via upload
alyc100 Sep 6, 2019
d7dd24c
Sure PetCare v1.0
alyc100 Sep 6, 2019
6354352
Sure PetCare v1.0
alyc100 Sep 6, 2019
7526dea
Sure PetCare v1.0
alyc100 Sep 6, 2019
0d9e587
Sure PetCare v1.0
alyc100 Sep 6, 2019
2ef9dc4
v1.0b
alyc100 Sep 7, 2019
fe43361
v1.0b
alyc100 Sep 7, 2019
403b83a
v1.0b
alyc100 Sep 7, 2019
9c2a31d
Reduce logging
alyc100 Sep 7, 2019
195c2fa
Fix refresh rate
alyc100 Sep 7, 2019
e95491e
Fix refresh rate
alyc100 Sep 7, 2019
4ee300d
Reduce logging
alyc100 Sep 7, 2019
fca9797
v1.1
alyc100 Sep 7, 2019
5b23674
v1.01
alyc100 Sep 7, 2019
8c0a9ac
v1.0.1
alyc100 Sep 7, 2019
63583ff
Sensor
alyc100 Sep 7, 2019
93edf61
v1.0c - Bug fix. Fix tag id comparison for generating look through ev…
alyc100 Sep 8, 2019
e65e686
v1.0c
alyc100 Sep 8, 2019
59c360e
v1.0c
alyc100 Sep 8, 2019
c509bd4
v1.1
alyc100 Sep 9, 2019
cd02033
v1.1
alyc100 Sep 9, 2019
6e65052
v1.1b
alyc100 Sep 10, 2019
fe7dedf
v1.1b
alyc100 Sep 10, 2019
5e18c65
Updates to lock interface
alyc100 Sep 10, 2019
a2b7eec
Rearrange tiles
alyc100 Sep 10, 2019
a096ef7
v1.2 - Curfew option on PetCare doors
alyc100 Sep 13, 2019
4d8381b
v1.2.1 - Curfew status
alyc100 Sep 13, 2019
6a578e4
v1.2
alyc100 Sep 13, 2019
e451338
v1.2
alyc100 Sep 13, 2019
477b296
v1.2
alyc100 Sep 13, 2019
0c37fac
v1.2
alyc100 Sep 13, 2019
d6109e7
v1.2
alyc100 Sep 13, 2019
74817aa
v1.2.1b
alyc100 Oct 8, 2019
3f277e8
v1.2b
alyc100 Oct 8, 2019
fc21d5d
v1.2.6 - Option to delay cleaning if bin is full.
alyc100 Oct 15, 2019
166676c
version text
alyc100 Oct 15, 2019
bdb5cf3
Added support for Hive TRV
martinlong1978 Nov 4, 2019
8e42095
Added addressing to support TRVs. Included the type in the node addre…
martinlong1978 Nov 4, 2019
6cc67da
Added addressing to support TRVs. Included the type in the node addre…
martinlong1978 Nov 4, 2019
5fa0e1f
Merge pull request #24 from martinlong1978/master
alyc100 Nov 4, 2019
46914db
v1.13b - Handle regularly changing secret key from Neato API.
alyc100 Apr 7, 2020
5835059
1.2.6b - Handle regularly changing secret key from Neato API.
alyc100 Apr 7, 2020
7c386df
Notification issue fix
alyc100 Apr 17, 2020
34712fd
Update authentication URL
alyc100 Oct 2, 2020
f536133
v3.2 - Update Hive URL for heating
alyc100 Oct 12, 2020
2309c77
v3.1.1 - remove device type being used within device id
alyc100 Oct 12, 2020
297faae
v3.1.1b
alyc100 Oct 12, 2020
f500b53
v3.1.1b
alyc100 Oct 12, 2020
4ec5090
v3.1.1b - Update version number
alyc100 Oct 13, 2020
ab6703b
1.14 - Move persistent map and turbo mode tiles to device settings.
alyc100 Oct 13, 2020
60a4f7c
VID update
alyc100 Nov 9, 2020
8914479
New Battery Calculations
alyc100 Nov 9, 2020
da764d1
v3.2 Hive Smart App. Use Amazon authentication
alyc100 Dec 5, 2020
ab95f44
v3.2a
alyc100 Dec 6, 2020
a8d51fd
v3.2a
alyc100 Dec 6, 2020
1e83fa8
v3.2a
alyc100 Dec 6, 2020
ba6ae90
v3.2b
alyc100 Dec 7, 2020
89f081d
v3.2c
alyc100 Dec 7, 2020
04b4063
v3.2c
alyc100 Dec 7, 2020
405bbf7
Hive UI Update
alyc100 Dec 8, 2020
ef81528
v1.0 Warmup 4IE
alyc100 Dec 9, 2020
77fa54e
Hive setBoostLength
alyc100 Dec 9, 2020
fcc58b6
Neato new ST UI
alyc100 Dec 9, 2020
f0f6a25
new ST UI
alyc100 Dec 9, 2020
cb20e1a
Tweak to boost length command.
alyc100 Dec 9, 2020
f1d627d
Warmup 4IE boost tweaks
alyc100 Dec 9, 2020
4924383
fix for Warmup device
alyc100 Jan 3, 2021
830ac00
v2.0.3
alyc100 Sep 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added devicetypes/alyc100/auto-charge-resume.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added devicetypes/alyc100/best-pet-hair-cleaning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Binary file added devicetypes/alyc100/empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
/**
* Hive Active Light Colour Tunable
*
* Copyright 2016 Tom Beech / Alex Lee Yuk Cheung
*
* 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.
*
* 30.10.2017 - v3.0 Update Hive Colour Bulb device to support new Hive Beekeeper API
* 1.11.2017 - v3.0b Bug fix. Typo for colour change HTTP request.
*/

metadata {
definition (name: "Hive Active Light Colour Tuneable", namespace: "alyc100", author: "Tom Beech") {
capability "Polling"
capability "Switch"
capability "Switch Level"
capability "Refresh"
capability "Color Control"
capability "Color Temperature"
capability "Actuator"
capability "Sensor"

attribute "colorName", "string"
}

simulator {
}

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:"http://hosted.lifx.co/smartthings/v1/196xOn.png", backgroundColor:"#79b821", nextState:"turningOff"
attributeState "off", label:'${name}', action:"switch.on", icon:"http://hosted.lifx.co/smartthings/v1/196xOff.png", backgroundColor:"#ffffff", nextState:"turningOn"
attributeState "turningOn", label:'${name}', action:"switch.off", icon:"http://hosted.lifx.co/smartthings/v1/196xOn.png", backgroundColor:"#fffA62", nextState:"turningOff"
attributeState "turningOff", label:'${name}', action:"switch.on", icon:"http://hosted.lifx.co/smartthings/v1/196xOff.png", backgroundColor:"#fffA62", nextState:"turningOn"
}
tileAttribute ("device.level", key: "SLIDER_CONTROL") {
attributeState "level", action:"switch level.setLevel"
}
tileAttribute ("device.group", key: "SECONDARY_CONTROL") {
attributeState "group", label: '${currentValue}'
}
tileAttribute ("device.color", key: "COLOR_CONTROL") {
attributeState "color", action:"setColor"
}
}

standardTile("refresh", "device.switch", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
}

main(["switch"])
details(["switch", "refresh"])
}
}

//parse events into attributes
def parse(value) {
log.debug "Parsing '${value}' for ${device.deviceNetworkId}"
}

def setColorTemperature(value) {
log.debug "Executing 'setColorTemperature' to ${value}"

def args = ["colourMode":"WHITE","colourTemperature":value]
def resp = parent.apiPOST("/nodes/colourtuneablelight/${device.deviceNetworkId}", args)

if(resp.status == 404) {
// Bulb has reported it is offline, poll for more details
poll()
} else {
sendEvent(name: "colorTemperature", value: value)
sendEvent(name: "hue", value: 0)
sendEvent(name: "saturation", value: 0)
}
}

def setLevel(double value) {

def val = String.format("%.0f", value)

log.debug "Setting level to $val"

def onOff = "ON"
if(val == 0) {
onOff = "OFF"
}

def args = [status: onOff, brightness: val]
def resp = parent.apiPOST("/nodes/colourtuneablelight/${device.deviceNetworkId}", args)

if(resp.status == 404) {
// Bulb has reported it is offline, poll for more details
poll()
} else {
sendEvent(name: 'level', value: val)
sendEvent(name: 'switch', value: onOff.toLowerCase())
log.debug "Level set"
}
}

def setSaturation(percent) {
log.debug "setSaturation($percent)"
setColor(saturation: percent)
}

def setHue(value) {
log.debug "setHue($value)"
setColor(hue: value)
}

def setColor(value) {
def result = []
log.debug "setColor: ${value}"

def hue = 0
def sat = 0

// If a HEX value was passed, just convert it and set the HSV values
if (value.hex) {
def c = value.hex.findAll(/[0-9a-fA-F]{2}/).collect { Integer.parseInt(it, 16) }

// Set the desired colours
def res = rgbToHSV(c[0],c[1],c[2])

hue = res.hue
sat = res.saturation

// Otherwise, determine which values have been passed and set up the HSV values
} else {
hue = value.hue ?: device.currentValue("hue")
saturation = value.saturation ?: device.currentValue("saturation")
if(hue == null) hue = 13
if(saturation == null) saturation = 13
}

log.debug "Hue: ${hue}"
log.debug "Sat: ${sat}"

// SEND HTTP COMMAND TO SET COLOUR
def args = ["colourMode":"COLOUR","hue":hue, "saturation": sat ]
def resp = parent.apiPOST("/nodes/colourtuneablelight/${device.deviceNetworkId}", args)

if(resp.status == 404) {
// Bulb has reported it is offline, poll for more details
poll()
} else {
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)
if(value.switch) sendEvent(name: "switch", value: value.switch)
}
}

def on() {
def args = [status: "ON"]
def resp = parent.apiPOST("/nodes/colourtuneablelight/${device.deviceNetworkId}", args)

if(resp.status == 404) {
// Bulb has reported it is offline, poll for more details
poll()
} else {
sendEvent(name: 'switch', value: "on")
}
}

def off() {

def args = [status: "OFF"]
def resp = parent.apiPOST("/nodes/colourtuneablelight/${device.deviceNetworkId}", args)

if(resp.status == 404) {
// Bulb has reported it is offline, poll for more details
poll()
} else {
sendEvent(name: 'switch', value: "off")
}
}

def installed() {
log.debug "Executing 'installed'"
}

def refresh() {
poll()
}

def poll() {
log.debug "Executing 'poll'"
def currentDevice = parent.getDeviceStatus(device.deviceNetworkId)
if (currentDevice == []) {
return []
}
log.debug "$device.name status: $currentDevice"
def state = currentDevice.state.status
def temperature = currentDevice.state.colourTemperature
def brightness = currentDevice.state.brightness
def presence = currentDevice.props.online
def hsvHue = currentDevice.state.hue
def hsvSat = currentDevice.state.saturation
def hsvValue = currentDevice.state.value


//brightness = String.format("%.0f", brightness)
//temperature = String.format("%.0f", temperature)

log.debug "State: $state"
log.debug "Temperature: $temperature"
log.debug "Brightness: $brightness"
log.debug "Presence: $presence"
log.debug "HSV (Hue): $hsvHue"
log.debug "HSV (Sat): $hsvSat"

if(presence == "ABSENT") {
// Bulb is not present (i.e. turned off at the switch or removed)
sendEvent(name: 'switch', value: "off")
} else {
sendEvent(name: 'switch', value: state.toLowerCase())
}

sendEvent(name: 'level', value: brightness)
sendEvent(name: "hue", value: hsvHue)
sendEvent(name: "saturation", value: hsvSat)

return;
}

def rgbToHSV(r, g, b) {

double h, s, v;

double min, max, delta;

min = Math.min(Math.min(r, g), b);
max = Math.max(Math.max(r, g), b);

// V
v = max;

delta = max - min;

// S
if( max != 0 )
s = delta / max;
else {
s = 0;
h = -1;
return [hue: h, saturation: s * 100, value: v]
}

// H
if( r == max )
h = ( g - b ) / delta; // between yellow & magenta
else if( g == max )
h = 2 + ( b - r ) / delta; // between cyan & yellow
else
h = 4 + ( r - g ) / delta; // between magenta & cyan

h *= 60; // degrees

if( h < 0 )
h += 360;

[hue: h, saturation: s * 100, value: v]
}

def huesatToRGB(float hue, float sat) {
while(hue >= 100) hue -= 100
int h = (int)(hue / 100 * 6)
float f = hue / 100 * 6 - h
int p = Math.round(255 * (1 - (sat / 100)))
int q = Math.round(255 * (1 - (sat / 100) * f))
int t = Math.round(255 * (1 - (sat / 100) * (1 - f)))
switch (h) {
case 0: return [255, t, p]
case 1: return [q, 255, p]
case 2: return [p, 255, t]
case 3: return [p, q, 255]
case 4: return [t, p, 255]
case 5: return [255, p, q]
}
}
Loading