This now lives on Whistlr.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Copyright 2020 Google LLC. | |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {!Element=} | |
* @return {!Array<!Element>} containing focused element, deepest first | |
*/ | |
function getActive(t = document.activeElement || document.body) { | |
if (t.activeElement) { | |
t = t.activeElement; | |
} | |
if (t.shadowRoot) { | |
return [...getActive(t.shadowRoot), t]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is now a library: | |
// ... source on GitHub: https://github.com/samthor/viz-observer | |
// ... package on npm: https://www.npmjs.com/package/viz-observer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If the device is already on a network and you need to change it, you can load: | |
// http://<device_ip>/common/get_wifi_setting | |
// It'll give you a result like... ret=OK,ssid=OldSSIDHere,security=mixed,key=%6e%65%76%65%72%67%6f%6e%6e%61%67%69%76%65%79%6f%75%75%70 | |
// To update the same data, open that page and in the console, run this (modify as needed): | |
const ssid = 'NewSSIDHere'; | |
const key = 'nevergonnagiveyouup'; | |
const encoded = Array.from(key).map((c) => '%' + c.charCodeAt(0).toString(16).padStart(2, '0')).join(''); |
This is notes for anyone who is interacting with (in Australia at least) Clipsal-branded smart switches that operate over BLE. (They also come with a ZigBee certification document, but it seems like it was never enabled.)
They have a couple of interesting UUIDs (these are here for y'all searching for them):
-
Control service,
720a9080-9c7d-11e5-a7e3-0002a5d5c51b
- State characteristic (i.e., switch on/off),
720a9081-9c7d-11e5-a7e3-0002a5d5c51b
- Level characteristic (i.e., brightness),
720a9082-9c7d-11e5-a7e3-0002a5d5c51b
- State characteristic (i.e., switch on/off),
-
Command service,
720a7080-9c7d-11e5-a7e3-0002a5d5c51b
-
Request characteristic,
720a7081-9c7d-11e5-a7e3-0002a5d5c51b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is part of the blog post here: https://whistlr.info/2022/abortcontroller-is-your-friend/ | |
// ...and can be used to detect/polyfill the `signal` argument to addEventListener. | |
// | |
// Note that at writing, 86%+ of active browsers already support it: | |
// https://caniuse.com/mdn-api_eventtarget_addeventlistener_options_parameter_options_signal_parameter | |
// ...but that 92% of browsers support `AbortController` and signal. | |
// | |
// So there's 6% of total browsers which will fail silently when adding the `signal` argument. | |
// Eyeballing it, this is mostly Safari 11-15 and Chrome 66-90. These snippets can help with those targets. | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0eNrNVV1uozAQvko1z1AJ8gPhBH3fvlWVZfA0sUpsZA/RRhEH2Fv0bD3J2iZByTZpXakPKyHAzMw3M998xgeo2x47IxVBdQDZaGWhejqAlWvFW/+N9h1CBZJwCwkovvUrw2ULQwJSCfwNVTY8J4CKJEkc48Niz1S/rdE4hynSkotdbygNEAl02roorXwqh5RnRQJ7qOaFQxfSYDMa8yH5AJrHg66iQWfRoHkWDTqPB51Fgy7iQRfRoMuLEadHGVwb0/0RtLxfXMI6CCcjMrplNW74Tmrjoxppml4Sa1ptkZ309cJbi8lkNMjFZCPTO5NBwXRPXU/sgyh30lAf6jsxgangau06cTVp419vBgdFO7e1QVRfeA2hJzW2aL0587cQeq53KaAqhudhuEJtMVXpx6VSS7r7RKurf4b1BataiQnmRRr7bbb81ifu/wMh1bbjhpNPAu9/3oLDMRUqXrfIhLT+eRqTRSUYaRZ6m+YaVsx32qGIqSh4pI/fY3x5xrZfl34CriTiIyMAV8ZRRio9z/4HpZ/E+iOa/kwIP6H01SW1zSbI/SbBs9sE+3Ml9FSdHVQJtLxG1xD8It68orl7wLZziRPYobHjdimzebHKi8XSXfNyGP4Cjmpeag== |
OlderNewer