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.

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