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.

1204 lines
40 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
8 years ago
8 years ago
6 years ago
6 years ago
6 years ago
6 years ago
8 years ago
6 years ago
  1. // // //------------------------------------------------------------------------------
  2. // Do not change this file unless you know what you are doing
  3. // Configuration settings are in the settings.h file
  4. //------------------------------------------------------------------------------
  5. //------------------------------------------------------------------------------
  6. // GENERAL
  7. //------------------------------------------------------------------------------
  8. #define DEVICE_NAME MANUFACTURER "_" DEVICE // Concatenate both to get a unique device name
  9. #ifndef ADMIN_PASS
  10. #define ADMIN_PASS "fibonacci" // Default password (WEB, OTA, WIFI)
  11. #endif
  12. #ifndef USE_PASSWORD
  13. #define USE_PASSWORD 1 // Insecurity caution! Disabling this will disable password querying completely.
  14. #endif
  15. #ifndef LOOP_DELAY_TIME
  16. #define LOOP_DELAY_TIME 10 // Delay for this millis in the main loop [0-250]
  17. #endif
  18. //------------------------------------------------------------------------------
  19. // DEBUG
  20. //------------------------------------------------------------------------------
  21. // Serial debug log
  22. #ifndef DEBUG_SERIAL_SUPPORT
  23. #define DEBUG_SERIAL_SUPPORT 1 // Enable serial debug log
  24. #endif
  25. #ifndef DEBUG_PORT
  26. #define DEBUG_PORT Serial // Default debugging port
  27. #endif
  28. #ifndef SERIAL_BAUDRATE
  29. #define SERIAL_BAUDRATE 115200 // Default baudrate
  30. #endif
  31. #ifndef DEBUG_ADD_TIMESTAMP
  32. #define DEBUG_ADD_TIMESTAMP 1 // Add timestamp to debug messages
  33. // (in millis overflowing every 1000 seconds)
  34. #endif
  35. // Second serial port (used for RX)
  36. #ifndef SERIAL_RX_ENABLED
  37. #define SERIAL_RX_ENABLED 0 // Secondary serial port for RX
  38. #endif
  39. #ifndef SERIAL_RX_PORT
  40. #define SERIAL_RX_PORT Serial // This setting is usually defined
  41. // in the hardware.h file for those
  42. // boards that require it
  43. #endif
  44. #ifndef SERIAL_RX_BAUDRATE
  45. #define SERIAL_RX_BAUDRATE 115200 // Default baudrate
  46. #endif
  47. //------------------------------------------------------------------------------
  48. // UDP debug log
  49. // To receive the message son the destination computer use nc:
  50. // nc -ul 8113
  51. #ifndef DEBUG_UDP_SUPPORT
  52. #define DEBUG_UDP_SUPPORT 0 // Enable UDP debug log
  53. #endif
  54. #ifndef DEBUG_UDP_IP
  55. #define DEBUG_UDP_IP IPAddress(192, 168, 1, 100)
  56. #endif
  57. #ifndef DEBUG_UDP_PORT
  58. #define DEBUG_UDP_PORT 514
  59. #endif
  60. // If DEBUG_UDP_PORT is set to 514 syslog format is assumed
  61. // (https://tools.ietf.org/html/rfc3164)
  62. // DEBUG_UDP_FAC_PRI is the facility+priority
  63. #define DEBUG_UDP_FAC_PRI (SYSLOG_LOCAL0 | SYSLOG_DEBUG)
  64. //------------------------------------------------------------------------------
  65. #ifndef DEBUG_TELNET_SUPPORT
  66. #define DEBUG_TELNET_SUPPORT 1 // Enable telnet debug log (will only work if TELNET_SUPPORT is also 1)
  67. #endif
  68. //------------------------------------------------------------------------------
  69. #ifndef DEBUG_WEB_SUPPORT
  70. #define DEBUG_WEB_SUPPORT 1 // Enable web debug log (will only work if WEB_SUPPORT is also 1)
  71. #endif
  72. //------------------------------------------------------------------------------
  73. // TELNET
  74. //------------------------------------------------------------------------------
  75. #ifndef TELNET_SUPPORT
  76. #define TELNET_SUPPORT 1 // Enable telnet support by default (3.34Kb)
  77. #endif
  78. #ifndef TELNET_STA
  79. #define TELNET_STA 0 // By default, disallow connections via STA interface
  80. #endif
  81. #define TELNET_PORT 23 // Port to listen to telnet clients
  82. #define TELNET_MAX_CLIENTS 1 // Max number of concurrent telnet clients
  83. //------------------------------------------------------------------------------
  84. // TERMINAL
  85. //------------------------------------------------------------------------------
  86. #ifndef TERMINAL_SUPPORT
  87. #define TERMINAL_SUPPORT 1 // Enable terminal commands (0.97Kb)
  88. #endif
  89. #define TERMINAL_BUFFER_SIZE 128 // Max size for commands commands
  90. //------------------------------------------------------------------------------
  91. // SYSTEM CHECK
  92. //------------------------------------------------------------------------------
  93. #ifndef SYSTEM_CHECK_ENABLED
  94. #define SYSTEM_CHECK_ENABLED 1 // Enable crash check by default
  95. #endif
  96. #ifndef SYSTEM_CHECK_TIME
  97. #define SYSTEM_CHECK_TIME 60000 // The system is considered stable after these many millis
  98. #endif
  99. #ifndef SYSTEM_CHECK_MAX
  100. #define SYSTEM_CHECK_MAX 5 // After this many crashes on boot
  101. // the system is flagged as unstable
  102. #endif
  103. //------------------------------------------------------------------------------
  104. // EEPROM
  105. //------------------------------------------------------------------------------
  106. #define EEPROM_SIZE 4096 // EEPROM size in bytes
  107. //#define EEPROM_RORATE_SECTORS 2 // Number of sectors to use for EEPROM rotation
  108. // If not defined the firmware will use a number based
  109. // on the number of available sectors
  110. #define EEPROM_RELAY_STATUS 0 // Address for the relay status (1 byte)
  111. #define EEPROM_ENERGY_COUNT 1 // Address for the energy counter (4 bytes)
  112. #define EEPROM_CUSTOM_RESET 5 // Address for the reset reason (1 byte)
  113. #define EEPROM_CRASH_COUNTER 6 // Address for the crash counter (1 byte)
  114. #define EEPROM_MESSAGE_ID 7 // Address for the MQTT message id (4 bytes)
  115. #define EEPROM_ROTATE_DATA 11 // Reserved for the EEPROM_ROTATE library (3 bytes)
  116. #define EEPROM_DATA_END 14 // End of custom EEPROM data block
  117. //------------------------------------------------------------------------------
  118. // HEARTBEAT
  119. //------------------------------------------------------------------------------
  120. #ifndef HEARTBEAT_ENABLED
  121. #define HEARTBEAT_ENABLED 1
  122. #endif
  123. #ifndef HEARTBEAT_INTERVAL
  124. #define HEARTBEAT_INTERVAL 300000 // Interval between heartbeat messages (in ms)
  125. #endif
  126. #define UPTIME_OVERFLOW 4294967295 // Uptime overflow value
  127. // Topics that will be reported in heartbeat
  128. #define HEARTBEAT_REPORT_STATUS 1
  129. #define HEARTBEAT_REPORT_IP 1
  130. #define HEARTBEAT_REPORT_MAC 1
  131. #define HEARTBEAT_REPORT_RSSI 1
  132. #define HEARTBEAT_REPORT_UPTIME 1
  133. #define HEARTBEAT_REPORT_DATETIME 1
  134. #define HEARTBEAT_REPORT_FREEHEAP 1
  135. #define HEARTBEAT_REPORT_VCC 1
  136. #define HEARTBEAT_REPORT_RELAY 1
  137. #define HEARTBEAT_REPORT_LIGHT 1
  138. #define HEARTBEAT_REPORT_HOSTNAME 1
  139. #define HEARTBEAT_REPORT_APP 1
  140. #define HEARTBEAT_REPORT_VERSION 1
  141. #define HEARTBEAT_REPORT_BOARD 1
  142. #define HEARTBEAT_REPORT_INTERVAL 0
  143. //------------------------------------------------------------------------------
  144. // Load average
  145. //------------------------------------------------------------------------------
  146. #ifndef LOADAVG_INTERVAL
  147. #define LOADAVG_INTERVAL 30000 // Interval between calculating load average (in ms)
  148. #endif
  149. #ifndef LOADAVG_REPORT
  150. #define LOADAVG_REPORT 1 // Should we report Load average over MQTT?
  151. #endif
  152. //------------------------------------------------------------------------------
  153. // BUTTON
  154. //------------------------------------------------------------------------------
  155. #ifndef BUTTON_DEBOUNCE_DELAY
  156. #define BUTTON_DEBOUNCE_DELAY 50 // Debounce delay (ms)
  157. #endif
  158. #ifndef BUTTON_DBLCLICK_DELAY
  159. #define BUTTON_DBLCLICK_DELAY 500 // Time in ms to wait for a second (or third...) click
  160. #endif
  161. #ifndef BUTTON_LNGCLICK_DELAY
  162. #define BUTTON_LNGCLICK_DELAY 1000 // Time in ms holding the button down to get a long click
  163. #endif
  164. #ifndef BUTTON_LNGLNGCLICK_DELAY
  165. #define BUTTON_LNGLNGCLICK_DELAY 10000 // Time in ms holding the button down to get a long-long click
  166. #endif
  167. //------------------------------------------------------------------------------
  168. // RELAY
  169. //------------------------------------------------------------------------------
  170. // Default boot mode: 0 means OFF, 1 ON and 2 whatever was before
  171. #ifndef RELAY_BOOT_MODE
  172. #define RELAY_BOOT_MODE RELAY_BOOT_OFF
  173. #endif
  174. // 0 means ANY, 1 zero or one and 2 one and only one
  175. #ifndef RELAY_SYNC
  176. #define RELAY_SYNC RELAY_SYNC_ANY
  177. #endif
  178. // Default pulse mode: 0 means no pulses, 1 means normally off, 2 normally on
  179. #ifndef RELAY_PULSE_MODE
  180. #define RELAY_PULSE_MODE RELAY_PULSE_NONE
  181. #endif
  182. // Default pulse time in seconds
  183. #ifndef RELAY_PULSE_TIME
  184. #define RELAY_PULSE_TIME 1.0
  185. #endif
  186. // Relay requests flood protection window - in seconds
  187. #ifndef RELAY_FLOOD_WINDOW
  188. #define RELAY_FLOOD_WINDOW 3
  189. #endif
  190. // Allowed actual relay changes inside requests flood protection window
  191. #ifndef RELAY_FLOOD_CHANGES
  192. #define RELAY_FLOOD_CHANGES 5
  193. #endif
  194. // Pulse with in milliseconds for a latched relay
  195. #ifndef RELAY_LATCHING_PULSE
  196. #define RELAY_LATCHING_PULSE 10
  197. #endif
  198. // Do not save relay state after these many milliseconds
  199. #ifndef RELAY_SAVE_DELAY
  200. #define RELAY_SAVE_DELAY 1000
  201. #endif
  202. // -----------------------------------------------------------------------------
  203. // WIFI
  204. // -----------------------------------------------------------------------------
  205. #ifndef WIFI_CONNECT_TIMEOUT
  206. #define WIFI_CONNECT_TIMEOUT 60000 // Connecting timeout for WIFI in ms
  207. #endif
  208. #ifndef WIFI_RECONNECT_INTERVAL
  209. #define WIFI_RECONNECT_INTERVAL 180000 // If could not connect to WIFI, retry after this time in ms
  210. #endif
  211. #ifndef WIFI_MAX_NETWORKS
  212. #define WIFI_MAX_NETWORKS 5 // Max number of WIFI connection configurations
  213. #endif
  214. #ifndef WIFI_AP_CAPTIVE
  215. #define WIFI_AP_CAPTIVE 1 // Captive portal enabled when in AP mode
  216. #endif
  217. #ifndef WIFI_SLEEP_MODE
  218. #define WIFI_SLEEP_MODE WIFI_NONE_SLEEP // WIFI_NONE_SLEEP, WIFI_LIGHT_SLEEP or WIFI_MODEM_SLEEP
  219. #endif
  220. #ifndef WIFI_SCAN_NETWORKS
  221. #define WIFI_SCAN_NETWORKS 1 // Perform a network scan before connecting
  222. #endif
  223. // Optional hardcoded configuration (up to 2 networks)
  224. #ifndef WIFI1_SSID
  225. #define WIFI1_SSID ""
  226. #endif
  227. #ifndef WIFI1_PASS
  228. #define WIFI1_PASS ""
  229. #endif
  230. #ifndef WIFI1_IP
  231. #define WIFI1_IP ""
  232. #endif
  233. #ifndef WIFI1_GW
  234. #define WIFI1_GW ""
  235. #endif
  236. #ifndef WIFI1_MASK
  237. #define WIFI1_MASK ""
  238. #endif
  239. #ifndef WIFI1_DNS
  240. #define WIFI1_DNS ""
  241. #endif
  242. #ifndef WIFI2_SSID
  243. #define WIFI2_SSID ""
  244. #endif
  245. #ifndef WIFI2_PASS
  246. #define WIFI2_PASS ""
  247. #endif
  248. #ifndef WIFI2_IP
  249. #define WIFI2_IP ""
  250. #endif
  251. #ifndef WIFI2_GW
  252. #define WIFI2_GW ""
  253. #endif
  254. #ifndef WIFI2_MASK
  255. #define WIFI2_MASK ""
  256. #endif
  257. #ifndef WIFI2_DNS
  258. #define WIFI2_DNS ""
  259. #endif
  260. #ifndef WIFI_RSSI_1M
  261. #define WIFI_RSSI_1M -30 // Calibrate it with your router reading the RSSI at 1m
  262. #endif
  263. #ifndef WIFI_PROPAGATION_CONST
  264. #define WIFI_PROPAGATION_CONST 4 // This is typically something between 2.7 to 4.3 (free space is 2)
  265. #endif
  266. // -----------------------------------------------------------------------------
  267. // WEB
  268. // -----------------------------------------------------------------------------
  269. #ifndef WEB_SUPPORT
  270. #define WEB_SUPPORT 1 // Enable web support (http, api, 121.65Kb)
  271. #endif
  272. #ifndef WEB_EMBEDDED
  273. #define WEB_EMBEDDED 1 // Build the firmware with the web interface embedded in
  274. #endif
  275. // This is not working at the moment!!
  276. // Requires ASYNC_TCP_SSL_ENABLED to 1 and ESP8266 Arduino Core 2.4.0
  277. #ifndef WEB_SSL_ENABLED
  278. #define WEB_SSL_ENABLED 0 // Use HTTPS web interface
  279. #endif
  280. #ifndef WEB_USERNAME
  281. #define WEB_USERNAME "admin" // HTTP username
  282. #endif
  283. #ifndef WEB_FORCE_PASS_CHANGE
  284. #define WEB_FORCE_PASS_CHANGE 1 // Force the user to change the password if default one
  285. #endif
  286. #ifndef WEB_PORT
  287. #define WEB_PORT 80 // HTTP port
  288. #endif
  289. // -----------------------------------------------------------------------------
  290. // WEBSOCKETS
  291. // -----------------------------------------------------------------------------
  292. // This will only be enabled if WEB_SUPPORT is 1 (this is the default value)
  293. #ifndef WS_AUTHENTICATION
  294. #define WS_AUTHENTICATION 1 // WS authentication ON by default (see #507)
  295. #endif
  296. #ifndef WS_BUFFER_SIZE
  297. #define WS_BUFFER_SIZE 5 // Max number of secured websocket connections
  298. #endif
  299. #ifndef WS_TIMEOUT
  300. #define WS_TIMEOUT 1800000 // Timeout for secured websocket
  301. #endif
  302. #ifndef WS_UPDATE_INTERVAL
  303. #define WS_UPDATE_INTERVAL 30000 // Update clients every 30 seconds
  304. #endif
  305. // -----------------------------------------------------------------------------
  306. // API
  307. // -----------------------------------------------------------------------------
  308. // This will only be enabled if WEB_SUPPORT is 1 (this is the default value)
  309. #ifndef API_ENABLED
  310. #define API_ENABLED 0 // Do not enable API by default
  311. #endif
  312. #ifndef API_BUFFER_SIZE
  313. #define API_BUFFER_SIZE 15 // Size of the buffer for HTTP GET API responses
  314. #endif
  315. #ifndef API_REAL_TIME_VALUES
  316. #define API_REAL_TIME_VALUES 0 // Show filtered/median values by default (0 => median, 1 => real time)
  317. #endif
  318. // -----------------------------------------------------------------------------
  319. // MDNS / LLMNR / NETBIOS / SSDP
  320. // -----------------------------------------------------------------------------
  321. #ifndef MDNS_SERVER_SUPPORT
  322. #define MDNS_SERVER_SUPPORT 1 // Publish services using mDNS by default (1.48Kb)
  323. #endif
  324. #ifndef MDNS_CLIENT_SUPPORT
  325. #define MDNS_CLIENT_SUPPORT 0 // Resolve mDNS names (3.44Kb)
  326. #endif
  327. #ifndef LLMNR_SUPPORT
  328. #define LLMNR_SUPPORT 0 // Publish device using LLMNR protocol by default (1.95Kb) - requires 2.4.0
  329. #endif
  330. #ifndef NETBIOS_SUPPORT
  331. #define NETBIOS_SUPPORT 0 // Publish device using NetBIOS protocol by default (1.26Kb) - requires 2.4.0
  332. #endif
  333. #ifndef SSDP_SUPPORT
  334. #define SSDP_SUPPORT 0 // Publish device using SSDP protocol by default (4.59Kb)
  335. // Not compatible with ALEXA_SUPPORT at the moment
  336. #endif
  337. #ifndef SSDP_DEVICE_TYPE
  338. #define SSDP_DEVICE_TYPE "upnp:rootdevice"
  339. //#define SSDP_DEVICE_TYPE "urn:schemas-upnp-org:device:BinaryLight:1"
  340. #endif
  341. // -----------------------------------------------------------------------------
  342. // SPIFFS
  343. // -----------------------------------------------------------------------------
  344. #ifndef SPIFFS_SUPPORT
  345. #define SPIFFS_SUPPORT 0 // Do not add support for SPIFFS by default
  346. #endif
  347. // -----------------------------------------------------------------------------
  348. // OTA
  349. // -----------------------------------------------------------------------------
  350. #ifndef OTA_PORT
  351. #define OTA_PORT 8266 // OTA port
  352. #endif
  353. #define OTA_GITHUB_FP "D7:9F:07:61:10:B3:92:93:E3:49:AC:89:84:5B:03:80:C1:9E:2F:8B"
  354. // -----------------------------------------------------------------------------
  355. // NOFUSS
  356. // -----------------------------------------------------------------------------
  357. #ifndef NOFUSS_SUPPORT
  358. #define NOFUSS_SUPPORT 0 // Do not enable support for NoFuss by default (12.65Kb)
  359. #endif
  360. #ifndef NOFUSS_ENABLED
  361. #define NOFUSS_ENABLED 0 // Do not perform NoFUSS updates by default
  362. #endif
  363. #ifndef NOFUSS_SERVER
  364. #define NOFUSS_SERVER "" // Default NoFuss Server
  365. #endif
  366. #ifndef NOFUSS_INTERVAL
  367. #define NOFUSS_INTERVAL 3600000 // Check for updates every hour
  368. #endif
  369. // -----------------------------------------------------------------------------
  370. // UART <-> MQTT
  371. // -----------------------------------------------------------------------------
  372. #ifndef UART_MQTT_SUPPORT
  373. #define UART_MQTT_SUPPORT 0 // No support by default
  374. #endif
  375. #ifndef UART_MQTT_USE_SOFT
  376. #define UART_MQTT_USE_SOFT 0 // Use SoftwareSerial
  377. #endif
  378. #ifndef UART_MQTT_HW_PORT
  379. #define UART_MQTT_HW_PORT Serial // Hardware serial port (if UART_MQTT_USE_SOFT == 0)
  380. #endif
  381. #ifndef UART_MQTT_RX_PIN
  382. #define UART_MQTT_RX_PIN 4 // RX PIN (if UART_MQTT_USE_SOFT == 1)
  383. #endif
  384. #ifndef UART_MQTT_TX_PIN
  385. #define UART_MQTT_TX_PIN 5 // TX PIN (if UART_MQTT_USE_SOFT == 1)
  386. #endif
  387. #ifndef UART_MQTT_BAUDRATE
  388. #define UART_MQTT_BAUDRATE 115200 // Serial speed
  389. #endif
  390. #ifndef UART_MQTT_TERMINATION
  391. #define UART_MQTT_TERMINATION '\n' // Termination character
  392. #endif
  393. #define UART_MQTT_BUFFER_SIZE 100 // UART buffer size
  394. // -----------------------------------------------------------------------------
  395. // MQTT
  396. // -----------------------------------------------------------------------------
  397. #ifndef MQTT_SUPPORT
  398. #define MQTT_SUPPORT 1 // MQTT support (22.38Kb async, 12.48Kb sync)
  399. #endif
  400. #ifndef MQTT_USE_ASYNC
  401. #define MQTT_USE_ASYNC 1 // Use AysncMQTTClient (1) or PubSubClient (0)
  402. #endif
  403. // MQTT OVER SSL
  404. // Using MQTT over SSL works pretty well but generates problems with the web interface.
  405. // It could be a good idea to use it in conjuntion with WEB_SUPPORT=0.
  406. // Requires ASYNC_TCP_SSL_ENABLED to 1 and ESP8266 Arduino Core 2.4.0.
  407. //
  408. // You can use SSL with MQTT_USE_ASYNC=1 (AsyncMqttClient library)
  409. // but you might experience hiccups on the web interface, so my recommendation is:
  410. // WEB_SUPPORT=0
  411. //
  412. // If you use SSL with MQTT_USE_ASYNC=0 (PubSubClient library)
  413. // you will have to disable all the modules that use ESPAsyncTCP, that is:
  414. // ALEXA_SUPPORT=0, INFLUXDB_SUPPORT=0, TELNET_SUPPORT=0, THINGSPEAK_SUPPORT=0 and WEB_SUPPORT=0
  415. //
  416. // You will need the fingerprint for your MQTT server, example for CloudMQTT:
  417. // $ echo -n | openssl s_client -connect m11.cloudmqtt.com:24055 > cloudmqtt.pem
  418. // $ openssl x509 -noout -in cloudmqtt.pem -fingerprint -sha1
  419. #ifndef MQTT_SSL_ENABLED
  420. #define MQTT_SSL_ENABLED 0 // By default MQTT over SSL will not be enabled
  421. #endif
  422. #ifndef MQTT_SSL_FINGERPRINT
  423. #define MQTT_SSL_FINGERPRINT "" // SSL fingerprint of the server
  424. #endif
  425. #ifndef MQTT_ENABLED
  426. #define MQTT_ENABLED 0 // Do not enable MQTT connection by default
  427. #endif
  428. #ifndef MQTT_AUTOCONNECT
  429. #define MQTT_AUTOCONNECT 1 // If enabled and MDNS_SERVER_SUPPORT=1 will perform an autodiscover and
  430. // autoconnect to the first MQTT broker found if none defined
  431. #endif
  432. #ifndef MQTT_SERVER
  433. #define MQTT_SERVER "" // Default MQTT broker address
  434. #endif
  435. #ifndef MQTT_USER
  436. #define MQTT_USER "" // Default MQTT broker usename
  437. #endif
  438. #ifndef MQTT_PASS
  439. #define MQTT_PASS "" // Default MQTT broker password
  440. #endif
  441. #ifndef MQTT_PORT
  442. #define MQTT_PORT 1883 // MQTT broker port
  443. #endif
  444. #ifndef MQTT_TOPIC
  445. #define MQTT_TOPIC "{hostname}" // Default MQTT base topic
  446. #endif
  447. #ifndef MQTT_RETAIN
  448. #define MQTT_RETAIN true // MQTT retain flag
  449. #endif
  450. #ifndef MQTT_QOS
  451. #define MQTT_QOS 0 // MQTT QoS value for all messages
  452. #endif
  453. #ifndef MQTT_KEEPALIVE
  454. #define MQTT_KEEPALIVE 300 // MQTT keepalive value
  455. #endif
  456. #ifndef MQTT_RECONNECT_DELAY_MIN
  457. #define MQTT_RECONNECT_DELAY_MIN 5000 // Try to reconnect in 5 seconds upon disconnection
  458. #endif
  459. #ifndef MQTT_RECONNECT_DELAY_STEP
  460. #define MQTT_RECONNECT_DELAY_STEP 5000 // Increase the reconnect delay in 5 seconds after each failed attempt
  461. #endif
  462. #ifndef MQTT_RECONNECT_DELAY_MAX
  463. #define MQTT_RECONNECT_DELAY_MAX 120000 // Set reconnect time to 2 minutes at most
  464. #endif
  465. #ifndef MQTT_SKIP_RETAINED
  466. #define MQTT_SKIP_RETAINED 1 // Skip retained messages on connection
  467. #endif
  468. #ifndef MQTT_SKIP_TIME
  469. #define MQTT_SKIP_TIME 1000 // Skip messages for 1 second anter connection
  470. #endif
  471. #ifndef MQTT_USE_JSON
  472. #define MQTT_USE_JSON 0 // Group messages in a JSON body
  473. #endif
  474. #ifndef MQTT_USE_JSON_DELAY
  475. #define MQTT_USE_JSON_DELAY 100 // Wait this many ms before grouping messages
  476. #endif
  477. #ifndef MQTT_QUEUE_MAX_SIZE
  478. #define MQTT_QUEUE_MAX_SIZE 20 // Size of the MQTT queue when MQTT_USE_JSON is enabled
  479. #endif
  480. // These are the properties that will be sent when useJson is true
  481. #ifndef MQTT_ENQUEUE_IP
  482. #define MQTT_ENQUEUE_IP 1
  483. #endif
  484. #ifndef MQTT_ENQUEUE_MAC
  485. #define MQTT_ENQUEUE_MAC 1
  486. #endif
  487. #ifndef MQTT_ENQUEUE_HOSTNAME
  488. #define MQTT_ENQUEUE_HOSTNAME 1
  489. #endif
  490. #ifndef MQTT_ENQUEUE_DATETIME
  491. #define MQTT_ENQUEUE_DATETIME 1
  492. #endif
  493. #ifndef MQTT_ENQUEUE_MESSAGE_ID
  494. #define MQTT_ENQUEUE_MESSAGE_ID 1
  495. #endif
  496. // These particles will be concatenated to the MQTT_TOPIC base to form the actual topic
  497. #define MQTT_TOPIC_JSON "data"
  498. #define MQTT_TOPIC_ACTION "action"
  499. #define MQTT_TOPIC_RELAY "relay"
  500. #define MQTT_TOPIC_LED "led"
  501. #define MQTT_TOPIC_BUTTON "button"
  502. #define MQTT_TOPIC_IP "ip"
  503. #define MQTT_TOPIC_VERSION "version"
  504. #define MQTT_TOPIC_UPTIME "uptime"
  505. #define MQTT_TOPIC_DATETIME "datetime"
  506. #define MQTT_TOPIC_FREEHEAP "freeheap"
  507. #define MQTT_TOPIC_VCC "vcc"
  508. #define MQTT_TOPIC_STATUS "status"
  509. #define MQTT_TOPIC_MAC "mac"
  510. #define MQTT_TOPIC_RSSI "rssi"
  511. #define MQTT_TOPIC_MESSAGE_ID "id"
  512. #define MQTT_TOPIC_APP "app"
  513. #define MQTT_TOPIC_INTERVAL "interval"
  514. #define MQTT_TOPIC_HOSTNAME "host"
  515. #define MQTT_TOPIC_TIME "time"
  516. #define MQTT_TOPIC_RFOUT "rfout"
  517. #define MQTT_TOPIC_RFIN "rfin"
  518. #define MQTT_TOPIC_RFLEARN "rflearn"
  519. #define MQTT_TOPIC_RFRAW "rfraw"
  520. #define MQTT_TOPIC_UARTIN "uartin"
  521. #define MQTT_TOPIC_UARTOUT "uartout"
  522. #define MQTT_TOPIC_LOADAVG "loadavg"
  523. #define MQTT_TOPIC_BOARD "board"
  524. #define MQTT_TOPIC_PULSE "pulse"
  525. // Light module
  526. #define MQTT_TOPIC_CHANNEL "channel"
  527. #define MQTT_TOPIC_COLOR_RGB "rgb"
  528. #define MQTT_TOPIC_COLOR_HSV "hsv"
  529. #define MQTT_TOPIC_ANIM_MODE "anim_mode"
  530. #define MQTT_TOPIC_ANIM_SPEED "anim_speed"
  531. #define MQTT_TOPIC_BRIGHTNESS "brightness"
  532. #define MQTT_TOPIC_MIRED "mired"
  533. #define MQTT_TOPIC_KELVIN "kelvin"
  534. #define MQTT_STATUS_ONLINE "1" // Value for the device ON message
  535. #define MQTT_STATUS_OFFLINE "0" // Value for the device OFF message (will)
  536. #define MQTT_ACTION_RESET "reboot" // RESET MQTT topic particle
  537. #define MQTT_MESSAGE_ID_SHIFT 1000 // Store MQTT message id into EEPROM every these many
  538. // Custom get and set postfixes
  539. // Use something like "/status" or "/set", with leading slash
  540. // Since 1.9.0 the default value is "" for getter and "/set" for setter
  541. #ifndef MQTT_GETTER
  542. #define MQTT_GETTER ""
  543. #endif
  544. #ifndef MQTT_SETTER
  545. #define MQTT_SETTER "/set"
  546. #endif
  547. // -----------------------------------------------------------------------------
  548. // BROKER
  549. // -----------------------------------------------------------------------------
  550. #ifndef BROKER_SUPPORT
  551. #define BROKER_SUPPORT 1 // The broker is a poor-man's pubsub manager
  552. #endif
  553. // -----------------------------------------------------------------------------
  554. // SETTINGS
  555. // -----------------------------------------------------------------------------
  556. #ifndef SETTINGS_AUTOSAVE
  557. #define SETTINGS_AUTOSAVE 1 // Autosave settings o force manual commit
  558. #endif
  559. #define SETTINGS_MAX_LIST_COUNT 10 // Maximum index for settings lists
  560. // -----------------------------------------------------------------------------
  561. // LIGHT
  562. // -----------------------------------------------------------------------------
  563. // LIGHT_PROVIDER_DIMMER can have from 1 to 5 different channels.
  564. // They have to be defined for each device in the hardware.h file.
  565. // If 3 or more channels first 3 will be considered RGB.
  566. // Usual configurations are:
  567. // 1 channels => W
  568. // 2 channels => WW
  569. // 3 channels => RGB
  570. // 4 channels => RGBW
  571. // 5 channels => RGBWW
  572. #ifndef LIGHT_SAVE_ENABLED
  573. #define LIGHT_SAVE_ENABLED 1 // Light channel values saved by default after each change
  574. #endif
  575. #ifndef LIGHT_SAVE_DELAY
  576. #define LIGHT_SAVE_DELAY 5 // Persist color after 5 seconds to avoid wearing out
  577. #endif
  578. #ifndef LIGHT_MAX_PWM
  579. #if LIGHT_PROVIDER == LIGHT_PROVIDER_MY92XX
  580. #define LIGHT_MAX_PWM 255
  581. #endif
  582. #if LIGHT_PROVIDER == LIGHT_PROVIDER_DIMMER
  583. #define LIGHT_MAX_PWM 10000 // 5000 * 200ns => 1 kHz
  584. #endif
  585. #endif // LIGHT_MAX_PWM
  586. #ifndef LIGHT_LIMIT_PWM
  587. #define LIGHT_LIMIT_PWM LIGHT_MAX_PWM // Limit PWM to this value (prevent 100% power)
  588. #endif
  589. #ifndef LIGHT_MAX_VALUE
  590. #define LIGHT_MAX_VALUE 255 // Maximum light value
  591. #endif
  592. #ifndef LIGHT_MAX_BRIGHTNESS
  593. #define LIGHT_MAX_BRIGHTNESS 255 // Maximun brightness value
  594. #endif
  595. #define LIGHT_MIN_MIREDS 153 // Default to the Philips Hue value that HA also use.
  596. #define LIGHT_MAX_MIREDS 500 // https://developers.meethue.com/documentation/core-concepts
  597. #ifndef LIGHT_STEP
  598. #define LIGHT_STEP 32 // Step size
  599. #endif
  600. #ifndef LIGHT_USE_COLOR
  601. #define LIGHT_USE_COLOR 1 // Use 3 first channels as RGB
  602. #endif
  603. #ifndef LIGHT_USE_WHITE
  604. #define LIGHT_USE_WHITE 0 // Use the 4th channel as (Warm-)White LEDs
  605. #endif
  606. #ifndef LIGHT_USE_CCT
  607. #define LIGHT_USE_CCT 0 // Use the 5th channel as Coldwhite LEDs, LIGHT_USE_WHITE must be 1.
  608. #endif
  609. // Used when LIGHT_USE_WHITE AND LIGHT_USE_CCT is 1 - (1000000/Kelvin = MiReds)
  610. // Warning! Don't change this yet, NOT FULLY IMPLEMENTED!
  611. #define LIGHT_COLDWHITE_MIRED 153 // Coldwhite Strip, Value must be __BELOW__ W2!! (Default: 6535 Kelvin/153 MiRed)
  612. #define LIGHT_WARMWHITE_MIRED 500 // Warmwhite Strip, Value must be __ABOVE__ W1!! (Default: 2000 Kelvin/500 MiRed)
  613. #ifndef LIGHT_USE_GAMMA
  614. #define LIGHT_USE_GAMMA 0 // Use gamma correction for color channels
  615. #endif
  616. #ifndef LIGHT_USE_CSS
  617. #define LIGHT_USE_CSS 1 // Use CSS style to report colors (1=> "#FF0000", 0=> "255,0,0")
  618. #endif
  619. #ifndef LIGHT_USE_RGB
  620. #define LIGHT_USE_RGB 0 // Use RGB color selector (1=> RGB, 0=> HSV)
  621. #endif
  622. #ifndef LIGHT_WHITE_FACTOR
  623. #define LIGHT_WHITE_FACTOR 1 // When using LIGHT_USE_WHITE with uneven brightness LEDs,
  624. // this factor is used to scale the white channel to match brightness
  625. #endif
  626. #ifndef LIGHT_USE_TRANSITIONS
  627. #define LIGHT_USE_TRANSITIONS 1 // Transitions between colors
  628. #endif
  629. #ifndef LIGHT_TRANSITION_STEP
  630. #define LIGHT_TRANSITION_STEP 10 // Time in millis between each transtion step
  631. #endif
  632. #ifndef LIGHT_TRANSITION_TIME
  633. #define LIGHT_TRANSITION_TIME 500 // Time in millis from color to color
  634. #endif
  635. // -----------------------------------------------------------------------------
  636. // DOMOTICZ
  637. // -----------------------------------------------------------------------------
  638. #ifndef DOMOTICZ_SUPPORT
  639. #define DOMOTICZ_SUPPORT MQTT_SUPPORT // Build with domoticz (if MQTT) support (1.72Kb)
  640. #endif
  641. #define DOMOTICZ_ENABLED 0 // Disable domoticz by default
  642. #define DOMOTICZ_IN_TOPIC "domoticz/in" // Default subscription topic
  643. #define DOMOTICZ_OUT_TOPIC "domoticz/out" // Default publication topic
  644. // -----------------------------------------------------------------------------
  645. // HOME ASSISTANT
  646. // -----------------------------------------------------------------------------
  647. #ifndef HOMEASSISTANT_SUPPORT
  648. #define HOMEASSISTANT_SUPPORT MQTT_SUPPORT // Build with home assistant support (if MQTT, 1.64Kb)
  649. #endif
  650. #define HOMEASSISTANT_ENABLED 0 // Integration not enabled by default
  651. #define HOMEASSISTANT_PREFIX "homeassistant" // Default MQTT prefix
  652. // -----------------------------------------------------------------------------
  653. // INFLUXDB
  654. // -----------------------------------------------------------------------------
  655. #ifndef INFLUXDB_SUPPORT
  656. #define INFLUXDB_SUPPORT 0 // Disable InfluxDB support by default (4.38Kb)
  657. #endif
  658. #ifndef INFLUXDB_ENABLED
  659. #define INFLUXDB_ENABLED 0 // InfluxDB disabled by default
  660. #endif
  661. #ifndef INFLUXDB_HOST
  662. #define INFLUXDB_HOST "" // Default server
  663. #endif
  664. #ifndef INFLUXDB_PORT
  665. #define INFLUXDB_PORT 8086 // Default InfluxDB port
  666. #endif
  667. #ifndef INFLUXDB_DATABASE
  668. #define INFLUXDB_DATABASE "" // Default database
  669. #endif
  670. #ifndef INFLUXDB_USERNAME
  671. #define INFLUXDB_USERNAME "" // Default username
  672. #endif
  673. #ifndef INFLUXDB_PASSWORD
  674. #define INFLUXDB_PASSWORD "" // Default password
  675. #endif
  676. // -----------------------------------------------------------------------------
  677. // THINGSPEAK
  678. // -----------------------------------------------------------------------------
  679. #ifndef THINGSPEAK_SUPPORT
  680. #define THINGSPEAK_SUPPORT 1 // Enable Thingspeak support by default (2.56Kb)
  681. #endif
  682. #ifndef THINGSPEAK_ENABLED
  683. #define THINGSPEAK_ENABLED 0 // Thingspeak disabled by default
  684. #endif
  685. #ifndef THINGSPEAK_APIKEY
  686. #define THINGSPEAK_APIKEY "" // Default API KEY
  687. #endif
  688. #define THINGSPEAK_USE_ASYNC 1 // Use AsyncClient instead of WiFiClientSecure
  689. // THINGSPEAK OVER SSL
  690. // Using THINGSPEAK over SSL works well but generates problems with the web interface,
  691. // so you should compile it with WEB_SUPPORT to 0.
  692. // When THINGSPEAK_USE_ASYNC is 1, requires ASYNC_TCP_SSL_ENABLED to 1 and ESP8266 Arduino Core 2.4.0.
  693. #define THINGSPEAK_USE_SSL 0 // Use secure connection
  694. #define THINGSPEAK_FINGERPRINT "78 60 18 44 81 35 BF DF 77 84 D4 0A 22 0D 9B 4E 6C DC 57 2C"
  695. #define THINGSPEAK_HOST "api.thingspeak.com"
  696. #if THINGSPEAK_USE_SSL
  697. #define THINGSPEAK_PORT 443
  698. #else
  699. #define THINGSPEAK_PORT 80
  700. #endif
  701. #define THINGSPEAK_URL "/update"
  702. #define THINGSPEAK_MIN_INTERVAL 15000 // Minimum interval between POSTs (in millis)
  703. // -----------------------------------------------------------------------------
  704. // SCHEDULER
  705. // -----------------------------------------------------------------------------
  706. #ifndef SCHEDULER_SUPPORT
  707. #define SCHEDULER_SUPPORT 1 // Enable scheduler (1.77Kb)
  708. #endif
  709. #ifndef SCHEDULER_MAX_SCHEDULES
  710. #define SCHEDULER_MAX_SCHEDULES 10 // Max schedules alowed
  711. #endif
  712. // -----------------------------------------------------------------------------
  713. // NTP
  714. // -----------------------------------------------------------------------------
  715. #ifndef NTP_SUPPORT
  716. #define NTP_SUPPORT 1 // Build with NTP support by default (6.78Kb)
  717. #endif
  718. #ifndef NTP_SERVER
  719. #define NTP_SERVER "pool.ntp.org" // Default NTP server
  720. #endif
  721. #ifndef NTP_TIMEOUT
  722. #define NTP_TIMEOUT 1000 // Set NTP request timeout to 2 seconds (issue #452)
  723. #endif
  724. #ifndef NTP_TIME_OFFSET
  725. #define NTP_TIME_OFFSET 60 // Default timezone offset (GMT+1)
  726. #endif
  727. #ifndef NTP_DAY_LIGHT
  728. #define NTP_DAY_LIGHT 1 // Enable daylight time saving by default
  729. #endif
  730. #ifndef NTP_SYNC_INTERVAL
  731. #define NTP_SYNC_INTERVAL 60 // NTP initial check every minute
  732. #endif
  733. #ifndef NTP_UPDATE_INTERVAL
  734. #define NTP_UPDATE_INTERVAL 1800 // NTP check every 30 minutes
  735. #endif
  736. #ifndef NTP_START_DELAY
  737. #define NTP_START_DELAY 1000 // Delay NTP start 1 second
  738. #endif
  739. #ifndef NTP_DST_REGION
  740. #define NTP_DST_REGION 0 // 0 for Europe, 1 for USA (defined in NtpClientLib)
  741. #endif
  742. // -----------------------------------------------------------------------------
  743. // ALEXA
  744. // -----------------------------------------------------------------------------
  745. // This setting defines whether Alexa support should be built into the firmware
  746. #ifndef ALEXA_SUPPORT
  747. #define ALEXA_SUPPORT 1 // Enable Alexa support by default (10.84Kb)
  748. #endif
  749. // This is default value for the alexaEnabled setting that defines whether
  750. // this device should be discoberable and respond to Alexa commands.
  751. // Both ALEXA_SUPPORT and alexaEnabled should be 1 for Alexa support to work.
  752. #ifndef ALEXA_ENABLED
  753. #define ALEXA_ENABLED 1
  754. #endif
  755. // -----------------------------------------------------------------------------
  756. // RFBRIDGE
  757. // This module is not compatible with RF_SUPPORT=1
  758. // -----------------------------------------------------------------------------
  759. #ifndef RF_SEND_TIMES
  760. #define RF_SEND_TIMES 4 // How many times to send the message
  761. #endif
  762. #ifndef RF_SEND_DELAY
  763. #define RF_SEND_DELAY 500 // Interval between sendings in ms
  764. #endif
  765. #ifndef RF_RECEIVE_DELAY
  766. #define RF_RECEIVE_DELAY 500 // Interval between recieving in ms (avoid debouncing)
  767. #endif
  768. #ifndef RF_RAW_SUPPORT
  769. #define RF_RAW_SUPPORT 0 // RF raw codes require a specific firmware for the EFM8BB1
  770. // https://github.com/rhx/RF-Bridge-EFM8BB1
  771. #endif
  772. // -----------------------------------------------------------------------------
  773. // IR
  774. // -----------------------------------------------------------------------------
  775. #ifndef IR_SUPPORT
  776. #define IR_SUPPORT 0 // Do not build with IR support by default (10.25Kb)
  777. #endif
  778. #ifndef IR_PIN
  779. #define IR_PIN 4 // IR LED
  780. #endif
  781. // 24 Buttons Set of the IR Remote
  782. #ifndef IR_BUTTON_SET
  783. #define IR_BUTTON_SET 1 // IR button set to use (see below)
  784. #endif
  785. //Remote Buttons SET 1 (for the original Remote shipped with the controller)
  786. #if IR_SUPPORT
  787. #if IR_BUTTON_SET == 1
  788. /*
  789. +------+------+------+------+
  790. | UP | Down | OFF | ON |
  791. +------+------+------+------+
  792. | R | G | B | W |
  793. +------+------+------+------+
  794. | 1 | 2 | 3 |FLASH |
  795. +------+------+------+------+
  796. | 4 | 5 | 6 |STROBE|
  797. +------+------+------+------+
  798. | 7 | 8 | 9 | FADE |
  799. +------+------+------+------+
  800. | 10 | 11 | 12 |SMOOTH|
  801. +------+------+------+------+
  802. */
  803. #define IR_BUTTON_COUNT 24
  804. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  805. { 0xFF906F, IR_BUTTON_MODE_BRIGHTER, 1 },
  806. { 0xFFB847, IR_BUTTON_MODE_BRIGHTER, 0 },
  807. { 0xFFF807, IR_BUTTON_MODE_STATE, 0 },
  808. { 0xFFB04F, IR_BUTTON_MODE_STATE, 1 },
  809. { 0xFF9867, IR_BUTTON_MODE_RGB, 0xFF0000 },
  810. { 0xFFD827, IR_BUTTON_MODE_RGB, 0x00FF00 },
  811. { 0xFF8877, IR_BUTTON_MODE_RGB, 0x0000FF },
  812. { 0xFFA857, IR_BUTTON_MODE_RGB, 0xFFFFFF },
  813. { 0xFFE817, IR_BUTTON_MODE_RGB, 0xD13A01 },
  814. { 0xFF48B7, IR_BUTTON_MODE_RGB, 0x00E644 },
  815. { 0xFF6897, IR_BUTTON_MODE_RGB, 0x0040A7 },
  816. { 0xFFB24D, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FLASH },
  817. { 0xFF02FD, IR_BUTTON_MODE_RGB, 0xE96F2A },
  818. { 0xFF32CD, IR_BUTTON_MODE_RGB, 0x00BEBF },
  819. { 0xFF20DF, IR_BUTTON_MODE_RGB, 0x56406F },
  820. { 0xFF00FF, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_STROBE },
  821. { 0xFF50AF, IR_BUTTON_MODE_RGB, 0xEE9819 },
  822. { 0xFF7887, IR_BUTTON_MODE_RGB, 0x00799A },
  823. { 0xFF708F, IR_BUTTON_MODE_RGB, 0x944E80 },
  824. { 0xFF58A7, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FADE },
  825. { 0xFF38C7, IR_BUTTON_MODE_RGB, 0xFFFF00 },
  826. { 0xFF28D7, IR_BUTTON_MODE_RGB, 0x0060A1 },
  827. { 0xFFF00F, IR_BUTTON_MODE_RGB, 0xEF45AD },
  828. { 0xFF30CF, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_SMOOTH }
  829. };
  830. #endif
  831. //Remote Buttons SET 2 (another identical IR Remote shipped with another controller)
  832. #if IR_BUTTON_SET == 2
  833. /*
  834. +------+------+------+------+
  835. | UP | Down | OFF | ON |
  836. +------+------+------+------+
  837. | R | G | B | W |
  838. +------+------+------+------+
  839. | 1 | 2 | 3 |FLASH |
  840. +------+------+------+------+
  841. | 4 | 5 | 6 |STROBE|
  842. +------+------+------+------+
  843. | 7 | 8 | 9 | FADE |
  844. +------+------+------+------+
  845. | 10 | 11 | 12 |SMOOTH|
  846. +------+------+------+------+
  847. */
  848. #define IR_BUTTON_COUNT 24
  849. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  850. { 0xFF00FF, IR_BUTTON_MODE_BRIGHTER, 1 },
  851. { 0xFF807F, IR_BUTTON_MODE_BRIGHTER, 0 },
  852. { 0xFF40BF, IR_BUTTON_MODE_STATE, 0 },
  853. { 0xFFC03F, IR_BUTTON_MODE_STATE, 1 },
  854. { 0xFF20DF, IR_BUTTON_MODE_RGB, 0xFF0000 },
  855. { 0xFFA05F, IR_BUTTON_MODE_RGB, 0x00FF00 },
  856. { 0xFF609F, IR_BUTTON_MODE_RGB, 0x0000FF },
  857. { 0xFFE01F, IR_BUTTON_MODE_RGB, 0xFFFFFF },
  858. { 0xFF10EF, IR_BUTTON_MODE_RGB, 0xD13A01 },
  859. { 0xFF906F, IR_BUTTON_MODE_RGB, 0x00E644 },
  860. { 0xFF50AF, IR_BUTTON_MODE_RGB, 0x0040A7 },
  861. { 0xFFD02F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FLASH },
  862. { 0xFF30CF, IR_BUTTON_MODE_RGB, 0xE96F2A },
  863. { 0xFFB04F, IR_BUTTON_MODE_RGB, 0x00BEBF },
  864. { 0xFF708F, IR_BUTTON_MODE_RGB, 0x56406F },
  865. { 0xFFF00F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_STROBE },
  866. { 0xFF08F7, IR_BUTTON_MODE_RGB, 0xEE9819 },
  867. { 0xFF8877, IR_BUTTON_MODE_RGB, 0x00799A },
  868. { 0xFF48B7, IR_BUTTON_MODE_RGB, 0x944E80 },
  869. { 0xFFC837, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FADE },
  870. { 0xFF28D7, IR_BUTTON_MODE_RGB, 0xFFFF00 },
  871. { 0xFFA857, IR_BUTTON_MODE_RGB, 0x0060A1 },
  872. { 0xFF6897, IR_BUTTON_MODE_RGB, 0xEF45AD },
  873. { 0xFFE817, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_SMOOTH }
  874. };
  875. #endif
  876. //Remote Buttons SET 3 (samsung AA59-00608A 8 Toggle Buttons for generic 8CH module)
  877. #if IR_BUTTON_SET == 3
  878. /*
  879. +------+------+------+
  880. | 1 | 2 | 3 |
  881. +------+------+------+
  882. | 4 | 5 | 6 |
  883. +------+------+------+
  884. | 7 | 8 | 9 |
  885. +------+------+------+
  886. | | 0 | |
  887. +------+------+------+
  888. */
  889. #define IR_BUTTON_COUNT 10
  890. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  891. { 0xE0E020DF, IR_BUTTON_MODE_TOGGLE, 0 }, // Toggle Relay #0
  892. { 0xE0E0A05F, IR_BUTTON_MODE_TOGGLE, 1 }, // Toggle Relay #1
  893. { 0xE0E0609F, IR_BUTTON_MODE_TOGGLE, 2 }, // Toggle Relay #2
  894. { 0xE0E010EF, IR_BUTTON_MODE_TOGGLE, 3 }, // Toggle Relay #3
  895. { 0xE0E0906F, IR_BUTTON_MODE_TOGGLE, 4 }, // Toggle Relay #4
  896. { 0xE0E050AF, IR_BUTTON_MODE_TOGGLE, 5 }, // Toggle Relay #5
  897. { 0xE0E030CF, IR_BUTTON_MODE_TOGGLE, 6 }, // Toggle Relay #6
  898. { 0xE0E0B04F, IR_BUTTON_MODE_TOGGLE, 7 } // Toggle Relay #7
  899. //{ 0xE0E0708F, IR_BUTTON_MODE_TOGGLE, 8 } //Extra Button
  900. //{ 0xE0E08877, IR_BUTTON_MODE_TOGGLE, 9 } //Extra Button
  901. };
  902. #endif
  903. #endif // IR_SUPPORT
  904. //--------------------------------------------------------------------------------
  905. // Custom RF module
  906. // Check http://tinkerman.cat/adding-rf-to-a-non-rf-itead-sonoff/
  907. // Enable support by passing RF_SUPPORT=1 build flag
  908. // This module is not compatible with RFBRIDGE or SONOFF RF
  909. //--------------------------------------------------------------------------------
  910. #ifndef RF_SUPPORT
  911. #define RF_SUPPORT 0
  912. #endif
  913. #ifndef RF_PIN
  914. #define RF_PIN 14
  915. #endif
  916. #define RF_DEBOUNCE 500
  917. #define RF_LEARN_TIMEOUT 60000