Skip to content

Instantly share code, notes, and snippets.

const dnspacket = require('dns-packet');
var mdns = require('./')({
multicast: true,
ttl: 1,
});
// lets query for an A record for 'brunhilde.local'
// { name: '_lutron._tcp.local', type: 'PTR', class: 'IN' }
const _id = Math.floor(Math.random() * (65535 - 1 + 1)) + 1;
console.log('ID for match: ', _id);
sources:
# Static type
- static:
plugs:
- DemoPlug:
mac: 53:75:31:f8:3a:8c
max_watts: 5
alias: "Demo Plug"
@cbpowell
cbpowell / README.md
Created July 31, 2020 14:00
SenseLink - README Snapshot 7/31/2020

SenseLink

A tool to inform a Sense Home Energy Monitor of known energy usage in your home, written in Python. A Docker image is also provided!

About

SenseLink is a tool that emulates the energy monitoring functionality of TP-Link Kasa HS110 Smart Plugs, and allows you to report "custom" power usage to your Sense Home Energy Monitor based on other parameters.

SenseLink can emulate multiple plugs at the same time, and can report:

  1. Static/unchanging power usage
  2. Dynamic power usage based on other parameters through API integrations (e.g. a dimmer brightness value)
- (void)refreshSubLabels:(NSArray *)subLabels {
for (UILabel *sl in subLabels) {
sl.attributedText = self.attributedText;
sl.backgroundColor = self.backgroundColor;
sl.shadowColor = self.shadowColor;
sl.shadowOffset = self.shadowOffset;
sl.textAlignment = NSTextAlignmentLeft;
sl.lineBreakMode = NSLineBreakByTruncatingTail; // Added line to set lineBreakMode, AFTER setting the attributed string
}
}
// Modification at line #399 of MarqueeLabel.m (https://github.com/cbpowell/MarqueeLabel/blob/master/MarqueeLabel.m#L399)
//UILabel *secondSubLabel = [[UILabel alloc] initWithFrame:CGRectOffset(self.homeLabelFrame, -awayLabelOffset, 0.0f)];
CGRect secondFrame = CGRectOffset(self.homeLabelFrame, -awayLabelOffset, 0.0f);
secondFrame.size = self.bounds.size; // adjust size to match the "outer" MarqueeLabel
UILabel *secondSubLabel = [[UILabel alloc] initWithFrame:secondFrame];