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
/* Hello World Example | |
This example code is in the Public Domain (or CC0 licensed, at your option.) | |
Unless required by applicable law or agreed to in writing, this | |
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
CONDITIONS OF ANY KIND, either express or implied. | |
*/ | |
#include <stdio.h> | |
#include <math.h> |
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" |
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) => { |