Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1885 lines
63 KiB

8 years ago
8 years ago
6 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
6 years ago
6 years ago
6 years ago
8 years ago
8 years ago
6 years ago
6 years ago
6 years ago
6 years ago
8 years ago
6 years ago
  1. // // //------------------------------------------------------------------------------
  2. // Do not change this file unless you know what you are doing
  3. // Configuration settings are in the settings.h file
  4. //------------------------------------------------------------------------------
  5. //------------------------------------------------------------------------------
  6. // GENERAL
  7. //------------------------------------------------------------------------------
  8. #define DEVICE_NAME MANUFACTURER "_" DEVICE // Concatenate both to get a unique device name
  9. // When defined, ADMIN_PASS must be 8..63 printable ASCII characters. See:
  10. // https://en.wikipedia.org/wiki/Wi-Fi_Protected_Access#Target_users_(authentication_key_distribution)
  11. // https://github.com/xoseperez/espurna/issues/1151
  12. #ifndef ADMIN_PASS
  13. #define ADMIN_PASS "fibonacci" // Default password (WEB, OTA, WIFI SoftAP)
  14. #endif
  15. #ifndef USE_PASSWORD
  16. #define USE_PASSWORD 1 // Insecurity caution! Disabling this will disable password querying completely.
  17. #endif
  18. #ifndef LOOP_DELAY_TIME
  19. #define LOOP_DELAY_TIME 10 // Delay for the main loop, in millis [0-250]
  20. // Recommended minimum is 10, see:
  21. // https://github.com/xoseperez/espurna/issues/1541
  22. // https://github.com/xoseperez/espurna/issues/1631
  23. // https://github.com/esp8266/Arduino/issues/5825
  24. #endif
  25. //------------------------------------------------------------------------------
  26. // DEBUG
  27. //------------------------------------------------------------------------------
  28. // Serial debug log
  29. #ifndef DEBUG_SERIAL_SUPPORT
  30. #define DEBUG_SERIAL_SUPPORT 1 // Enable serial debug log
  31. #endif
  32. #ifndef DEBUG_PORT
  33. #define DEBUG_PORT Serial // Default debugging port
  34. #endif
  35. #ifndef SERIAL_BAUDRATE
  36. #define SERIAL_BAUDRATE 115200 // Default baudrate
  37. #endif
  38. #ifndef DEBUG_ADD_TIMESTAMP
  39. #define DEBUG_ADD_TIMESTAMP 1 // Add timestamp to debug messages
  40. // (in millis overflowing every 1000 seconds)
  41. #endif
  42. // Second serial port (used for RX)
  43. #ifndef SERIAL_RX_ENABLED
  44. #define SERIAL_RX_ENABLED 0 // Secondary serial port for RX
  45. #endif
  46. #ifndef SERIAL_RX_PORT
  47. #define SERIAL_RX_PORT Serial // This setting is usually defined
  48. // in the hardware.h file for those
  49. // boards that require it
  50. #endif
  51. #ifndef SERIAL_RX_BAUDRATE
  52. #define SERIAL_RX_BAUDRATE 115200 // Default baudrate
  53. #endif
  54. //------------------------------------------------------------------------------
  55. // UDP debug log
  56. // To receive the message son the destination computer use nc:
  57. // nc -ul 8113
  58. #ifndef DEBUG_UDP_SUPPORT
  59. #define DEBUG_UDP_SUPPORT 0 // Enable UDP debug log
  60. #endif
  61. #ifndef DEBUG_UDP_IP
  62. #define DEBUG_UDP_IP IPAddress(192, 168, 1, 100)
  63. #endif
  64. #ifndef DEBUG_UDP_PORT
  65. #define DEBUG_UDP_PORT 514
  66. #endif
  67. // If DEBUG_UDP_PORT is set to 514 syslog format is assumed
  68. // (https://tools.ietf.org/html/rfc3164)
  69. // DEBUG_UDP_FAC_PRI is the facility+priority
  70. #define DEBUG_UDP_FAC_PRI (SYSLOG_LOCAL0 | SYSLOG_DEBUG)
  71. //------------------------------------------------------------------------------
  72. #ifndef DEBUG_TELNET_SUPPORT
  73. #define DEBUG_TELNET_SUPPORT 1 // Enable telnet debug log (will only work if TELNET_SUPPORT is also 1)
  74. #endif
  75. //------------------------------------------------------------------------------
  76. #ifndef DEBUG_WEB_SUPPORT
  77. #define DEBUG_WEB_SUPPORT 1 // Enable web debug log (will only work if WEB_SUPPORT is also 1)
  78. #endif
  79. //------------------------------------------------------------------------------
  80. #ifndef DEBUG_LOG_BUFFER_SUPPORT
  81. #define DEBUG_LOG_BUFFER_SUPPORT 1 // Support boot log buffer (1.2Kb)
  82. // Will only work if DEBUG_LOG_BUFFER_ENABLED or runtime setting is also 1
  83. #endif
  84. #ifndef DEBUG_LOG_BUFFER_ENABLED
  85. #define DEBUG_LOG_BUFFER_ENABLED 0 // Disable boot log buffer by default
  86. #endif
  87. #ifndef DEBUG_LOG_BUFFER_SIZE
  88. #define DEBUG_LOG_BUFFER_SIZE 4096 // Store 4 Kb of log strings
  89. // WARNING! Memory is only reclaimed after `debug.buffer` prints the buffer contents
  90. #endif
  91. //------------------------------------------------------------------------------
  92. // TELNET
  93. //------------------------------------------------------------------------------
  94. #ifndef TELNET_SUPPORT
  95. #define TELNET_SUPPORT 1 // Enable telnet support by default (3.34Kb)
  96. #endif
  97. #ifndef TELNET_STA
  98. #define TELNET_STA 0 // By default, disallow connections via STA interface
  99. #endif
  100. #ifndef TELNET_AUTHENTICATION
  101. #define TELNET_AUTHENTICATION 1 // Request password to start telnet session by default
  102. #endif
  103. #ifndef TELNET_PORT
  104. #define TELNET_PORT 23 // Port to listen to telnet clients
  105. #endif
  106. #ifndef TELNET_MAX_CLIENTS
  107. #define TELNET_MAX_CLIENTS 1 // Max number of concurrent telnet clients
  108. #endif
  109. #ifndef TELNET_SERVER
  110. #define TELNET_SERVER TELNET_SERVER_ASYNC // Can be either TELNET_SERVER_ASYNC (using ESPAsyncTCP) or TELNET_SERVER_WIFISERVER (using WiFiServer)
  111. #endif
  112. #ifndef TELNET_SERVER_ASYNC_BUFFERED
  113. #define TELNET_SERVER_ASYNC_BUFFERED 0 // Enable buffered output for telnet server (+1Kb)
  114. // Helps to avoid lost data with lwip2 TCP_MSS=536 option
  115. #endif
  116. // Enable this flag to add support for reverse telnet (+800 bytes)
  117. // This is useful to telnet to a device behind a NAT or firewall
  118. // To use this feature, start a listen server on a publicly reachable host with e.g. "ncat -vlp <port>" and use the MQTT reverse telnet command to connect
  119. #ifndef TELNET_REVERSE_SUPPORT
  120. #define TELNET_REVERSE_SUPPORT 0
  121. #endif
  122. //------------------------------------------------------------------------------
  123. // TERMINAL
  124. //------------------------------------------------------------------------------
  125. #ifndef TERMINAL_SUPPORT
  126. #define TERMINAL_SUPPORT 1 // Enable terminal commands (0.97Kb)
  127. #endif
  128. #define TERMINAL_BUFFER_SIZE 128 // Max size for commands commands
  129. //------------------------------------------------------------------------------
  130. // SYSTEM CHECK
  131. //------------------------------------------------------------------------------
  132. #ifndef SYSTEM_CHECK_ENABLED
  133. #define SYSTEM_CHECK_ENABLED 1 // Enable crash check by default
  134. #endif
  135. #ifndef SYSTEM_CHECK_TIME
  136. #define SYSTEM_CHECK_TIME 60000 // The system is considered stable after these many millis
  137. #endif
  138. #ifndef SYSTEM_CHECK_MAX
  139. #define SYSTEM_CHECK_MAX 5 // After this many crashes on boot
  140. // the system is flagged as unstable
  141. #endif
  142. //------------------------------------------------------------------------------
  143. // EEPROM
  144. //------------------------------------------------------------------------------
  145. #define EEPROM_SIZE SPI_FLASH_SEC_SIZE // EEPROM size in bytes (1 sector = 4096 bytes)
  146. //#define EEPROM_RORATE_SECTORS 2 // Number of sectors to use for EEPROM rotation
  147. // If not defined the firmware will use a number based
  148. // on the number of available sectors
  149. #define EEPROM_RELAY_STATUS 0 // Address for the relay status (1 byte)
  150. #define EEPROM_ENERGY_COUNT 1 // Address for the energy counter (4 bytes)
  151. #define EEPROM_CUSTOM_RESET 5 // Address for the reset reason (1 byte)
  152. #define EEPROM_CRASH_COUNTER 6 // Address for the crash counter (1 byte)
  153. #define EEPROM_MESSAGE_ID 7 // Address for the MQTT message id (4 bytes)
  154. #define EEPROM_ROTATE_DATA 11 // Reserved for the EEPROM_ROTATE library (3 bytes)
  155. #define EEPROM_DATA_END 14 // End of custom EEPROM data block
  156. //------------------------------------------------------------------------------
  157. // THERMOSTAT
  158. //------------------------------------------------------------------------------
  159. #ifndef THERMOSTAT_SUPPORT
  160. #define THERMOSTAT_SUPPORT 0
  161. #endif
  162. #ifndef THERMOSTAT_DISPLAY_SUPPORT
  163. #define THERMOSTAT_DISPLAY_SUPPORT 0
  164. #endif
  165. #define THERMOSTAT_SERVER_LOST_INTERVAL 120000 //server means lost after 2 min from last response
  166. #define THERMOSTAT_REMOTE_TEMP_MAX_WAIT 120 // 2 min
  167. //------------------------------------------------------------------------------
  168. // HEARTBEAT
  169. //------------------------------------------------------------------------------
  170. #define HEARTBEAT_NONE 0 // Never send heartbeat
  171. #define HEARTBEAT_ONCE 1 // Send it only once upon MQTT connection
  172. #define HEARTBEAT_REPEAT 2 // Send it upon MQTT connection and every HEARTBEAT_INTERVAL
  173. #define HEARTBEAT_REPEAT_STATUS 3 // Send it upon MQTT connection and every HEARTBEAT_INTERVAL only STATUS report
  174. // Backwards compatibility check
  175. #if defined(HEARTBEAT_ENABLED) && (HEARTBEAT_ENABLED == 0)
  176. #define HEARTBEAT_MODE HEARTBEAT_NONE
  177. #endif
  178. #ifndef HEARTBEAT_MODE
  179. #define HEARTBEAT_MODE HEARTBEAT_REPEAT
  180. #endif
  181. #ifndef HEARTBEAT_INTERVAL
  182. #define HEARTBEAT_INTERVAL 300 // Interval between heartbeat messages (in sec)
  183. #endif
  184. #define UPTIME_OVERFLOW 4294967295 // Uptime overflow value
  185. // Values that will be reported in heartbeat
  186. #ifndef HEARTBEAT_REPORT_STATUS
  187. #define HEARTBEAT_REPORT_STATUS 1
  188. #endif
  189. #ifndef HEARTBEAT_REPORT_SSID
  190. #define HEARTBEAT_REPORT_SSID 1
  191. #endif
  192. #ifndef HEARTBEAT_REPORT_IP
  193. #define HEARTBEAT_REPORT_IP 1
  194. #endif
  195. #ifndef HEARTBEAT_REPORT_MAC
  196. #define HEARTBEAT_REPORT_MAC 1
  197. #endif
  198. #ifndef HEARTBEAT_REPORT_RSSI
  199. #define HEARTBEAT_REPORT_RSSI 1
  200. #endif
  201. #ifndef HEARTBEAT_REPORT_UPTIME
  202. #define HEARTBEAT_REPORT_UPTIME 1
  203. #endif
  204. #ifndef HEARTBEAT_REPORT_DATETIME
  205. #define HEARTBEAT_REPORT_DATETIME 1
  206. #endif
  207. #ifndef HEARTBEAT_REPORT_FREEHEAP
  208. #define HEARTBEAT_REPORT_FREEHEAP 1
  209. #endif
  210. #ifndef HEARTBEAT_REPORT_VCC
  211. #define HEARTBEAT_REPORT_VCC 1
  212. #endif
  213. #ifndef HEARTBEAT_REPORT_RELAY
  214. #define HEARTBEAT_REPORT_RELAY 1
  215. #endif
  216. #ifndef HEARTBEAT_REPORT_LIGHT
  217. #define HEARTBEAT_REPORT_LIGHT 1
  218. #endif
  219. #ifndef HEARTBEAT_REPORT_HOSTNAME
  220. #define HEARTBEAT_REPORT_HOSTNAME 1
  221. #endif
  222. #ifndef HEARTBEAT_REPORT_DESCRIPTION
  223. #define HEARTBEAT_REPORT_DESCRIPTION 1
  224. #endif
  225. #ifndef HEARTBEAT_REPORT_APP
  226. #define HEARTBEAT_REPORT_APP 1
  227. #endif
  228. #ifndef HEARTBEAT_REPORT_VERSION
  229. #define HEARTBEAT_REPORT_VERSION 1
  230. #endif
  231. #ifndef HEARTBEAT_REPORT_BOARD
  232. #define HEARTBEAT_REPORT_BOARD 1
  233. #endif
  234. #ifndef HEARTBEAT_REPORT_LOADAVG
  235. #define HEARTBEAT_REPORT_LOADAVG 1
  236. #endif
  237. #ifndef HEARTBEAT_REPORT_INTERVAL
  238. #define HEARTBEAT_REPORT_INTERVAL 0
  239. #endif
  240. #ifndef HEARTBEAT_REPORT_RANGE
  241. #define HEARTBEAT_REPORT_RANGE THERMOSTAT_SUPPORT
  242. #endif
  243. #ifndef HEARTBEAT_REPORT_REMOTE_TEMP
  244. #define HEARTBEAT_REPORT_REMOTE_TEMP THERMOSTAT_SUPPORT
  245. #endif
  246. #ifndef HEARTBEAT_REPORT_BSSID
  247. #define HEARTBEAT_REPORT_BSSID 0
  248. #endif
  249. //------------------------------------------------------------------------------
  250. // Load average
  251. //------------------------------------------------------------------------------
  252. #ifndef LOADAVG_INTERVAL
  253. #define LOADAVG_INTERVAL 30000 // Interval between calculating load average (in ms)
  254. #endif
  255. //------------------------------------------------------------------------------
  256. // BUTTON
  257. //------------------------------------------------------------------------------
  258. #ifndef BUTTON_SUPPORT
  259. #define BUTTON_SUPPORT 1
  260. #endif
  261. #ifndef BUTTON_DEBOUNCE_DELAY
  262. #define BUTTON_DEBOUNCE_DELAY 50 // Debounce delay (ms)
  263. #endif
  264. #ifndef BUTTON_DBLCLICK_DELAY
  265. #define BUTTON_DBLCLICK_DELAY 500 // Time in ms to wait for a second (or third...) click
  266. #endif
  267. #ifndef BUTTON_LNGCLICK_DELAY
  268. #define BUTTON_LNGCLICK_DELAY 1000 // Time in ms holding the button down to get a long click
  269. #endif
  270. #ifndef BUTTON_LNGLNGCLICK_DELAY
  271. #define BUTTON_LNGLNGCLICK_DELAY 10000 // Time in ms holding the button down to get a long-long click
  272. #endif
  273. #ifndef BUTTON_MQTT_SEND_ALL_EVENTS
  274. #define BUTTON_MQTT_SEND_ALL_EVENTS 0 // 0 - to send only events the are bound to actions
  275. // 1 - to send all button events to MQTT
  276. #endif
  277. //------------------------------------------------------------------------------
  278. // ENCODER
  279. //------------------------------------------------------------------------------
  280. #ifndef ENCODER_SUPPORT
  281. #define ENCODER_SUPPORT 0
  282. #endif
  283. #ifndef ENCODER_MINIMUM_DELTA
  284. #define ENCODER_MINIMUM_DELTA 1
  285. #endif
  286. //------------------------------------------------------------------------------
  287. // LED
  288. //------------------------------------------------------------------------------
  289. #ifndef LED_SUPPORT
  290. #define LED_SUPPORT 1
  291. #endif
  292. //------------------------------------------------------------------------------
  293. // RELAY
  294. //------------------------------------------------------------------------------
  295. // Default boot mode: 0 means OFF, 1 ON and 2 whatever was before
  296. #ifndef RELAY_BOOT_MODE
  297. #define RELAY_BOOT_MODE RELAY_BOOT_OFF
  298. #endif
  299. // 0 means ANY, 1 zero or one and 2 one and only one
  300. #ifndef RELAY_SYNC
  301. #define RELAY_SYNC RELAY_SYNC_ANY
  302. #endif
  303. // Default pulse mode: 0 means no pulses, 1 means normally off, 2 normally on
  304. #ifndef RELAY_PULSE_MODE
  305. #define RELAY_PULSE_MODE RELAY_PULSE_NONE
  306. #endif
  307. // Default pulse time in seconds
  308. #ifndef RELAY_PULSE_TIME
  309. #define RELAY_PULSE_TIME 1.0
  310. #endif
  311. // Relay requests flood protection window - in seconds
  312. #ifndef RELAY_FLOOD_WINDOW
  313. #define RELAY_FLOOD_WINDOW 3
  314. #endif
  315. // Allowed actual relay changes inside requests flood protection window
  316. #ifndef RELAY_FLOOD_CHANGES
  317. #define RELAY_FLOOD_CHANGES 5
  318. #endif
  319. // Pulse with in milliseconds for a latched relay
  320. #ifndef RELAY_LATCHING_PULSE
  321. #define RELAY_LATCHING_PULSE 10
  322. #endif
  323. // Do not save relay state after these many milliseconds
  324. #ifndef RELAY_SAVE_DELAY
  325. #define RELAY_SAVE_DELAY 1000
  326. #endif
  327. #ifndef RELAY_REPORT_STATUS
  328. #define RELAY_REPORT_STATUS 1
  329. #endif
  330. // Configure the MQTT payload for ON, OFF and TOGGLE
  331. #ifndef RELAY_MQTT_OFF
  332. #define RELAY_MQTT_OFF "0"
  333. #endif
  334. #ifndef RELAY_MQTT_ON
  335. #define RELAY_MQTT_ON "1"
  336. #endif
  337. #ifndef RELAY_MQTT_TOGGLE
  338. #define RELAY_MQTT_TOGGLE "2"
  339. #endif
  340. // -----------------------------------------------------------------------------
  341. // WIFI
  342. // -----------------------------------------------------------------------------
  343. #ifndef WIFI_CONNECT_TIMEOUT
  344. #define WIFI_CONNECT_TIMEOUT 60000 // Connecting timeout for WIFI in ms
  345. #endif
  346. #ifndef WIFI_RECONNECT_INTERVAL
  347. #define WIFI_RECONNECT_INTERVAL 180000 // If could not connect to WIFI, retry after this time in ms
  348. #endif
  349. #ifndef WIFI_MAX_NETWORKS
  350. #define WIFI_MAX_NETWORKS 5 // Max number of WIFI connection configurations
  351. #endif
  352. #ifndef WIFI_AP_CAPTIVE
  353. #define WIFI_AP_CAPTIVE 1 // Captive portal enabled when in AP mode
  354. #endif
  355. #ifndef WIFI_FALLBACK_APMODE
  356. #define WIFI_FALLBACK_APMODE 1 // Fallback to AP mode if no STA connection
  357. #endif
  358. #ifndef WIFI_SLEEP_MODE
  359. #define WIFI_SLEEP_MODE WIFI_NONE_SLEEP // WIFI_NONE_SLEEP, WIFI_LIGHT_SLEEP or WIFI_MODEM_SLEEP
  360. #endif
  361. #ifndef WIFI_SCAN_NETWORKS
  362. #define WIFI_SCAN_NETWORKS 1 // Perform a network scan before connecting
  363. #endif
  364. // Optional hardcoded configuration (up to 2 networks)
  365. #ifndef WIFI1_SSID
  366. #define WIFI1_SSID ""
  367. #endif
  368. #ifndef WIFI1_PASS
  369. #define WIFI1_PASS ""
  370. #endif
  371. #ifndef WIFI1_IP
  372. #define WIFI1_IP ""
  373. #endif
  374. #ifndef WIFI1_GW
  375. #define WIFI1_GW ""
  376. #endif
  377. #ifndef WIFI1_MASK
  378. #define WIFI1_MASK ""
  379. #endif
  380. #ifndef WIFI1_DNS
  381. #define WIFI1_DNS ""
  382. #endif
  383. #ifndef WIFI2_SSID
  384. #define WIFI2_SSID ""
  385. #endif
  386. #ifndef WIFI2_PASS
  387. #define WIFI2_PASS ""
  388. #endif
  389. #ifndef WIFI2_IP
  390. #define WIFI2_IP ""
  391. #endif
  392. #ifndef WIFI2_GW
  393. #define WIFI2_GW ""
  394. #endif
  395. #ifndef WIFI2_MASK
  396. #define WIFI2_MASK ""
  397. #endif
  398. #ifndef WIFI2_DNS
  399. #define WIFI2_DNS ""
  400. #endif
  401. #ifndef WIFI3_SSID
  402. #define WIFI3_SSID ""
  403. #endif
  404. #ifndef WIFI3_PASS
  405. #define WIFI3_PASS ""
  406. #endif
  407. #ifndef WIFI3_IP
  408. #define WIFI3_IP ""
  409. #endif
  410. #ifndef WIFI3_GW
  411. #define WIFI3_GW ""
  412. #endif
  413. #ifndef WIFI3_MASK
  414. #define WIFI3_MASK ""
  415. #endif
  416. #ifndef WIFI3_DNS
  417. #define WIFI3_DNS ""
  418. #endif
  419. #ifndef WIFI4_SSID
  420. #define WIFI4_SSID ""
  421. #endif
  422. #ifndef WIFI4_PASS
  423. #define WIFI4_PASS ""
  424. #endif
  425. #ifndef WIFI4_IP
  426. #define WIFI4_IP ""
  427. #endif
  428. #ifndef WIFI4_GW
  429. #define WIFI4_GW ""
  430. #endif
  431. #ifndef WIFI4_MASK
  432. #define WIFI4_MASK ""
  433. #endif
  434. #ifndef WIFI4_DNS
  435. #define WIFI4_DNS ""
  436. #endif
  437. #ifndef WIFI_RSSI_1M
  438. #define WIFI_RSSI_1M -30 // Calibrate it with your router reading the RSSI at 1m
  439. #endif
  440. #ifndef WIFI_PROPAGATION_CONST
  441. #define WIFI_PROPAGATION_CONST 4 // This is typically something between 2.7 to 4.3 (free space is 2)
  442. #endif
  443. // ref: https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/kconfig.html#config-lwip-esp-gratuitous-arp
  444. // ref: https://github.com/xoseperez/espurna/pull/1877#issuecomment-525612546
  445. //
  446. // Broadcast gratuitous ARP periodically to update ARP tables on the AP and all devices on the same network.
  447. // Helps to solve compatibility issues when ESP fails to timely reply to ARP requests, causing the device's ARP table entry to expire.
  448. #ifndef WIFI_GRATUITOUS_ARP_SUPPORT
  449. #define WIFI_GRATUITOUS_ARP_SUPPORT 1
  450. #endif
  451. // Interval is randomized on each boot in range from ..._MIN to ..._MAX (ms)
  452. #ifndef WIFI_GRATUITOUS_ARP_INTERVAL_MIN
  453. #define WIFI_GRATUITOUS_ARP_INTERVAL_MIN 15000
  454. #endif
  455. #ifndef WIFI_GRATUITOUS_ARP_INTERVAL_MAX
  456. #define WIFI_GRATUITOUS_ARP_INTERVAL_MAX 30000
  457. #endif
  458. // ref: https://github.com/esp8266/Arduino/issues/6471
  459. // ref: https://github.com/esp8266/Arduino/issues/6366
  460. //
  461. // Issue #6366 turned out to be high tx power causing weird behavior. Lowering tx power achieved stability.
  462. #ifndef WIFI_OUTPUT_POWER_DBM
  463. #define WIFI_OUTPUT_POWER_DBM 20.0
  464. #endif
  465. // -----------------------------------------------------------------------------
  466. // WEB
  467. // -----------------------------------------------------------------------------
  468. #ifndef WEB_SUPPORT
  469. #define WEB_SUPPORT 1 // Enable web support (http, api, 121.65Kb)
  470. #endif
  471. #ifndef WEB_EMBEDDED
  472. #define WEB_EMBEDDED 1 // Build the firmware with the web interface embedded in
  473. #endif
  474. // Requires ESPAsyncTCP to be built with ASYNC_TCP_SSL_ENABLED=1 and Arduino Core version >= 2.4.0
  475. // XXX: This is not working at the moment!! Pending https://github.com/me-no-dev/ESPAsyncTCP/issues/95
  476. #ifndef WEB_SSL_ENABLED
  477. #define WEB_SSL_ENABLED 0 // Use HTTPS web interface
  478. #endif
  479. #ifndef WEB_USERNAME
  480. #define WEB_USERNAME "admin" // HTTP username
  481. #endif
  482. #ifndef WEB_FORCE_PASS_CHANGE
  483. #define WEB_FORCE_PASS_CHANGE 1 // Force the user to change the password if default one
  484. #endif
  485. #ifndef WEB_PORT
  486. #define WEB_PORT 80 // HTTP port
  487. #endif
  488. // Defining a WEB_REMOTE_DOMAIN will enable Cross-Origin Resource Sharing (CORS)
  489. // so you will be able to login to this device from another domain. This will allow
  490. // you to manage all ESPurna devices in your local network from a unique installation
  491. // of the web UI. This installation could be in a local server (a Raspberry Pi, for instance)
  492. // or in the Internet. Since the WebUI is just one compressed file with HTML, CSS and JS
  493. // there are no special requirements. Any static web server will do (NGinx, Apache, Lighttpd,...).
  494. // The only requirement is that the resource must be available under this domain.
  495. #ifndef WEB_REMOTE_DOMAIN
  496. #define WEB_REMOTE_DOMAIN "http://espurna.io"
  497. #endif
  498. // -----------------------------------------------------------------------------
  499. // WEBSOCKETS
  500. // -----------------------------------------------------------------------------
  501. // This will only be enabled if WEB_SUPPORT is 1 (this is the default value)
  502. #ifndef WS_AUTHENTICATION
  503. #define WS_AUTHENTICATION 1 // WS authentication ON by default (see #507)
  504. #endif
  505. #ifndef WS_BUFFER_SIZE
  506. #define WS_BUFFER_SIZE 5 // Max number of secured websocket connections
  507. #endif
  508. #ifndef WS_TIMEOUT
  509. #define WS_TIMEOUT 1800000 // Timeout for secured websocket
  510. #endif
  511. #ifndef WS_UPDATE_INTERVAL
  512. #define WS_UPDATE_INTERVAL 30000 // Update clients every 30 seconds
  513. #endif
  514. // -----------------------------------------------------------------------------
  515. // API
  516. // -----------------------------------------------------------------------------
  517. #ifndef API_SUPPORT
  518. #define API_SUPPORT 1 // API (REST & RPC) support built in
  519. #endif
  520. // This will only be enabled if WEB_SUPPORT is 1 (this is the default value)
  521. #ifndef API_ENABLED
  522. #define API_ENABLED 0 // Do not enable API by default
  523. #endif
  524. #ifndef API_KEY
  525. #define API_KEY "" // Do not enable API by default. WebUI will automatically generate the key
  526. #endif
  527. #ifndef API_RESTFUL
  528. #define API_RESTFUL 1 // A restful API requires changes to be issued as PUT requests
  529. // Setting this to 0 will allow using GET to change relays, for instance
  530. #endif
  531. #ifndef API_BUFFER_SIZE
  532. #define API_BUFFER_SIZE 64 // Size of the buffer for HTTP GET API responses
  533. #endif
  534. #ifndef API_REAL_TIME_VALUES
  535. #define API_REAL_TIME_VALUES 0 // Show filtered/median values by default (0 => median, 1 => real time)
  536. #endif
  537. // -----------------------------------------------------------------------------
  538. // MDNS / LLMNR / NETBIOS / SSDP
  539. // -----------------------------------------------------------------------------
  540. #ifndef MDNS_SERVER_SUPPORT
  541. #define MDNS_SERVER_SUPPORT 1 // Publish services using mDNS by default (1.48Kb)
  542. #endif
  543. #ifndef MDNS_CLIENT_SUPPORT
  544. #define MDNS_CLIENT_SUPPORT 0 // Resolve mDNS names (3.44Kb)
  545. #endif
  546. #ifndef LLMNR_SUPPORT
  547. #define LLMNR_SUPPORT 0 // Publish device using LLMNR protocol by default (1.95Kb) - requires Core version >= 2.4.0
  548. #endif
  549. #ifndef NETBIOS_SUPPORT
  550. #define NETBIOS_SUPPORT 0 // Publish device using NetBIOS protocol by default (1.26Kb) - requires Core version >= 2.4.0
  551. #endif
  552. #ifndef SSDP_SUPPORT
  553. #define SSDP_SUPPORT 0 // Publish device using SSDP protocol by default (4.59Kb)
  554. // Not compatible with ALEXA_SUPPORT at the moment
  555. #endif
  556. #ifndef SSDP_DEVICE_TYPE
  557. #define SSDP_DEVICE_TYPE "upnp:rootdevice"
  558. //#define SSDP_DEVICE_TYPE "urn:schemas-upnp-org:device:BinaryLight:1"
  559. #endif
  560. // -----------------------------------------------------------------------------
  561. // SPIFFS
  562. // -----------------------------------------------------------------------------
  563. #ifndef SPIFFS_SUPPORT
  564. #define SPIFFS_SUPPORT 0 // Do not add support for SPIFFS by default
  565. #endif
  566. // -----------------------------------------------------------------------------
  567. // SSL Client ** EXPERIMENTAL **
  568. // -----------------------------------------------------------------------------
  569. #ifndef SECURE_CLIENT
  570. #define SECURE_CLIENT SECURE_CLIENT_NONE // What variant of WiFiClient to use
  571. // SECURE_CLIENT_NONE - No secure client support (default)
  572. // SECURE_CLIENT_AXTLS - axTLS client secure support (All Core versions, ONLY TLS 1.1)
  573. // SECURE_CLIENT_BEARSSL - BearSSL client secure support (starting with 2.5.0, TLS 1.2)
  574. //
  575. // axTLS marked for derecation since Arduino Core 2.4.2 and **will** be removed in the future
  576. #endif
  577. // Security check that is performed when the connection is established:
  578. // SECURE_CLIENT_CHECK_CA - Use Trust Anchor / Root Certificate
  579. // Supported only by the SECURE_CLIENT_BEARSSL
  580. // (See respective ..._SECURE_CLIENT_INCLUDE_CA options per-module)
  581. // SECURE_CLIENT_CHECK_FINGERPRINT - Check certificate fingerprint
  582. // SECURE_CLIENT_CHECK_NONE - Allow insecure connections
  583. #ifndef SECURE_CLIENT_CHECK
  584. #if SECURE_CLIENT == SECURE_CLIENT_BEARSSL
  585. #define SECURE_CLIENT_CHECK SECURE_CLIENT_CHECK_CA
  586. #else
  587. #define SECURE_CLIENT_CHECK SECURE_CLIENT_CHECK_FINGERPRINT
  588. #endif
  589. #endif // SECURE_CLIENT_CHECK
  590. // Support Maximum Fragment Length Negotiation TLS extension
  591. // "...negotiate a smaller maximum fragment length due to memory limitations or bandwidth limitations."
  592. // - https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/bearssl-client-secure-class.html#mfln-or-maximum-fragment-length-negotiation-saving-ram
  593. // - https://tools.ietf.org/html/rfc6066#section-4
  594. #ifndef SECURE_CLIENT_MFLN
  595. #define SECURE_CLIENT_MFLN 0 // The only possible values are: 512, 1024, 2048 and 4096
  596. // Set to 0 to disable (default)
  597. #endif
  598. // -----------------------------------------------------------------------------
  599. // OTA
  600. // -----------------------------------------------------------------------------
  601. #ifndef OTA_PORT
  602. #define OTA_PORT 8266 // Port for ArduinoOTA
  603. #endif
  604. #ifndef OTA_MQTT_SUPPORT
  605. #define OTA_MQTT_SUPPORT 0 // Listen for HTTP(s) URLs at '<root topic>/ota'. Depends on OTA_CLIENT
  606. #endif
  607. #ifndef OTA_ARDUINOOTA_SUPPORT
  608. #define OTA_ARDUINOOTA_SUPPORT 1 // Support ArduinoOTA by default (4.2Kb)
  609. // Implicitly depends on ESP8266mDNS library, thus increasing firmware size
  610. #endif
  611. #ifndef OTA_CLIENT
  612. #define OTA_CLIENT OTA_CLIENT_ASYNCTCP // Terminal / MQTT OTA support
  613. // OTA_CLIENT_ASYNCTCP (ESPAsyncTCP library)
  614. // OTA_CLIENT_HTTPUPDATE (Arduino Core library)
  615. #endif
  616. #define OTA_GITHUB_FP "CA:06:F5:6B:25:8B:7A:0D:4F:2B:05:47:09:39:47:86:51:15:19:84"
  617. #ifndef OTA_FINGERPRINT
  618. #define OTA_FINGERPRINT OTA_GITHUB_FP
  619. #endif
  620. #ifndef OTA_SECURE_CLIENT_CHECK
  621. #define OTA_SECURE_CLIENT_CHECK SECURE_CLIENT_CHECK
  622. #endif
  623. #ifndef OTA_SECURE_CLIENT_MFLN
  624. #define OTA_SECURE_CLIENT_MFLN SECURE_CLIENT_MFLN
  625. #endif
  626. #ifndef OTA_SECURE_CLIENT_INCLUDE_CA
  627. #define OTA_SECURE_CLIENT_INCLUDE_CA 0 // Use user-provided CA. Only PROGMEM PEM option is supported.
  628. // TODO: eventually should be replaced with pre-parsed structs, read directly from flash
  629. // (ref: https://github.com/earlephilhower/bearssl-esp8266/pull/14)
  630. //
  631. // When enabled, current implementation includes "static/ota_client_trusted_root_ca.h" with
  632. // const char _ota_client_trusted_root_ca[] PROGMEM = "...PEM data...";
  633. // By default, using DigiCert root in "static/digicert_evroot_pem.h" (for https://github.com)
  634. #endif
  635. // -----------------------------------------------------------------------------
  636. // NOFUSS
  637. // -----------------------------------------------------------------------------
  638. #ifndef NOFUSS_SUPPORT
  639. #define NOFUSS_SUPPORT 0 // Do not enable support for NoFuss by default (12.65Kb)
  640. #endif
  641. #ifndef NOFUSS_ENABLED
  642. #define NOFUSS_ENABLED 0 // Do not perform NoFUSS updates by default
  643. #endif
  644. #ifndef NOFUSS_SERVER
  645. #define NOFUSS_SERVER "" // Default NoFuss Server
  646. #endif
  647. #ifndef NOFUSS_INTERVAL
  648. #define NOFUSS_INTERVAL 3600000 // Check for updates every hour
  649. #endif
  650. // -----------------------------------------------------------------------------
  651. // UART <-> MQTT
  652. // -----------------------------------------------------------------------------
  653. #ifndef UART_MQTT_SUPPORT
  654. #define UART_MQTT_SUPPORT 0 // No support by default
  655. #endif
  656. #ifndef UART_MQTT_USE_SOFT
  657. #define UART_MQTT_USE_SOFT 0 // Use SoftwareSerial
  658. #endif
  659. #ifndef UART_MQTT_HW_PORT
  660. #define UART_MQTT_HW_PORT Serial // Hardware serial port (if UART_MQTT_USE_SOFT == 0)
  661. #endif
  662. #ifndef UART_MQTT_RX_PIN
  663. #define UART_MQTT_RX_PIN 4 // RX PIN (if UART_MQTT_USE_SOFT == 1)
  664. #endif
  665. #ifndef UART_MQTT_TX_PIN
  666. #define UART_MQTT_TX_PIN 5 // TX PIN (if UART_MQTT_USE_SOFT == 1)
  667. #endif
  668. #ifndef UART_MQTT_BAUDRATE
  669. #define UART_MQTT_BAUDRATE 115200 // Serial speed
  670. #endif
  671. #ifndef UART_MQTT_TERMINATION
  672. #define UART_MQTT_TERMINATION '\n' // Termination character
  673. #endif
  674. #define UART_MQTT_BUFFER_SIZE 100 // UART buffer size
  675. // -----------------------------------------------------------------------------
  676. // MQTT
  677. // -----------------------------------------------------------------------------
  678. #ifndef MQTT_SUPPORT
  679. #define MQTT_SUPPORT 1 // MQTT support (22.38Kb async, 12.48Kb sync)
  680. #endif
  681. #ifndef MQTT_LIBRARY
  682. #define MQTT_LIBRARY MQTT_LIBRARY_ASYNCMQTTCLIENT // MQTT_LIBRARY_ASYNCMQTTCLIENT (default, https://github.com/marvinroger/async-mqtt-client)
  683. // MQTT_LIBRARY_PUBSUBCLIENT (https://github.com/knolleary/pubsubclient)
  684. // MQTT_LIBRARY_ARDUINOMQTT (https://github.com/256dpi/arduino-mqtt)
  685. #endif
  686. // -----------------------------------------------------------------------------
  687. // MQTT OVER SSL
  688. // -----------------------------------------------------------------------------
  689. //
  690. // Requires SECURE_CLIENT set to SECURE_CLIENT_AXTLS or SECURE_CLIENT_BEARSSL
  691. // It is recommended to use MQTT_LIBRARY_ARDUINOMQTT or MQTT_LIBRARY_PUBSUBCLIENT
  692. // It is recommended to use SECURE_CLIENT_BEARSSL
  693. // It is recommended to use ESP8266 Arduino Core >= 2.5.2 with SECURE_CLIENT_BEARSSL
  694. //
  695. // Current version of MQTT_LIBRARY_ASYNCMQTTCLIENT only supports SECURE_CLIENT_AXTLS
  696. //
  697. // It is recommended to use WEB_SUPPORT=0 with either SECURE_CLIENT option, as there are miscellaneous problems when using them simultaneously
  698. // (although, things might've improved, and I'd encourage to check whether this is true or not)
  699. //
  700. // When using MQTT_LIBRARY_PUBSUBCLIENT or MQTT_LIBRARY_ARDUINOMQTT, you will have to disable every module that uses ESPAsyncTCP:
  701. // ALEXA_SUPPORT=0, INFLUXDB_SUPPORT=0, TELNET_SUPPORT=0, THINGSPEAK_SUPPORT=0, DEBUG_TELNET_SUPPORT=0 and WEB_SUPPORT=0
  702. // Or, use "sync" versions instead (note that not every module has this option):
  703. // THINGSPEAK_USE_ASYNC=0, TELNET_SERVER=TELNET_SERVER_WIFISERVER
  704. //
  705. // See SECURE_CLIENT_CHECK for all possible connection verification options.
  706. //
  707. // The simpliest way to verify SSL connection is to use fingerprinting.
  708. // For example, to get Google's MQTT server certificate fingerprint, run the following command:
  709. // $ echo -n | openssl s_client -connect mqtt.googleapis.com:8883 2>&1 | openssl x509 -noout -fingerprint -sha1 | cut -d\= -f2
  710. // Note that fingerprint will change when certificate changes e.g. LetsEncrypt renewals or when the CSR updates
  711. #ifndef MQTT_SSL_ENABLED
  712. #define MQTT_SSL_ENABLED 0 // By default MQTT over SSL will not be enabled
  713. #endif
  714. #ifndef MQTT_SSL_FINGERPRINT
  715. #define MQTT_SSL_FINGERPRINT "" // SSL fingerprint of the server
  716. #endif
  717. #ifndef MQTT_SECURE_CLIENT_CHECK
  718. #define MQTT_SECURE_CLIENT_CHECK SECURE_CLIENT_CHECK // Use global verification setting by default
  719. #endif
  720. #ifndef MQTT_SECURE_CLIENT_MFLN
  721. #define MQTT_SECURE_CLIENT_MFLN SECURE_CLIENT_MFLN // Use global MFLN setting by default
  722. #endif
  723. #ifndef MQTT_SECURE_CLIENT_INCLUDE_CA
  724. #define MQTT_SECURE_CLIENT_INCLUDE_CA 0 // Use user-provided CA. Only PROGMEM PEM option is supported.
  725. // When enabled, current implementation includes "static/mqtt_client_trusted_root_ca.h" with
  726. // const char _mqtt_client_trusted_root_ca[] PROGMEM = "...PEM data...";
  727. // By default, using LetsEncrypt X3 root in "static/letsencrypt_isrgroot_pem.h"
  728. #endif
  729. #ifndef MQTT_ENABLED
  730. #define MQTT_ENABLED 0 // Do not enable MQTT connection by default
  731. #endif
  732. #ifndef MQTT_AUTOCONNECT
  733. #define MQTT_AUTOCONNECT 1 // If enabled and MDNS_SERVER_SUPPORT=1 will perform an autodiscover and
  734. // autoconnect to the first MQTT broker found if none defined
  735. #endif
  736. #ifndef MQTT_SERVER
  737. #define MQTT_SERVER "" // Default MQTT broker address
  738. #endif
  739. #ifndef MQTT_USER
  740. #define MQTT_USER "" // Default MQTT broker usename
  741. #endif
  742. #ifndef MQTT_PASS
  743. #define MQTT_PASS "" // Default MQTT broker password
  744. #endif
  745. #ifndef MQTT_PORT
  746. #define MQTT_PORT 1883 // MQTT broker port
  747. #endif
  748. #ifndef MQTT_TOPIC
  749. #define MQTT_TOPIC "{hostname}" // Default MQTT base topic
  750. #endif
  751. #ifndef MQTT_RETAIN
  752. #define MQTT_RETAIN true // MQTT retain flag
  753. #endif
  754. #ifndef MQTT_QOS
  755. #define MQTT_QOS 0 // MQTT QoS value for all messages
  756. #endif
  757. #ifndef MQTT_KEEPALIVE
  758. #define MQTT_KEEPALIVE 300 // MQTT keepalive value
  759. #endif
  760. #ifndef MQTT_RECONNECT_DELAY_MIN
  761. #define MQTT_RECONNECT_DELAY_MIN 5000 // Try to reconnect in 5 seconds upon disconnection
  762. #endif
  763. #ifndef MQTT_RECONNECT_DELAY_STEP
  764. #define MQTT_RECONNECT_DELAY_STEP 5000 // Increase the reconnect delay in 5 seconds after each failed attempt
  765. #endif
  766. #ifndef MQTT_RECONNECT_DELAY_MAX
  767. #define MQTT_RECONNECT_DELAY_MAX 120000 // Set reconnect time to 2 minutes at most
  768. #endif
  769. #ifndef MQTT_SKIP_RETAINED
  770. #define MQTT_SKIP_RETAINED 1 // Skip retained messages on connection
  771. #endif
  772. #ifndef MQTT_SKIP_TIME
  773. #define MQTT_SKIP_TIME 1000 // Skip messages for 1 second anter connection
  774. #endif
  775. #if THERMOSTAT_SUPPORT == 1
  776. #ifndef MQTT_USE_JSON
  777. #define MQTT_USE_JSON 1 // Group messages in a JSON body
  778. #endif
  779. #else
  780. #ifndef MQTT_USE_JSON
  781. #define MQTT_USE_JSON 0 // Don't group messages in a JSON body (default)
  782. #endif
  783. #endif
  784. #ifndef MQTT_USE_JSON_DELAY
  785. #define MQTT_USE_JSON_DELAY 100 // Wait this many ms before grouping messages
  786. #endif
  787. #ifndef MQTT_QUEUE_MAX_SIZE
  788. #define MQTT_QUEUE_MAX_SIZE 20 // Size of the MQTT queue when MQTT_USE_JSON is enabled
  789. #endif
  790. // These are the properties that will be sent when useJson is true
  791. #ifndef MQTT_ENQUEUE_IP
  792. #define MQTT_ENQUEUE_IP 1
  793. #endif
  794. #ifndef MQTT_ENQUEUE_MAC
  795. #define MQTT_ENQUEUE_MAC 1
  796. #endif
  797. #ifndef MQTT_ENQUEUE_HOSTNAME
  798. #define MQTT_ENQUEUE_HOSTNAME 1
  799. #endif
  800. #ifndef MQTT_ENQUEUE_DATETIME
  801. #define MQTT_ENQUEUE_DATETIME 1
  802. #endif
  803. #ifndef MQTT_ENQUEUE_MESSAGE_ID
  804. #define MQTT_ENQUEUE_MESSAGE_ID 1
  805. #endif
  806. // These particles will be concatenated to the MQTT_TOPIC base to form the actual topic
  807. #define MQTT_TOPIC_JSON "data"
  808. #define MQTT_TOPIC_ACTION "action"
  809. #define MQTT_TOPIC_RELAY "relay"
  810. #define MQTT_TOPIC_LED "led"
  811. #define MQTT_TOPIC_BUTTON "button"
  812. #define MQTT_TOPIC_IP "ip"
  813. #define MQTT_TOPIC_SSID "ssid"
  814. #define MQTT_TOPIC_BSSID "bssid"
  815. #define MQTT_TOPIC_VERSION "version"
  816. #define MQTT_TOPIC_UPTIME "uptime"
  817. #define MQTT_TOPIC_DATETIME "datetime"
  818. #define MQTT_TOPIC_TIMESTAMP "timestamp"
  819. #define MQTT_TOPIC_FREEHEAP "freeheap"
  820. #define MQTT_TOPIC_VCC "vcc"
  821. #ifndef MQTT_TOPIC_STATUS
  822. #define MQTT_TOPIC_STATUS "status"
  823. #endif
  824. #define MQTT_TOPIC_MAC "mac"
  825. #define MQTT_TOPIC_RSSI "rssi"
  826. #define MQTT_TOPIC_MESSAGE_ID "id"
  827. #define MQTT_TOPIC_APP "app"
  828. #define MQTT_TOPIC_INTERVAL "interval"
  829. #define MQTT_TOPIC_HOSTNAME "host"
  830. #define MQTT_TOPIC_DESCRIPTION "desc"
  831. #define MQTT_TOPIC_TIME "time"
  832. #define MQTT_TOPIC_RFOUT "rfout"
  833. #define MQTT_TOPIC_RFIN "rfin"
  834. #define MQTT_TOPIC_RFLEARN "rflearn"
  835. #define MQTT_TOPIC_RFRAW "rfraw"
  836. #define MQTT_TOPIC_UARTIN "uartin"
  837. #define MQTT_TOPIC_UARTOUT "uartout"
  838. #define MQTT_TOPIC_LOADAVG "loadavg"
  839. #define MQTT_TOPIC_BOARD "board"
  840. #define MQTT_TOPIC_PULSE "pulse"
  841. #define MQTT_TOPIC_SPEED "speed"
  842. #define MQTT_TOPIC_IRIN "irin"
  843. #define MQTT_TOPIC_IROUT "irout"
  844. #define MQTT_TOPIC_OTA "ota"
  845. #define MQTT_TOPIC_TELNET_REVERSE "telnet_reverse"
  846. // Light module
  847. #define MQTT_TOPIC_CHANNEL "channel"
  848. #define MQTT_TOPIC_COLOR_RGB "rgb"
  849. #define MQTT_TOPIC_COLOR_HSV "hsv"
  850. #define MQTT_TOPIC_ANIM_MODE "anim_mode"
  851. #define MQTT_TOPIC_ANIM_SPEED "anim_speed"
  852. #define MQTT_TOPIC_BRIGHTNESS "brightness"
  853. #define MQTT_TOPIC_MIRED "mired"
  854. #define MQTT_TOPIC_KELVIN "kelvin"
  855. #define MQTT_TOPIC_TRANSITION "transition"
  856. // Thermostat module
  857. #define MQTT_TOPIC_HOLD_TEMP "hold_temp"
  858. #define MQTT_TOPIC_HOLD_TEMP_MIN "min"
  859. #define MQTT_TOPIC_HOLD_TEMP_MAX "max"
  860. #define MQTT_TOPIC_REMOTE_TEMP "remote_temp"
  861. #define MQTT_TOPIC_ASK_TEMP_RANGE "ask_temp_range"
  862. #define MQTT_TOPIC_NOTIFY_TEMP_RANGE_MIN "notify_temp_range_min"
  863. #define MQTT_TOPIC_NOTIFY_TEMP_RANGE_MAX "notify_temp_range_max"
  864. #ifndef MQTT_STATUS_ONLINE
  865. #define MQTT_STATUS_ONLINE "1" // Value for the device ON message
  866. #endif
  867. #ifndef MQTT_STATUS_OFFLINE
  868. #define MQTT_STATUS_OFFLINE "0" // Value for the device OFF message (will)
  869. #endif
  870. #define MQTT_ACTION_RESET "reboot" // RESET MQTT topic particle
  871. // Custom get and set postfixes
  872. // Use something like "/status" or "/set", with leading slash
  873. // Since 1.9.0 the default value is "" for getter and "/set" for setter
  874. #ifndef MQTT_GETTER
  875. #define MQTT_GETTER ""
  876. #endif
  877. #ifndef MQTT_SETTER
  878. #define MQTT_SETTER "/set"
  879. #endif
  880. // -----------------------------------------------------------------------------
  881. // BROKER
  882. // -----------------------------------------------------------------------------
  883. #ifndef BROKER_SUPPORT
  884. #define BROKER_SUPPORT 1 // The broker is a poor-man's pubsub manager
  885. #endif
  886. // -----------------------------------------------------------------------------
  887. // SETTINGS
  888. // -----------------------------------------------------------------------------
  889. #ifndef SETTINGS_AUTOSAVE
  890. #define SETTINGS_AUTOSAVE 1 // Autosave settings or force manual commit
  891. #endif
  892. #define SETTINGS_MAX_LIST_COUNT 10 // Maximum index for settings lists
  893. // -----------------------------------------------------------------------------
  894. // LIGHT
  895. // -----------------------------------------------------------------------------
  896. // LIGHT_PROVIDER_DIMMER can have from 1 to 5 different channels.
  897. // They have to be defined for each device in the hardware.h file.
  898. // If 3 or more channels first 3 will be considered RGB.
  899. // Usual configurations are:
  900. // 1 channels => W
  901. // 2 channels => WW
  902. // 3 channels => RGB
  903. // 4 channels => RGBW
  904. // 5 channels => RGBWW
  905. #ifndef LIGHT_SAVE_ENABLED
  906. #define LIGHT_SAVE_ENABLED 1 // Light channel values saved by default after each change
  907. #endif
  908. #ifndef LIGHT_COMMS_DELAY
  909. #define LIGHT_COMMS_DELAY 100 // Delay communication after light update (in ms)
  910. #endif
  911. #ifndef LIGHT_SAVE_DELAY
  912. #define LIGHT_SAVE_DELAY 5 // Persist color after 5 seconds to avoid wearing out
  913. #endif
  914. #ifndef LIGHT_MIN_PWM
  915. #define LIGHT_MIN_PWM 0
  916. #endif
  917. #ifndef LIGHT_MAX_PWM
  918. #if LIGHT_PROVIDER == LIGHT_PROVIDER_MY92XX
  919. #define LIGHT_MAX_PWM 255
  920. #elif LIGHT_PROVIDER == LIGHT_PROVIDER_DIMMER
  921. #define LIGHT_MAX_PWM 10000 // 10000 * 200ns => 2 kHz
  922. #else
  923. #define LIGHT_MAX_PWM 0
  924. #endif
  925. #endif // LIGHT_MAX_PWM
  926. #ifndef LIGHT_LIMIT_PWM
  927. #define LIGHT_LIMIT_PWM LIGHT_MAX_PWM // Limit PWM to this value (prevent 100% power)
  928. #endif
  929. #ifndef LIGHT_MIN_VALUE
  930. #define LIGHT_MIN_VALUE 0 // Minimum light value
  931. #endif
  932. #ifndef LIGHT_MAX_VALUE
  933. #define LIGHT_MAX_VALUE 255 // Maximum light value
  934. #endif
  935. #ifndef LIGHT_MIN_BRIGHTNESS
  936. #define LIGHT_MIN_BRIGHTNESS 0 // Minimum brightness value
  937. #endif
  938. #ifndef LIGHT_MAX_BRIGHTNESS
  939. #define LIGHT_MAX_BRIGHTNESS 255 // Maximum brightness value
  940. #endif
  941. // Default mireds & kelvin to the Philips Hue limits
  942. // https://developers.meethue.com/documentation/core-concepts
  943. //
  944. // Home Assistant also uses these, see Light::min_mireds, Light::max_mireds
  945. // https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/light/__init__.py
  946. // Used when LIGHT_USE_WHITE AND LIGHT_USE_CCT is 1 - (1000000/Kelvin = MiReds)
  947. // Warning! Don't change this yet, NOT FULLY IMPLEMENTED!
  948. #ifndef LIGHT_COLDWHITE_MIRED
  949. #define LIGHT_COLDWHITE_MIRED 153 // Coldwhite Strip, Value must be __BELOW__ W2!! (Default: 6535 Kelvin/153 MiRed)
  950. #endif
  951. #ifndef LIGHT_WARMWHITE_MIRED
  952. #define LIGHT_WARMWHITE_MIRED 500 // Warmwhite Strip, Value must be __ABOVE__ W1!! (Default: 2000 Kelvin/500 MiRed)
  953. #endif
  954. #ifndef LIGHT_STEP
  955. #define LIGHT_STEP 32 // Step size
  956. #endif
  957. #ifndef LIGHT_USE_COLOR
  958. #define LIGHT_USE_COLOR 1 // Use 3 first channels as RGB
  959. #endif
  960. #ifndef LIGHT_USE_WHITE
  961. #define LIGHT_USE_WHITE 0 // Use the 4th channel as (Warm-)White LEDs
  962. #endif
  963. #ifndef LIGHT_USE_CCT
  964. #define LIGHT_USE_CCT 0 // Use the 5th channel as Coldwhite LEDs, LIGHT_USE_WHITE must be 1.
  965. #endif
  966. #ifndef LIGHT_USE_GAMMA
  967. #define LIGHT_USE_GAMMA 0 // Use gamma correction for color channels
  968. #endif
  969. #ifndef LIGHT_USE_CSS
  970. #define LIGHT_USE_CSS 1 // Use CSS style to report colors (1=> "#FF0000", 0=> "255,0,0")
  971. #endif
  972. #ifndef LIGHT_USE_RGB
  973. #define LIGHT_USE_RGB 0 // Use RGB color selector (1=> RGB, 0=> HSV)
  974. #endif
  975. #ifndef LIGHT_WHITE_FACTOR
  976. #define LIGHT_WHITE_FACTOR 1 // When using LIGHT_USE_WHITE with uneven brightness LEDs,
  977. // this factor is used to scale the white channel to match brightness
  978. #endif
  979. #ifndef LIGHT_USE_TRANSITIONS
  980. #define LIGHT_USE_TRANSITIONS 1 // Transitions between colors
  981. #endif
  982. #ifndef LIGHT_TRANSITION_STEP
  983. #define LIGHT_TRANSITION_STEP 10 // Time in millis between each transtion step
  984. #endif
  985. #ifndef LIGHT_TRANSITION_TIME
  986. #define LIGHT_TRANSITION_TIME 500 // Time in millis from color to color
  987. #endif
  988. // -----------------------------------------------------------------------------
  989. // DOMOTICZ
  990. // -----------------------------------------------------------------------------
  991. #ifndef DOMOTICZ_SUPPORT
  992. #define DOMOTICZ_SUPPORT MQTT_SUPPORT // Build with domoticz (if MQTT) support (1.72Kb)
  993. #endif
  994. #ifndef DOMOTICZ_ENABLED
  995. #define DOMOTICZ_ENABLED 0 // Disable domoticz by default
  996. #endif
  997. #ifndef DOMOTICZ_IN_TOPIC
  998. #define DOMOTICZ_IN_TOPIC "domoticz/in" // Default subscription topic
  999. #endif
  1000. #ifndef DOMOTICZ_OUT_TOPIC
  1001. #define DOMOTICZ_OUT_TOPIC "domoticz/out" // Default publication topic
  1002. #endif
  1003. // -----------------------------------------------------------------------------
  1004. // HOME ASSISTANT
  1005. // -----------------------------------------------------------------------------
  1006. #ifndef HOMEASSISTANT_SUPPORT
  1007. #define HOMEASSISTANT_SUPPORT MQTT_SUPPORT // Build with home assistant support (if MQTT, 1.64Kb)
  1008. #endif
  1009. #ifndef HOMEASSISTANT_ENABLED
  1010. #define HOMEASSISTANT_ENABLED 0 // Integration not enabled by default
  1011. #endif
  1012. #ifndef HOMEASSISTANT_PREFIX
  1013. #define HOMEASSISTANT_PREFIX "homeassistant" // Default MQTT prefix
  1014. #endif
  1015. // -----------------------------------------------------------------------------
  1016. // INFLUXDB
  1017. // -----------------------------------------------------------------------------
  1018. #ifndef INFLUXDB_SUPPORT
  1019. #define INFLUXDB_SUPPORT 0 // Disable InfluxDB support by default (4.38Kb)
  1020. #endif
  1021. #ifndef INFLUXDB_ENABLED
  1022. #define INFLUXDB_ENABLED 0 // InfluxDB disabled by default
  1023. #endif
  1024. #ifndef INFLUXDB_HOST
  1025. #define INFLUXDB_HOST "" // Default server
  1026. #endif
  1027. #ifndef INFLUXDB_PORT
  1028. #define INFLUXDB_PORT 8086 // Default InfluxDB port
  1029. #endif
  1030. #ifndef INFLUXDB_DATABASE
  1031. #define INFLUXDB_DATABASE "" // Default database
  1032. #endif
  1033. #ifndef INFLUXDB_USERNAME
  1034. #define INFLUXDB_USERNAME "" // Default username
  1035. #endif
  1036. #ifndef INFLUXDB_PASSWORD
  1037. #define INFLUXDB_PASSWORD "" // Default password
  1038. #endif
  1039. // -----------------------------------------------------------------------------
  1040. // THINGSPEAK
  1041. // -----------------------------------------------------------------------------
  1042. #ifndef THINGSPEAK_SUPPORT
  1043. #define THINGSPEAK_SUPPORT 1 // Enable Thingspeak support by default (2.56Kb)
  1044. #endif
  1045. #ifndef THINGSPEAK_ENABLED
  1046. #define THINGSPEAK_ENABLED 0 // Thingspeak disabled by default
  1047. #endif
  1048. #ifndef THINGSPEAK_APIKEY
  1049. #define THINGSPEAK_APIKEY "" // Default API KEY
  1050. #endif
  1051. #ifndef THINGSPEAK_CLEAR_CACHE
  1052. #define THINGSPEAK_CLEAR_CACHE 1 // Clear cache after sending values
  1053. // Not clearing it will result in latest values for each field being sent every time
  1054. #endif
  1055. #define THINGSPEAK_USE_ASYNC 1 // Use AsyncClient instead of WiFiClientSecure
  1056. // THINGSPEAK OVER SSL
  1057. // Using THINGSPEAK over SSL works well but generates problems with the web interface,
  1058. // so you should compile it with WEB_SUPPORT to 0.
  1059. // When THINGSPEAK_USE_ASYNC is 1, requires EspAsyncTCP to be built with ASYNC_TCP_SSL_ENABLED=1 and ESP8266 Arduino Core >= 2.4.0.
  1060. #define THINGSPEAK_USE_SSL 0 // Use secure connection
  1061. #define THINGSPEAK_FINGERPRINT "78 60 18 44 81 35 BF DF 77 84 D4 0A 22 0D 9B 4E 6C DC 57 2C"
  1062. #define THINGSPEAK_HOST "api.thingspeak.com"
  1063. #if THINGSPEAK_USE_SSL
  1064. #define THINGSPEAK_PORT 443
  1065. #else
  1066. #define THINGSPEAK_PORT 80
  1067. #endif
  1068. #define THINGSPEAK_URL "/update"
  1069. #define THINGSPEAK_MIN_INTERVAL 15000 // Minimum interval between POSTs (in millis)
  1070. #define THINGSPEAK_FIELDS 8 // Number of fields
  1071. #ifndef THINGSPEAK_TRIES
  1072. #define THINGSPEAK_TRIES 3 // Number of tries when sending data (minimum 1)
  1073. #endif
  1074. // -----------------------------------------------------------------------------
  1075. // SCHEDULER
  1076. // -----------------------------------------------------------------------------
  1077. #ifndef SCHEDULER_SUPPORT
  1078. #define SCHEDULER_SUPPORT 1 // Enable scheduler (2.45Kb)
  1079. #endif
  1080. #ifndef SCHEDULER_MAX_SCHEDULES
  1081. #define SCHEDULER_MAX_SCHEDULES 10 // Max schedules alowed
  1082. #endif
  1083. #ifndef SCHEDULER_RESTORE_LAST_SCHEDULE
  1084. #define SCHEDULER_RESTORE_LAST_SCHEDULE 0 // Restore the last schedule state on the device boot
  1085. #endif
  1086. #ifndef SCHEDULER_WEEKDAYS
  1087. #define SCHEDULER_WEEKDAYS "1,2,3,4,5,6,7" // (Default - Run the schedules every day)
  1088. #endif
  1089. // -----------------------------------------------------------------------------
  1090. // RPN RULES
  1091. // -----------------------------------------------------------------------------
  1092. #ifndef RPN_RULES_SUPPORT
  1093. #define RPN_RULES_SUPPORT 0 // Enable RPN Rules (8.6Kb)
  1094. #endif
  1095. #ifndef RPN_DELAY
  1096. #define RPN_DELAY 100 // Execute rules after 100ms without messages
  1097. #endif
  1098. // -----------------------------------------------------------------------------
  1099. // NTP
  1100. // -----------------------------------------------------------------------------
  1101. #ifndef NTP_SUPPORT
  1102. #define NTP_SUPPORT 1 // Build with NTP support by default (6.78Kb)
  1103. #endif
  1104. #ifndef NTP_SERVER
  1105. #define NTP_SERVER "pool.ntp.org" // Default NTP server
  1106. #endif
  1107. #ifndef NTP_TIMEOUT
  1108. #define NTP_TIMEOUT 1000 // Set NTP request timeout to 2 seconds (issue #452)
  1109. #endif
  1110. #ifndef NTP_TIME_OFFSET
  1111. #define NTP_TIME_OFFSET 60 // Default timezone offset (GMT+1)
  1112. #endif
  1113. #ifndef NTP_DAY_LIGHT
  1114. #define NTP_DAY_LIGHT 1 // Enable daylight time saving by default
  1115. #endif
  1116. #ifndef NTP_SYNC_INTERVAL
  1117. #define NTP_SYNC_INTERVAL 60 // NTP initial check every minute
  1118. #endif
  1119. #ifndef NTP_UPDATE_INTERVAL
  1120. #define NTP_UPDATE_INTERVAL 1800 // NTP check every 30 minutes
  1121. #endif
  1122. #ifndef NTP_START_DELAY
  1123. #define NTP_START_DELAY 1000 // Delay NTP start 1 second
  1124. #endif
  1125. #ifndef NTP_DST_REGION
  1126. #define NTP_DST_REGION 0 // 0 for Europe, 1 for USA (defined in NtpClientLib)
  1127. #endif
  1128. #ifndef NTP_WAIT_FOR_SYNC
  1129. #define NTP_WAIT_FOR_SYNC 1 // Do not report any datetime until NTP sync'ed
  1130. #endif
  1131. // -----------------------------------------------------------------------------
  1132. // ALEXA
  1133. // -----------------------------------------------------------------------------
  1134. // This setting defines whether Alexa support should be built into the firmware
  1135. #ifndef ALEXA_SUPPORT
  1136. #define ALEXA_SUPPORT 1 // Enable Alexa support by default (10.84Kb)
  1137. #endif
  1138. // This is default value for the alexaEnabled setting that defines whether
  1139. // this device should be discoberable and respond to Alexa commands.
  1140. // Both ALEXA_SUPPORT and alexaEnabled should be 1 for Alexa support to work.
  1141. #ifndef ALEXA_ENABLED
  1142. #define ALEXA_ENABLED 1
  1143. #endif
  1144. #ifndef ALEXA_HOSTNAME
  1145. #define ALEXA_HOSTNAME ""
  1146. #endif
  1147. // -----------------------------------------------------------------------------
  1148. // MQTT RF BRIDGE
  1149. // -----------------------------------------------------------------------------
  1150. #ifndef RF_SUPPORT
  1151. #define RF_SUPPORT 0
  1152. #endif
  1153. #ifndef RF_DEBOUNCE
  1154. #define RF_DEBOUNCE 500
  1155. #endif
  1156. #ifndef RF_LEARN_TIMEOUT
  1157. #define RF_LEARN_TIMEOUT 60000
  1158. #endif
  1159. #ifndef RF_SEND_TIMES
  1160. #define RF_SEND_TIMES 4 // How many times to send the message
  1161. #endif
  1162. #ifndef RF_SEND_DELAY
  1163. #define RF_SEND_DELAY 500 // Interval between sendings in ms
  1164. #endif
  1165. #ifndef RF_RECEIVE_DELAY
  1166. #define RF_RECEIVE_DELAY 500 // Interval between recieving in ms (avoid debouncing)
  1167. #endif
  1168. // Enable RCSwitch support
  1169. // Originally implemented for SONOFF BASIC
  1170. // https://tinkerman.cat/adding-rf-to-a-non-rf-itead-sonoff/
  1171. // Also possible to use with SONOFF RF BRIDGE, thanks to @wildwiz
  1172. // https://github.com/xoseperez/espurna/wiki/Hardware-Itead-Sonoff-RF-Bridge---Direct-Hack
  1173. #ifndef RFB_DIRECT
  1174. #define RFB_DIRECT 0
  1175. #endif
  1176. #ifndef RFB_RX_PIN
  1177. #define RFB_RX_PIN GPIO_NONE
  1178. #endif
  1179. #ifndef RFB_TX_PIN
  1180. #define RFB_TX_PIN GPIO_NONE
  1181. #endif
  1182. // -----------------------------------------------------------------------------
  1183. // IR Bridge
  1184. // -----------------------------------------------------------------------------
  1185. #ifndef IR_SUPPORT
  1186. #define IR_SUPPORT 0 // Do not build with IR support by default (10.25Kb)
  1187. #endif
  1188. //#define IR_RX_PIN 5 // GPIO the receiver is connected to
  1189. //#define IR_TX_PIN 4 // GPIO the transmitter is connected to
  1190. #ifndef IR_USE_RAW
  1191. #define IR_USE_RAW 0 // Use raw codes
  1192. #endif
  1193. #ifndef IR_BUFFER_SIZE
  1194. #define IR_BUFFER_SIZE 1024
  1195. #endif
  1196. #ifndef IR_TIMEOUT
  1197. #define IR_TIMEOUT 15U
  1198. #endif
  1199. #ifndef IR_REPEAT
  1200. #define IR_REPEAT 1
  1201. #endif
  1202. #ifndef IR_DELAY
  1203. #define IR_DELAY 100
  1204. #endif
  1205. #ifndef IR_DEBOUNCE
  1206. #define IR_DEBOUNCE 500 // IR debounce time in milliseconds
  1207. #endif
  1208. #ifndef IR_BUTTON_SET
  1209. #define IR_BUTTON_SET 0 // IR button set to use (see below)
  1210. #endif
  1211. // -----------------------------------------------------------------------------
  1212. // Remote Buttons SET 1 (for the original Remote shipped with the controller)
  1213. #if IR_BUTTON_SET == 1
  1214. /*
  1215. +------+------+------+------+
  1216. | UP | Down | OFF | ON |
  1217. +------+------+------+------+
  1218. | R | G | B | W |
  1219. +------+------+------+------+
  1220. | 1 | 2 | 3 |FLASH |
  1221. +------+------+------+------+
  1222. | 4 | 5 | 6 |STROBE|
  1223. +------+------+------+------+
  1224. | 7 | 8 | 9 | FADE |
  1225. +------+------+------+------+
  1226. | 10 | 11 | 12 |SMOOTH|
  1227. +------+------+------+------+
  1228. */
  1229. #define IR_BUTTON_COUNT 24
  1230. const uint32_t IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  1231. { 0xFF906F, IR_BUTTON_MODE_BRIGHTER, 1 },
  1232. { 0xFFB847, IR_BUTTON_MODE_BRIGHTER, 0 },
  1233. { 0xFFF807, IR_BUTTON_MODE_STATE, 0 },
  1234. { 0xFFB04F, IR_BUTTON_MODE_STATE, 1 },
  1235. { 0xFF9867, IR_BUTTON_MODE_RGB, 0xFF0000 },
  1236. { 0xFFD827, IR_BUTTON_MODE_RGB, 0x00FF00 },
  1237. { 0xFF8877, IR_BUTTON_MODE_RGB, 0x0000FF },
  1238. { 0xFFA857, IR_BUTTON_MODE_RGB, 0xFFFFFF },
  1239. { 0xFFE817, IR_BUTTON_MODE_RGB, 0xD13A01 },
  1240. { 0xFF48B7, IR_BUTTON_MODE_RGB, 0x00E644 },
  1241. { 0xFF6897, IR_BUTTON_MODE_RGB, 0x0040A7 },
  1242. { 0xFFB24D, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FLASH },
  1243. { 0xFF02FD, IR_BUTTON_MODE_RGB, 0xE96F2A },
  1244. { 0xFF32CD, IR_BUTTON_MODE_RGB, 0x00BEBF },
  1245. { 0xFF20DF, IR_BUTTON_MODE_RGB, 0x56406F },
  1246. { 0xFF00FF, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_STROBE },
  1247. { 0xFF50AF, IR_BUTTON_MODE_RGB, 0xEE9819 },
  1248. { 0xFF7887, IR_BUTTON_MODE_RGB, 0x00799A },
  1249. { 0xFF708F, IR_BUTTON_MODE_RGB, 0x944E80 },
  1250. { 0xFF58A7, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FADE },
  1251. { 0xFF38C7, IR_BUTTON_MODE_RGB, 0xFFFF00 },
  1252. { 0xFF28D7, IR_BUTTON_MODE_RGB, 0x0060A1 },
  1253. { 0xFFF00F, IR_BUTTON_MODE_RGB, 0xEF45AD },
  1254. { 0xFF30CF, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_SMOOTH }
  1255. };
  1256. #endif
  1257. //Remote Buttons SET 2 (another identical IR Remote shipped with another controller)
  1258. #if IR_BUTTON_SET == 2
  1259. /*
  1260. +------+------+------+------+
  1261. | UP | Down | OFF | ON |
  1262. +------+------+------+------+
  1263. | R | G | B | W |
  1264. +------+------+------+------+
  1265. | 1 | 2 | 3 |FLASH |
  1266. +------+------+------+------+
  1267. | 4 | 5 | 6 |STROBE|
  1268. +------+------+------+------+
  1269. | 7 | 8 | 9 | FADE |
  1270. +------+------+------+------+
  1271. | 10 | 11 | 12 |SMOOTH|
  1272. +------+------+------+------+
  1273. */
  1274. #define IR_BUTTON_COUNT 24
  1275. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  1276. { 0xFF00FF, IR_BUTTON_MODE_BRIGHTER, 1 },
  1277. { 0xFF807F, IR_BUTTON_MODE_BRIGHTER, 0 },
  1278. { 0xFF40BF, IR_BUTTON_MODE_STATE, 0 },
  1279. { 0xFFC03F, IR_BUTTON_MODE_STATE, 1 },
  1280. { 0xFF20DF, IR_BUTTON_MODE_RGB, 0xFF0000 },
  1281. { 0xFFA05F, IR_BUTTON_MODE_RGB, 0x00FF00 },
  1282. { 0xFF609F, IR_BUTTON_MODE_RGB, 0x0000FF },
  1283. { 0xFFE01F, IR_BUTTON_MODE_RGB, 0xFFFFFF },
  1284. { 0xFF10EF, IR_BUTTON_MODE_RGB, 0xD13A01 },
  1285. { 0xFF906F, IR_BUTTON_MODE_RGB, 0x00E644 },
  1286. { 0xFF50AF, IR_BUTTON_MODE_RGB, 0x0040A7 },
  1287. { 0xFFD02F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FLASH },
  1288. { 0xFF30CF, IR_BUTTON_MODE_RGB, 0xE96F2A },
  1289. { 0xFFB04F, IR_BUTTON_MODE_RGB, 0x00BEBF },
  1290. { 0xFF708F, IR_BUTTON_MODE_RGB, 0x56406F },
  1291. { 0xFFF00F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_STROBE },
  1292. { 0xFF08F7, IR_BUTTON_MODE_RGB, 0xEE9819 },
  1293. { 0xFF8877, IR_BUTTON_MODE_RGB, 0x00799A },
  1294. { 0xFF48B7, IR_BUTTON_MODE_RGB, 0x944E80 },
  1295. { 0xFFC837, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FADE },
  1296. { 0xFF28D7, IR_BUTTON_MODE_RGB, 0xFFFF00 },
  1297. { 0xFFA857, IR_BUTTON_MODE_RGB, 0x0060A1 },
  1298. { 0xFF6897, IR_BUTTON_MODE_RGB, 0xEF45AD },
  1299. { 0xFFE817, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_SMOOTH }
  1300. };
  1301. #endif
  1302. //Remote Buttons SET 3 (samsung AA59-00608A 8 Toggle Buttons for generic 8CH module)
  1303. #if IR_BUTTON_SET == 3
  1304. /*
  1305. +------+------+------+
  1306. | 1 | 2 | 3 |
  1307. +------+------+------+
  1308. | 4 | 5 | 6 |
  1309. +------+------+------+
  1310. | 7 | 8 | 9 |
  1311. +------+------+------+
  1312. | | 0 | |
  1313. +------+------+------+
  1314. */
  1315. #define IR_BUTTON_COUNT 10
  1316. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  1317. { 0xE0E020DF, IR_BUTTON_MODE_TOGGLE, 0 }, // Toggle Relay #0
  1318. { 0xE0E0A05F, IR_BUTTON_MODE_TOGGLE, 1 }, // Toggle Relay #1
  1319. { 0xE0E0609F, IR_BUTTON_MODE_TOGGLE, 2 }, // Toggle Relay #2
  1320. { 0xE0E010EF, IR_BUTTON_MODE_TOGGLE, 3 }, // Toggle Relay #3
  1321. { 0xE0E0906F, IR_BUTTON_MODE_TOGGLE, 4 }, // Toggle Relay #4
  1322. { 0xE0E050AF, IR_BUTTON_MODE_TOGGLE, 5 }, // Toggle Relay #5
  1323. { 0xE0E030CF, IR_BUTTON_MODE_TOGGLE, 6 }, // Toggle Relay #6
  1324. { 0xE0E0B04F, IR_BUTTON_MODE_TOGGLE, 7 } // Toggle Relay #7
  1325. //{ 0xE0E0708F, IR_BUTTON_MODE_TOGGLE, 8 } //Extra Button
  1326. //{ 0xE0E08877, IR_BUTTON_MODE_TOGGLE, 9 } //Extra Button
  1327. };
  1328. #endif
  1329. //Remote Buttons SET 4
  1330. #if IR_BUTTON_SET == 4
  1331. /*
  1332. +------+------+------+
  1333. | OFF | SRC | MUTE |
  1334. +------+------+------+
  1335. ...
  1336. +------+------+------+
  1337. */
  1338. #define IR_BUTTON_COUNT 1
  1339. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  1340. { 0xFFB24D, IR_BUTTON_MODE_TOGGLE, 0 } // Toggle Relay #0
  1341. };
  1342. #endif
  1343. //Remote Buttons SET 5 (another identical IR Remote shipped with another controller as SET 1 and 2)
  1344. #if IR_BUTTON_SET == 5
  1345. /*
  1346. +------+------+------+------+
  1347. | UP | Down | OFF | ON |
  1348. +------+------+------+------+
  1349. | R | G | B | W |
  1350. +------+------+------+------+
  1351. | 1 | 2 | 3 |FLASH |
  1352. +------+------+------+------+
  1353. | 4 | 5 | 6 |STROBE|
  1354. +------+------+------+------+
  1355. | 7 | 8 | 9 | FADE |
  1356. +------+------+------+------+
  1357. | 10 | 11 | 12 |SMOOTH|
  1358. +------+------+------+------+
  1359. */
  1360. #define IR_BUTTON_COUNT 24
  1361. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  1362. { 0xF700FF, IR_BUTTON_MODE_BRIGHTER, 1 },
  1363. { 0xF7807F, IR_BUTTON_MODE_BRIGHTER, 0 },
  1364. { 0xF740BF, IR_BUTTON_MODE_STATE, 0 },
  1365. { 0xF7C03F, IR_BUTTON_MODE_STATE, 1 },
  1366. { 0xF720DF, IR_BUTTON_MODE_RGB, 0xFF0000 },
  1367. { 0xF7A05F, IR_BUTTON_MODE_RGB, 0x00FF00 },
  1368. { 0xF7609F, IR_BUTTON_MODE_RGB, 0x0000FF },
  1369. { 0xF7E01F, IR_BUTTON_MODE_RGB, 0xFFFFFF },
  1370. { 0xF710EF, IR_BUTTON_MODE_RGB, 0xD13A01 },
  1371. { 0xF7906F, IR_BUTTON_MODE_RGB, 0x00E644 },
  1372. { 0xF750AF, IR_BUTTON_MODE_RGB, 0x0040A7 },
  1373. { 0xF7D02F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FLASH },
  1374. { 0xF730CF, IR_BUTTON_MODE_RGB, 0xE96F2A },
  1375. { 0xF7B04F, IR_BUTTON_MODE_RGB, 0x00BEBF },
  1376. { 0xF7708F, IR_BUTTON_MODE_RGB, 0x56406F },
  1377. { 0xF7F00F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_STROBE },
  1378. { 0xF708F7, IR_BUTTON_MODE_RGB, 0xEE9819 },
  1379. { 0xF78877, IR_BUTTON_MODE_RGB, 0x00799A },
  1380. { 0xF748B7, IR_BUTTON_MODE_RGB, 0x944E80 },
  1381. { 0xF7C837, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FADE },
  1382. { 0xF728D7, IR_BUTTON_MODE_RGB, 0xFFFF00 },
  1383. { 0xF7A857, IR_BUTTON_MODE_RGB, 0x0060A1 },
  1384. { 0xF76897, IR_BUTTON_MODE_RGB, 0xEF45AD },
  1385. { 0xF7E817, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_SMOOTH }
  1386. };
  1387. #endif
  1388. #ifndef IR_BUTTON_COUNT
  1389. #define IR_BUTTON_COUNT 0
  1390. #endif
  1391. //--------------------------------------------------------------------------------
  1392. // Custom RFM69 to MQTT bridge
  1393. // Check http://tinkerman.cat/rfm69-wifi-gateway/
  1394. // Enable support by passing RFM69_SUPPORT=1 build flag
  1395. //--------------------------------------------------------------------------------
  1396. #ifndef RFM69_SUPPORT
  1397. #define RFM69_SUPPORT 0
  1398. #endif
  1399. #ifndef RFM69_MAX_TOPICS
  1400. #define RFM69_MAX_TOPICS 50
  1401. #endif
  1402. #ifndef RFM69_MAX_NODES
  1403. #define RFM69_MAX_NODES 255
  1404. #endif
  1405. #ifndef RFM69_DEFAULT_TOPIC
  1406. #define RFM69_DEFAULT_TOPIC "/rfm69gw/{node}/{key}"
  1407. #endif
  1408. #ifndef RFM69_NODE_ID
  1409. #define RFM69_NODE_ID 1
  1410. #endif
  1411. #ifndef RFM69_GATEWAY_ID
  1412. #define RFM69_GATEWAY_ID 1
  1413. #endif
  1414. #ifndef RFM69_NETWORK_ID
  1415. #define RFM69_NETWORK_ID 164
  1416. #endif
  1417. #ifndef RFM69_PROMISCUOUS
  1418. #define RFM69_PROMISCUOUS 0
  1419. #endif
  1420. #ifndef RFM69_PROMISCUOUS_SENDS
  1421. #define RFM69_PROMISCUOUS_SENDS 0
  1422. #endif
  1423. #ifndef RFM69_FREQUENCY
  1424. #define RFM69_FREQUENCY RF69_868MHZ
  1425. #endif
  1426. #ifndef RFM69_ENCRYPTKEY
  1427. #define RFM69_ENCRYPTKEY "fibonacci0123456"
  1428. #endif
  1429. #ifndef RFM69_CS_PIN
  1430. #define RFM69_CS_PIN SS
  1431. #endif
  1432. #ifndef RFM69_IRQ_PIN
  1433. #define RFM69_IRQ_PIN 5
  1434. #endif
  1435. #ifndef RFM69_RESET_PIN
  1436. #define RFM69_RESET_PIN 7
  1437. #endif
  1438. #ifndef RFM69_IS_RFM69HW
  1439. #define RFM69_IS_RFM69HW 0
  1440. #endif
  1441. //--------------------------------------------------------------------------------
  1442. // TUYA switch & dimmer support
  1443. //--------------------------------------------------------------------------------
  1444. #ifndef TUYA_SUPPORT
  1445. #define TUYA_SUPPORT 0
  1446. #endif
  1447. #ifndef TUYA_SERIAL
  1448. #define TUYA_SERIAL Serial
  1449. #endif