Skip to content

Instantly share code, notes, and snippets.

View phindmarsh's full-sized avatar

Patrick Hindmarsh phindmarsh

View GitHub Profile
@phindmarsh
phindmarsh / wiser.md
Created June 3, 2021 08:33
PDL/Clipsal Wiser Dimmers in zigbee2mqtt

After a bunch of back and forth and many hours of trial and error, I've finally got a robust way to integrate the Clipsal/PDL Iconic dimmers integrated into Home Assistant via zigbee2mqtt.

I have submitted a PR that adds a zigbee-herdsman-converter that means the dimmers should be recognised automatically by zigbee2mqtt, allowing them to be controlled by Home Assistant like any other compatible device.

As it transpires, this was actually really easy once I worked out what to do,

Keybase proof

I hereby claim:

  • I am phindmarsh on github.
  • I am phindmarsh (https://keybase.io/phindmarsh) on keybase.
  • I have a public key whose fingerprint is 0F55 D5B9 A3B1 83EE CC53 DAAD 80E8 3ADC 9505 4362

To claim this, I am signing this object:

@phindmarsh
phindmarsh / example.py
Created November 3, 2020 09:40
Clipsal/PDL Iconic BLE Dimmer
dimmer = WiserDimmer("XX:XX:XX:XX:C3:E0")
# turn dimmer on at full brightness
dimmer.state_on()
dimmer.level_set(10000)
# set level to 50% (min 0, max 10000)
dimmer.level_set(5000)
print(dimmer.level)
print(dimmer.state) # ON
0482116d34e07db082acbf9878ece09f8e63957dc11f50f42e8697d0fad996bd734f21d71a58a975f4b1cfce21af27a8b17a56dc0700fbada96c57ee3987fb8815
2016/01/22 12:01:36 [ERROR] aws_opsworks_stack.stackname: diffs didn't match
2016/01/22 12:01:36 [ERROR] aws_opsworks_stack.stackname: reason: extra attributes: custom_cookbooks_source.0.ssh_key
2016/01/22 12:01:36 [ERROR] aws_opsworks_stack.stackname: diff one: *terraform.InstanceDiff{Attributes:map[string]*terraform.ResourceAttrDiff{"name":*terraform.ResourceAttrDiff{Old:"project-dev", New:"project-dev S", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}}, Destroy:false, DestroyTainted:false}
2016/01/22 12:01:36 [ERROR] aws_opsworks_stack.stackname: diff two: *terraform.InstanceDiff{Attributes:map[string]*terraform.ResourceAttrDiff{"custom_cookbooks_source.0.ssh_key":*terraform.ResourceAttrDiff{Old:"", New:"-----BEGIN RSA PRIVATE KEY-----\nSNIPPED\n-----END RSA PRIVATE KEY-----\n", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "name":*terraform.ResourceAttrDiff{Old:"project-dev", New:"project-dev S", NewComputed:fa
@phindmarsh
phindmarsh / FacebookGrant.php
Last active July 2, 2016 16:20
Facebook Grant Type
<?php
namespace MyApp\OAuth2\GrantType;
use Facebook\FacebookRequest;
use Facebook\FacebookSession;
use Facebook\GraphUser;
use OAuth2\RequestInterface;
use OAuth2\ResponseInterface;
use OAuth2\Storage\ClientCredentialsInterface;
use OAuth2\Storage\AccessTokenInterface;
@phindmarsh
phindmarsh / composer.json
Last active March 16, 2019 14:46
Composer Install Verbose Output
{
"name": "phindmarsh/composer-test",
"description": "Testcase for checking dependencies bug",
"require": {
"silex/silex": "dev-master#279c773342c6c4d141ebd5236b18518c96505e00"
},
"authors": [
{
"name": "Patrick Hindmarsh",
"email": "patrick@hindmar.sh"
@phindmarsh
phindmarsh / MasqueradeGrant.php
Created April 28, 2015 03:13
Masquerade grant type
<?php
namespace MyApp\OAuth2\GrantType;
use OAuth2\RequestInterface;
use OAuth2\ResponseInterface;
use OAuth2\Storage\ClientCredentialsInterface;
use OAuth2\Storage\AccessTokenInterface;
@phindmarsh
phindmarsh / Vagrantfile
Created September 18, 2014 08:30
NFS issue when using Vagrant and Docker
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider "docker" do |d|
d.vagrant_vagrantfile = "./Vagrantfile.proxy"
end
config.vm.define "container" do |v|
v.vm.provider "docker" do |d|
@phindmarsh
phindmarsh / gist:3838745
Created October 5, 2012 08:26
Photon Patch
@@ -527,20 +527,26 @@ function photon_cache_headers( $expires=63115200 ) {
$image = new Gmagick();
-$parsed = parse_url( $_SERVER['REQUEST_URI'] );
+$parsed = parse_url( substr($_SERVER['REQUEST_URI'], 1) );
$exploded = explode( '/', $_SERVER['REQUEST_URI'] );
$origin_domain = strtolower( $exploded[1] );
$origin_domain_exception = array_key_exists( $origin_domain, $origin_domain_exceptions ) ? $origin_domain_exceptions[$origin_domain] : 0;