12 Commits

Author SHA1 Message Date
jct
764b18e539 Moved temp sensor to seperate pin (#3)
Some checks reported errors
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build was killed
2019-11-27 09:19:23 +00:00
jct
e5a64c13ed Renamed drone secret
All checks were successful
continuous-integration/drone/push Build is passing
2019-10-25 08:09:41 +00:00
338c90fb8e Moved gitea key into drone secret
All checks were successful
continuous-integration/drone/push Build is passing
2019-10-08 15:35:21 +02:00
85c57daf91 Merge branch 'master' of https://code.jcktrue.dk/jct/deskcontrol
All checks were successful
continuous-integration/drone/push Build is passing
2019-10-08 14:24:23 +02:00
jct
5cb5300d15 Merge branch 'temp_sensor' of jct/deskcontrol into master
All checks were successful
continuous-integration/drone/push Build is passing
2019-09-22 17:52:02 +00:00
d5ffd87f90 Increased interval
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2019-09-22 19:50:23 +02:00
0cff4d019a Added DHT11 sensoring
All checks were successful
continuous-integration/drone/push Build is passing
2019-09-22 16:34:06 +02:00
10b337d43f SPIFFS image
All checks were successful
continuous-integration/drone/push Build is passing
2019-09-22 13:15:47 +02:00
d19bd16561 Unneeded nodemcuv2 build
All checks were successful
continuous-integration/drone/push Build is passing
2019-09-22 13:11:21 +02:00
36ce6f976b Release version
All checks were successful
continuous-integration/drone/tag Build is passing
2019-09-03 15:47:04 +02:00
a4c2d49fb0 Sliming down and simplifying
All checks were successful
continuous-integration/drone/push Build is passing
2019-09-03 15:40:12 +02:00
bad20a7f58 Cleanup and removal of Syslog usage
All checks were successful
continuous-integration/drone/push Build is passing
2019-08-16 20:39:27 +02:00
9 changed files with 233 additions and 51 deletions

View File

@ -16,10 +16,10 @@ steps:
- name: release - name: release
image: plugins/gitea-release image: plugins/gitea-release
settings: settings:
api_key: a7f3afc9f77e721951e48b4af66d7565700b7a2e api_key:
from_secret: DRONE_ACCESS_TOKEN
base_url: https://code.jcktrue.dk base_url: https://code.jcktrue.dk
files: files:
- .pio/build/nodemcu/firmware.bin - .pio/build/nodemcu/firmware.bin
- .pio/build/nodemcu/firmware.elf
when: when:
event: tag event: tag

BIN
.vscode/.BROWSE.C_CPP.DB vendored Normal file

Binary file not shown.

129
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,129 @@
{
"configurations": [
{
"name": "!!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags"
},
{
"name": "Win32",
"includePath": [
"c:/Users/furyf/Dev/deskcontrol/src",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/DHT sensor library for ESPx_ID2029",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/Homie/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266mDNS/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPClient/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/Ticker",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/DNSServer/src",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/ESP Async WebServer_ID306/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/Hash/src",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/Bounce2_ID1106/src",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/AsyncMqttClient_ID346/src",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/ESPAsyncTCP_ID305/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/ArduinoJson_ID64/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/tools/sdk/libc/xtensa-lx106-elf/include",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/cores/esp8266",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip2/include",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ArduinoOTA",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/EEPROM",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266AVRISP/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPUpdateServer/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266LLMNR",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266NetBIOS",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266SSDP",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266SdFat/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WebServer/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFiMesh/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266httpUpdate/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/Ethernet/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/GDBStub/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/SD/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/SDFS/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/SPI",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/SPISlave/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/Servo/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/SoftwareSerial/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/TFT_Touch_Shield_V2",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/Wire",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/esp8266/src",
"C:/Users/furyf/.platformio/packages/tool-unity",
""
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "${workspaceRoot}/.vscode/.browse.c_cpp.db",
"path": [
"c:/Users/furyf/Dev/deskcontrol/src",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/DHT sensor library for ESPx_ID2029",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/Homie/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266mDNS/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPClient/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/Ticker",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/DNSServer/src",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/ESP Async WebServer_ID306/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/Hash/src",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/Bounce2_ID1106/src",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/AsyncMqttClient_ID346/src",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/ESPAsyncTCP_ID305/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src",
"c:/Users/furyf/Dev/deskcontrol/.pio/libdeps/nodemcu/ArduinoJson_ID64/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/tools/sdk/libc/xtensa-lx106-elf/include",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/cores/esp8266",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip2/include",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ArduinoOTA",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/EEPROM",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266AVRISP/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPUpdateServer/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266LLMNR",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266NetBIOS",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266SSDP",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266SdFat/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WebServer/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFiMesh/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266httpUpdate/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/Ethernet/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/GDBStub/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/SD/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/SDFS/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/SPI",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/SPISlave/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/Servo/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/SoftwareSerial/src",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/TFT_Touch_Shield_V2",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/Wire",
"C:/Users/furyf/.platformio/packages/framework-arduinoespressif8266/libraries/esp8266/src",
"C:/Users/furyf/.platformio/packages/tool-unity",
""
]
},
"defines": [
"PLATFORMIO=40000",
"ESP8266",
"ARDUINO_ARCH_ESP8266",
"ARDUINO_ESP8266_NODEMCU",
"PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY",
"F_CPU=80000000L",
"__ets__",
"ICACHE_FLASH",
"ARDUINO=10805",
"ARDUINO_BOARD=\"PLATFORMIO_NODEMCU\"",
"FLASHMODE_QIO",
"LWIP_OPEN_SRC",
"NONOSDK221=1",
"TCP_MSS=536",
"LWIP_FEATURES=1",
"LWIP_IPV6=0",
"VTABLES_IN_FLASH",
""
],
"intelliSenseMode": "clang-x64",
"cStandard": "c99",
"cppStandard": "c++11",
"compilerPath": "\"C:/Users/furyf/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-gcc.exe\" -mlongcalls -mtext-section-literals"
}
],
"version": 4
}

7
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}

