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.

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