Skip to content

Instantly share code, notes, and snippets.

@joshualyon
joshualyon / sharptools-weather-tile-icon-mappings.json
Last active December 22, 2020 16:21
SharpTools Weather Tile Icon Mappings
{
"chanceflurries": {"weatherIcon": "snow-wind"},
"chancerain": {"weatherIcon": "rain"},
"chancesleet": {"weatherIcon": "sleet"},
"chancesnow": {"weatherIcon": "snow"},
"chancetstorms": {"weatherIcon": "thunderstorm"},
"clear": {"weatherIcon": "day-sunny"},
"cloudy": {"weatherIcon": "day-cloudy"},
"flurries": {"weatherIcon": "snow-wind"},
"fog": {"weatherIcon": "day-fog"},
@joshualyon
joshualyon / virtualValues.groovy
Created March 4, 2019 18:05
Virtual Values device driver for Hubitat or SmartThings
/*
Virtual Values
Author: @josh (SharpTools.io)
Description: The Virtual Values device driver exposes a variety of methods which can be used to
set values of specific attributes. These attributes can then be used in other Apps within
Hubitat or in SharpTools.io Dashboards by using Hero Attribute tiles.
This serves as a flexible 'utility' device for setting arbitrary values that you want to use
elsewhere.
@joshualyon
joshualyon / domoticzblinds.groovy
Created March 21, 2019 16:31
Modified Domoticz Blinds device handler to better meet Switch specificiation
/**
* domoticzBlinds
*
* Copyright 2019 Martin Verbeek
*
* 4.0 2018-02-12 Add windowShade capability, fix eodDone
* 4.1 2018-04-05 Introduce configure for all non standard attributes and commands
* 4.2 2018-06-02 Moved EOD processing to SM
* 4.3 2018-06-21 Removed calibrate, moved it to timed session capability
* 4.4 2019-03-16 presetPosition gone as a command for windowshades???? named it in commands
// Developer: josh@sharptools.io
metadata {
definition (name: "Simulated Fan + Switch", namespace: "sharptools/testing", author: "josh") {
capability "Sensor"
capability "Switch"
capability "Fan Control"
capability "Health Check"
command "active"
command "inactive"
// Developer: josh@sharptools.io
metadata {
definition (name: "Simulated Fan", namespace: "sharptools/testing", author: "josh") {
capability "Actuator"
capability "Sensor"
capability "Fan Control"
command "cycleSpeed"
}
}
@joshualyon
joshualyon / virtual-st-fan.groovy
Created July 3, 2019 15:42
Virtual Fan for SmartThings
metadata {
definition(name: "Virtual Fan Controller", namespace: "sharptools-io", author: "josh", ocfDeviceType: "oic.d.fan") {
capability "Switch Level"
capability "Switch"
capability "Fan Speed"
capability "Health Check"
capability "Actuator"
capability "Refresh"
capability "Sensor"
/**
* Simulated Battery
*
* Copyright 2019 josh
*/
metadata {
definition (name: "Simulated Battery", namespace: "sharptools-io", author: "josh", cstHandler: true) {
capability "Battery"
capability "Sensor"
capability "Actuator"
@joshualyon
joshualyon / app_server_proxy_fix.md
Last active August 2, 2019 16:05
dev_appserver fix for external reverse proxy hosts for Task Queues

dev_appserver fix for Task Queues behind proxy like ngrok

By default, it seems dev_appserver Task Queue handling does not work well behind a reverse proxy, like ngrok. This patch allows requests that don't match a host to still be processed.

Specifically, commenting out the raising of the ModuleDoesNotExistError and instead returning None for the _module and inst variables so the task can still be processed.

This is around line 816 in _resolve_target() in dispatcher.py in the 1.9.86 gcloud app Python Extensions:

\platform\google_appengine\tools\devappserver2\dispatcher.py
@joshualyon
joshualyon / timedSession.groovy
Created October 4, 2019 22:16
Timed Session Driver Example
/*
Timed Session Example
Author: @josh (SharpTools.io)
Just a stubbed driver to test adding a switch attribute without the Switch capability.
Doesn't actually full implement the Timed Session spec as it's just to test the sessionStatus and switch events.
*/
metadata {
definition (name: "Timed Session", namespace: "sharptools-io", author: "Josh Lyon") {
/**
* Copyright 2017 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