32
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,32 @@
// AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY
// PIO Unified Debugger
//
// Documentation: https://docs.platformio.org/page/plus/debugging.html
// Configuration: https://docs.platformio.org/page/projectconf/section_env_debug.html
{
"version": "0.2.0",
"configurations": [
{
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug",
"executable": "c:/Users/furyf/Dev/deskcontrol/.pio/build/nodemcu/firmware.elf",
"toolchainBinDir": "C:/Users/furyf/.platformio/packages/toolchain-xtensa/bin",
"preLaunchTask": {
"type": "PlatformIO",
"task": "Pre-Debug"
},
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug (skip Pre-Debug)",
"executable": "c:/Users/furyf/Dev/deskcontrol/.pio/build/nodemcu/firmware.elf",
"toolchainBinDir": "C:/Users/furyf/.platformio/packages/toolchain-xtensa/bin",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

6
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"terminal.integrated.env.windows": {
"PATH": "C:\\Program Files (x86)\\STMicroelectronics\\st_toolset\\asm;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\STMicroelectronics\\STM32 ST-LINK Utility\\ST-LINK Utility;C:\\Program Files\\doxygen\\bin;C:\\Program Files (x86)\\QuickTime\\QTSystem\\;C:\\Users\\furyf\\scoop\\apps\\ruby\\current\\gems\\bin;C:\\Users\\furyf\\scoop\\apps\\ruby\\current\\bin;C:\\Users\\furyf\\scoop\\apps\\nodejs\\current\\bin;C:\\Users\\furyf\\scoop\\apps\\nodejs\\current;C:\\Users\\furyf\\go\\bin;C:\\Users\\furyf\\scoop\\apps\\composer\\current\\home\\vendor\\bin;C:\\Users\\furyf\\scoop\\apps\\python27\\current\\scripts;C:\\Users\\furyf\\scoop\\apps\\latex\\current\\texmfs\\install\\miktex\\bin;C:\\Users\\furyf\\scoop\\apps\\gcc\\current\\bin;C:\\Users\\furyf\\scoop\\apps\\nmap\\current\\bin;C:\\Users\\furyf\\AppData\\Local\\Programs\\Python\\Launcher\\;C:\\Users\\furyf\\scoop\\shims;C:\\Users\\furyf\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\furyf\\scoop\\apps\\msys\\current\\bin;C:\\Users\\furyf\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\System\\PATH;%USERPROFILE%\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files (x86)\\STMicroelectronics\\st_toolset\\asm;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\STMicroelectronics\\STM32 ST-LINK Utility\\ST-LINK Utility;C:\\Program Files\\doxygen\\bin;C:\\Program Files (x86)\\QuickTime\\QTSystem\\;C:\\Users\\furyf\\scoop\\apps\\ruby\\current\\gems\\bin;C:\\Users\\furyf\\scoop\\apps\\ruby\\current\\bin;C:\\Users\\furyf\\scoop\\apps\\nodejs\\current\\bin;C:\\Users\\furyf\\scoop\\apps\\nodejs\\current;C:\\Users\\furyf\\go\\bin;C:\\Users\\furyf\\scoop\\apps\\composer\\current\\home\\vendor\\bin;C:\\Users\\furyf\\scoop\\apps\\python27\\current\\scripts;C:\\Users\\furyf\\scoop\\apps\\latex\\current\\texmfs\\install\\miktex\\bin;C:\\Users\\furyf\\scoop\\apps\\gcc\\current\\bin;C:\\Users\\furyf\\scoop\\apps\\nmap\\current\\bin;C:\\Users\\furyf\\AppData\\Local\\Programs\\Python\\Launcher\\;C:\\Users\\furyf\\scoop\\shims;C:\\Users\\furyf\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\furyf\\scoop\\apps\\msys\\current\\bin;C:\\Users\\furyf\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\System\\PATH;%USERPROFILE%\\AppData\\Local\\Microsoft\\WindowsApps",
"PLATFORMIO_CALLER": "vscode"
}
}

View File

@ -0,0 +1,15 @@
{
"name": "deskcontrol",
"wifi": {
"ssid": "<SSID>",
"password": "<PASS>"
},
"mqtt": {
"host": "<Domain>",
"port": 1883,
"auth": false
},
"ota": {
"enabled": true
}
}

View File

@ -17,11 +17,15 @@
# Automatic targets - enable auto-uploading # Automatic targets - enable auto-uploading
# targets = upload # targets = upload
[env:nodemcu] [env]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = nodemcu
upload_speed=921600 upload_speed=921600
build_flags = -D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY build_flags = -D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
lib_deps = https://github.com/homieiot/homie-esp8266.git#develop-v3, Syslog lib_deps = https://github.com/homieiot/homie-esp8266.git#develop-v3, DHT sensor library for ESPx
[env:nodemcu]
board = nodemcu

View File

@ -1,14 +1,17 @@
#include <Homie.h> #include <Homie.h>
#include <Syslog.h>
#include <WiFiUdp.h> #include "DHTesp.h"
WiFiUDP udpClient; DHTesp dht;
Syslog syslog(udpClient, SYSLOG_PROTO_IETF); const int TEMPERATURE_INTERVAL = 60;
unsigned long lastTemperatureSent = 0;
const int PIN_RELAY = D1; const int PIN_RELAY = D1;
#define OUTPUT_SET(x) digitalWrite(PIN_RELAY, x ? LOW : HIGH); const int PIN_DHT11 = D2;
#define OUTPUT_SET(x) digitalWrite(PIN_RELAY, x ? LOW : HIGH)
unsigned int timer = 0; unsigned int timer = 0;
unsigned int next_timer_update = 0; unsigned int next_timer_update = 0;
HomieNode powerNode("power", "Power", "switch"); HomieNode powerNode("power", "Power", "switch");
HomieNode temperatureNode("temperature", "Temperature", "temperature");
bool powerStateHandler(const HomieRange& range, const String& value) { bool powerStateHandler(const HomieRange& range, const String& value) {
if (value != "on" && value != "off") return false; if (value != "on" && value != "off") return false;
@ -46,19 +49,23 @@ void setupHandler() {
OUTPUT_SET(false); OUTPUT_SET(false);
powerNode.setProperty("state").send("off"); powerNode.setProperty("state").send("off");
powerNode.setProperty("timer").send("0"); powerNode.setProperty("timer").send("0");
dht.setup(PIN_DHT11, DHTesp::DHT11); // Connect DHT sensor to GPIO 17
} }
void loopHandler() { void loopHandler() {
if(timer) if(timer)
{ {
if(timer < millis()) if(timer < millis())
{ { //Timer has expired. (Ignore the wraparound...)
timer = 0; timer = 0;
OUTPUT_SET(false); OUTPUT_SET(false);
powerNode.setProperty("timer").send("0"); powerNode.setProperty("timer").send("0");
powerNode.setProperty("state").send("off"); powerNode.setProperty("state").send("off");
} }
if(millis() > next_timer_update) {
if(next_timer_update && millis() > next_timer_update) {
next_timer_update = millis() + 60*1000; next_timer_update = millis() + 60*1000;
unsigned int time_remaining = timer - millis(); unsigned int time_remaining = timer - millis();
unsigned int min_left = time_remaining / (60*1000); unsigned int min_left = time_remaining / (60*1000);
@ -66,52 +73,34 @@ void loopHandler() {
} }
} }
}
void onHomieEvent(const HomieEvent& event) { if (millis() - lastTemperatureSent >= TEMPERATURE_INTERVAL * 1000UL || lastTemperatureSent == 0)
switch(event.type) { {
case HomieEventType::OTA_FAILED: float humidity = dht.getHumidity();
syslog.log(LOG_INFO, "OTA failed"); float temperature = dht.getTemperature();
// Do whatever you want when OTA is failed
break; Homie.getLogger() << "Temperature: " << temperature << "°C " << humidity << "% Humidty" << endl;
case HomieEventType::OTA_SUCCESSFUL: temperatureNode.setProperty("temperature").send(String(temperature));
syslog.log(LOG_INFO, "OTA completed"); temperatureNode.setProperty("humidity").send(String(humidity));
break; lastTemperatureSent = millis();
case HomieEventType::WIFI_CONNECTED:
// Do whatever you want when Wi-Fi is connected in normal mode
syslog.deviceHostname(Homie.getConfiguration().name);
syslog.appName("deskcontrol");
syslog.defaultPriority(LOG_ERR);
syslog.log(LOG_INFO, "WiFi Connected, software version: 1.0");
break;
case HomieEventType::MQTT_READY:
syslog.log(LOG_INFO, "MQTT connected");
break;
case HomieEventType::MQTT_DISCONNECTED:
syslog.log(LOG_INFO, "MQTT disconnected");
break;
default:
break;
} }
} }
void setup() { void setup() {
syslog.server("192.168.1.100", 514);
Serial.begin(115200); Serial.begin(115200);
Serial << endl << endl; Homie_setFirmware("deskcontrol", "0.3.2");
Serial << "Firmware 0.0.1" << endl;
Serial << endl << endl;
Homie_setFirmware("deskcontrol", "1.0.0");
Homie_setBrand("FuryFire");
Homie.disableResetTrigger();
powerNode.advertise("state").settable(powerStateHandler); powerNode.advertise("state").settable(powerStateHandler);
powerNode.advertise("timer").settable(powerTimerHandler); powerNode.advertise("timer").settable(powerTimerHandler);
temperatureNode.advertise("humidity");
temperatureNode.advertise("temperature");
Homie.setSetupFunction(setupHandler); Homie.setSetupFunction(setupHandler);
Homie.onEvent(onHomieEvent); // before Homie.setup()
Homie.setLoopFunction(loopHandler); Homie.setLoopFunction(loopHandler);
Homie.setup(); Homie.setup();
} }