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.

1273 lines
42 KiB

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