Skip to content

Instantly share code, notes, and snippets.

@joshualyon
joshualyon / InternationalClock.html
Created Sep 12, 2022
Basic International Clock for SharpTools
View InternationalClock.html
<!-- Do not edit below -->
<script type="application/json" id="tile-settings">
{
"schema": "0.1.0",
"settings": [
{
"name": "timezone",
"label": "Timezone (IANA format)",
"type": "STRING",
"default": "America/Chicago"
@joshualyon
joshualyon / openWeatherTile.html
Last active Jul 5, 2022
Open Weather Map POC Tile
View openWeatherTile.html
<script>
/*
The API Key, Latitude, and Longitude are now set in the Tile Settings
when you edit an individual tile.
You can also adjust the setting here instead and it will apply as your
base setting across ALL instances of this tile unless explicitly
overridden in an individual tile's settings
*/
var API_KEY = ''; //this is set in tile settings now
@joshualyon
joshualyon / svgTechnicalProofHubitat.groovy
Last active May 15, 2020
Technical Proof of Concept rendering a dynamic SVG directly to the browser from Hubitat
View svgTechnicalProofHubitat.groovy
/**
* SharpTools SVG Rendering Technical Proof of Concept for Hubitat
* Author: Josh Lyon (support@sharptools.io)
* Version: See getVersionMap()
*/
/*
Additional information can be found at:
https://community.sharptools.io/t/best-approach-for-irrigation-schedule-tile/3215/14?u=josh
*/
@joshualyon
joshualyon / simulated-illuminance.groovy
Created Apr 18, 2020
Simulated Illuminance (with Switch Mappings)
View simulated-illuminance.groovy
metadata {
definition (name: "Simulated Illuminance Sensor", namespace: "sharptools-io", author: "Josh") {
capability "Illuminance Measurement"
capability "Switch"
capability "Switch Level"
capability "Sensor"
command "setLux"
@joshualyon
joshualyon / traefik-snippet.toml
Created Mar 29, 2020
Example snippet of traefik configuration file
View traefik-snippet.toml
defaultEntryPoints = ["http", "https"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[[entryPoints.https.tls.certificates]]
certFile = """-----BEGIN CERTIFICATE-----
MY-SSL-CERT-FILE-HERE
View virtualMomentarySwitch.groovy
/**
* 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
View evohome-heating-zone.groovy
/**
* Copyright 2016 David Lomas (codersaur)
*
* Name: Evohome Heating Zone
*
* Author: David Lomas (codersaur)
*
* Date: 2016-04-08
*
* Version: 0.09
View simulatedHeatingThermostat.groovy
/**
* 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
@joshualyon
joshualyon / timedSession.groovy
Created Oct 4, 2019
Timed Session Driver Example
View timedSession.groovy
/*
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") {
@joshualyon
joshualyon / app_server_proxy_fix.md
Last active Aug 2, 2019
dev_appserver fix for external reverse proxy hosts for Task Queues
View app_server_proxy_fix.md

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