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.

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