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.

1407 lines
46 KiB

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