Skip to content

Instantly share code, notes, and snippets.

View JohnMcLear's full-sized avatar
🌴
On vacation

John McLear JohnMcLear

🌴
On vacation
View GitHub Profile
@JohnMcLear
JohnMcLear / configuration.yaml
Last active October 3, 2024 15:15
Logic I use to get egg count, I didn't want to make a full plugin for this and wanted to use as much debuggable CLI logic as possible so it is portable.
# prereq = imagemagick - install using apk add --update imagemagick
# place this in configuration.xml then create an automation to do each activity in order with a delay of 10 seconds or so
# I like to use switches instead of shell_command but you could use shell_command if you want.
command_line:
# get the image from the camera, we don't use the snapshot here because snapshot doesn't provide all pixels
# your camera probably has a HTTP API for retrieving a snapshot so just look it up online and modify the below url
- switch:
name: get_nesting_box_chicken_coop
command_on: 'curl "http://camera1.lan/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=coopcctv&user=username&password=password" -k --output /config/www/tmp/snapshots/nestingbox.jpg'
@JohnMcLear
JohnMcLear / convertPaxton.js
Last active March 14, 2024 14:00
Convert Paxton
const convertPaxton = (uid) => {
if (!uid) uid = "11223344"
const type = 3;
let result = 0n;
let dec = 0n;
// For each digit in 11223344
uid.split('').forEach(
(digit, index) => {
dec = (getParity(BigInt(digit)) << 4n) + BigInt(digit); // getParity does some funky shit and returns the new BigInt.
// 4n is Numeric 4 but represented in a way that it can iterate with BitWise operators
@JohnMcLear
JohnMcLear / paxton-covert.html
Created March 13, 2024 14:30 — forked from natmchugh/paxton-covert.html
Convert Paxton Fob Data to ids and vice versa
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Paxton Fob converter</title>
<style>
table, th, td, div {
border: 1px solid black;
}
@JohnMcLear
JohnMcLear / README.md
Created February 27, 2024 19:09
D-Logic uFR NFC device in Field with ESPHome - Quick and Hacky method using HTTP POST

ESPHome config

switch:
  - platform: gpio
    id: nfc
    pin: GPIO10
    name: "nfc"
@JohnMcLear
JohnMcLear / MiboxerFUTC02Z.js
Created March 23, 2022 10:36
Miboxerr zigbee2mqtt external converter addresses TS0505B model and TZ3210 vendor firmware requirements
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const ota = require('zigbee-herdsman-converters/lib/ota');
const extend = require('zigbee-herdsman-converters/lib/extend');
const utils = require('zigbee-herdsman-converters/lib/utils');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const e = exposes.presets;
const gledoptoExtend = {
light_onoff_brightness: (options={}) => ({
blueprint:
name: ZHA - Aqara Wireless Remote Switch (Double Rocker 86sw2)
description: Automate your Xiaomi Aqara Wireless Remote Switch (Double Rocker) (lumi.sensor_86sw2 Version) using ZHA events.
domain: automation
input:
aqara_mini_switch:
name: Select the Aqara Wireless Remote Switch (Double Rocker)
description: Aqara Wireless Remote Switch (Double Rocker)
selector:
device:
blueprint:
name: ZHA - Aqara Wireless Remote Switch (Double Rocker 86sw2)
description: Automate your Xiaomi Aqara Wireless Remote Switch (Double Rocker) (lumi.sensor_86sw2 Version) using ZHA events.
domain: automation
input:
aqara_mini_switch:
name: Select the Aqara Wireless Remote Switch (Double Rocker)
description: Aqara Wireless Remote Switch (Double Rocker)
selector:
device:
blueprint:
name: ZHA - Aqara Wireless Remote Switch (Double Rocker)
description: Automate your Xiaomi Aqara Wireless Remote Switch (Double Rocker) using ZHA events.
domain: automation
input:
aqara_mini_switch:
name: Select the Aqara Wireless Remote Switch (Double Rocker)
description: Aqara Wireless Remote Switch (Double Rocker)
selector:
device:
blueprint:
name: ZHA - Aqara Wireless Remote Switch (Double Rocker)
description: Automate your Xiaomi Aqara Wireless Remote Switch (Double Rocker) using ZHA events.
domain: automation
input:
aqara_mini_switch:
name: Select the Aqara Wireless Remote Switch (Double Rocker)
description: Aqara Wireless Remote Switch (Double Rocker)
selector:
device:
'use strict';
/**
* This code is mostly from the old Etherpad. Please help us to comment this code.
* This helps other people to understand this code better and helps them to improve it.
* TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED
*/
/**
* Copyright 2009 Google Inc.
*