View smoke.yaml
This file contains 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
binary_sensor: | |
- platform: mqtt | |
name: "Room1 Smoke Detector" | |
payload_on: "0x111111" | |
payload_off: "0x111111off" | |
device_class: smoke | |
state_topic: "tele/tasmota_rf/RESULT" | |
value_template: '{{ value_json.RfReceived.Data }}' | |
- platform: mqtt | |
name: "Room2 Smoke Detector" |
View aws_ebs_leader.js
This file contains 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
// based on https://gist.github.com/tony-gutierrez/de5b304fd042f6140eb61a31d0ff92d5 | |
async function isLeader() { | |
try { | |
// get APIs | |
var elasticbeanstalk = new AWS.ElasticBeanstalk(); | |
var ec2 = new AWS.EC2(); | |
var metadata = new AWS.MetadataService(); | |
// get ec2 instance id | |
const request = new Promise( (resolve, reject) => { // MetadataService.request has no support for promise, make one ourselves | |
metadata.request('/latest/meta-data/instance-id', (err, InstanceId) => { |