Skip to content

Instantly share code, notes, and snippets.

View andrew-codechimp's full-sized avatar

Andrew Jackson andrew-codechimp

View GitHub Profile
@andrew-codechimp
andrew-codechimp / 5060831P7.js
Created November 16, 2022 10:05
Zigbee2MQTT Convertor for Hue Centris Light
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const ota = require('zigbee-herdsman-converters/lib/ota');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const utils = require('zigbee-herdsman-converters/lib/utils');
const e = exposes.presets;
const ea = exposes.access;
@andrew-codechimp
andrew-codechimp / zigbee2mqtt_hue_wall_switch_module.yaml
Last active November 16, 2022 09:57
Home Assistant Blueprint - Zigbee2MQTT Hue Wall Switch Module
blueprint:
name: Zigbee2MQTT Hue Wall Switch Module
description: 'Controller automation for executing any kind of action triggered by a Philips Hue Wall Switch Module.'
domain: automation
input:
switch:
name: Switch
description: The action sensor of the controller to use for the automation.
default: ''
# First get your user id by entering your full @user@domain into
# https://prouser123.me/mastodon-userid-lookup/
# Add the rest sensor into your configuration.yaml, replacing bracketed values as appropriate
sensor:
...
- platform: rest
resource: https://[YOUR MASTODON SERVER]/api/v1/accounts/[YOUR USER ID]
name: "[YOUR NAME] follower count"
@andrew-codechimp
andrew-codechimp / Post Notification.yaml
Created November 2, 2022 09:16
Home Assistant Post Notification Example
alias: Post Notification
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.z2maqarareed01_contact
to: "on"
from: "off"
condition:
- condition: template
//
// DismissableView.swift
//
// Created by Andrew Jackson on 05/09/2020.
//
import SwiftUI
struct DismissableView<Content: View>: View {
@andrew-codechimp
andrew-codechimp / Home Assisant - Transmission All Complete Binary Sensor.yaml
Created August 15, 2020 11:09
A binary sensor for Home Assistant to indicate all torrents completed
binary_sensor:
- platform: template
sensors:
transmission_all_complete:
friendly_name: Transmission All Complete
value_template: "{{ states('sensor.transmission_total_torrents')|float == states('sensor.transmission_completed_torrents')|float }}"
@andrew-codechimp
andrew-codechimp / VS Code Language Snippet Creation
Created August 10, 2020 14:47
VS Code Language Snippet Creation
{
"if": {
"prefix": "if",
"body": "if (${1:condition}) {\n\t$0\n}\n",
"description": "An if statement"
},
"for": {
"prefix": "for",
"body": "for my \\$$1 (@\\$$2) {\n\t$0\n}\n",
"description": "A for statement"
@andrew-codechimp
andrew-codechimp / VS Code Global Snippet Creation
Created August 10, 2020 14:46
VS Code Global Snippet Creation
{
"Slim Log Error": {
"scope": "perl",
"prefix": "slimlogerror",
"body": [
"\\$log->error(\"$1\");"
],
"description": "Slim Error Log"
},
"Slim Setting Title": {
@andrew-codechimp
andrew-codechimp / configuration.yaml
Created March 30, 2020 09:25
Portainer API Home Assistant Command Line Switch Example
...
switch:
- platform: command_line
switches:
portainer_transmission:
command_on: "/bin/bash /config/portainer_transmission_start.sh"
command_off: "/bin/bash /config/portainer_transmission_stop.sh"
command_state: "/bin/bash /config/portainer_transmission_state.sh"
friendly_name: "Portainer Transmission"
...
@andrew-codechimp
andrew-codechimp / arrayunique.swift
Last active February 5, 2020 11:50
[Get unique items in an array based on hash] #Swift
extension Sequence where Iterator.Element: Hashable {
func unique() -> [Iterator.Element] {
// Usage
// print(array.unique()) // prints: [1, 2, 3]
var seen: Set<Iterator.Element> = []
return filter { seen.insert($0).inserted }
}
}