homebridge-weatherflow-tempest
Version:
Exposes WeatherFlow Tempest Station data as Temperature Sensors, Light Sensors, Humidity Sensors and Fan Sensors (for Wind Speed).
60 lines (46 loc) • 1.26 kB
text/typescript
let count = 0;
function socketDataRecieved(): Promise<void> {
console.log('Waiting for first local broadcast. This could take up to 60 seconds...');
return new Promise((resolve) => {
const intervalId = setInterval(() => {
if (count === 3) {
clearInterval(intervalId); // Clear the interval after one execution
console.log('Local broadcast recieved.');
resolve();
}
count++;
}, 1000);
});
}
// async function socketDataRecieved() {
// console.log('Waiting for first local broadcast. This could take up to 60 seconds...');
// const socket_interval = setInterval( async () => {
// if (count === 3) {
// clearInterval(socket_interval);
// console.log('Local broadcast recieved.');
// return true;
// }
// count++;
// }, 1000);
// }
function test() {
// // await socketDataRecieved();
// const config = {
// test: 1,
// };
// if(!('test1' in config)) {
// config['test1'] = true;
// }
// console.log(config);
let tick = 0;
setInterval( () => {
tick++;
if (tick % 5 === 0) {
tick = 0;
console.log('')
console.log(0); // CONTACT_DETECTED
}
console.log(1); // CONTACT_NOT_DETECTED
}, 1000);
}
test();