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.

1379 lines
45 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
7 years ago
8 years ago
8 years ago
7 years ago
6 years ago
6 years ago
6 years ago
8 years ago
7 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 4096 // EEPROM size in 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. #ifndef HEARTBEAT_ENABLED
  127. #define HEARTBEAT_ENABLED 1
  128. #endif
  129. #ifndef HEARTBEAT_INTERVAL
  130. #define HEARTBEAT_INTERVAL 300000 // Interval between heartbeat messages (in ms)
  131. #endif
  132. #define UPTIME_OVERFLOW 4294967295 // Uptime overflow value
  133. // Topics that will be reported in heartbeat
  134. #define HEARTBEAT_REPORT_STATUS 1
  135. #define HEARTBEAT_REPORT_IP 1
  136. #define HEARTBEAT_REPORT_MAC 1
  137. #define HEARTBEAT_REPORT_RSSI 1
  138. #define HEARTBEAT_REPORT_UPTIME 1
  139. #define HEARTBEAT_REPORT_DATETIME 1
  140. #define HEARTBEAT_REPORT_FREEHEAP 1
  141. #define HEARTBEAT_REPORT_VCC 1
  142. #define HEARTBEAT_REPORT_RELAY 1
  143. #define HEARTBEAT_REPORT_LIGHT 1
  144. #define HEARTBEAT_REPORT_HOSTNAME 1
  145. #define HEARTBEAT_REPORT_APP 1
  146. #define HEARTBEAT_REPORT_VERSION 1
  147. #define HEARTBEAT_REPORT_BOARD 1
  148. #define HEARTBEAT_REPORT_INTERVAL 0
  149. //------------------------------------------------------------------------------
  150. // Load average
  151. //------------------------------------------------------------------------------
  152. #ifndef LOADAVG_INTERVAL
  153. #define LOADAVG_INTERVAL 30000 // Interval between calculating load average (in ms)
  154. #endif
  155. #ifndef LOADAVG_REPORT
  156. #define LOADAVG_REPORT 1 // Should we report Load average over MQTT?
  157. #endif
  158. //------------------------------------------------------------------------------
  159. // BUTTON
  160. //------------------------------------------------------------------------------
  161. #ifndef BUTTON_SUPPORT
  162. #define BUTTON_SUPPORT 1
  163. #endif
  164. #ifndef BUTTON_DEBOUNCE_DELAY
  165. #define BUTTON_DEBOUNCE_DELAY 50 // Debounce delay (ms)
  166. #endif
  167. #ifndef BUTTON_DBLCLICK_DELAY
  168. #define BUTTON_DBLCLICK_DELAY 500 // Time in ms to wait for a second (or third...) click
  169. #endif
  170. #ifndef BUTTON_LNGCLICK_DELAY
  171. #define BUTTON_LNGCLICK_DELAY 1000 // Time in ms holding the button down to get a long click
  172. #endif
  173. #ifndef BUTTON_LNGLNGCLICK_DELAY
  174. #define BUTTON_LNGLNGCLICK_DELAY 10000 // Time in ms holding the button down to get a long-long click
  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_BUFFER_SIZE
  355. #define API_BUFFER_SIZE 15 // Size of the buffer for HTTP GET API responses
  356. #endif
  357. #ifndef API_REAL_TIME_VALUES
  358. #define API_REAL_TIME_VALUES 0 // Show filtered/median values by default (0 => median, 1 => real time)
  359. #endif
  360. // -----------------------------------------------------------------------------
  361. // MDNS / LLMNR / NETBIOS / SSDP
  362. // -----------------------------------------------------------------------------
  363. #ifndef MDNS_SERVER_SUPPORT
  364. #define MDNS_SERVER_SUPPORT 1 // Publish services using mDNS by default (1.48Kb)
  365. #endif
  366. #ifndef MDNS_CLIENT_SUPPORT
  367. #define MDNS_CLIENT_SUPPORT 0 // Resolve mDNS names (3.44Kb)
  368. #endif
  369. #ifndef LLMNR_SUPPORT
  370. #define LLMNR_SUPPORT 0 // Publish device using LLMNR protocol by default (1.95Kb) - requires 2.4.0
  371. #endif
  372. #ifndef NETBIOS_SUPPORT
  373. #define NETBIOS_SUPPORT 0 // Publish device using NetBIOS protocol by default (1.26Kb) - requires 2.4.0
  374. #endif
  375. #ifndef SSDP_SUPPORT
  376. #define SSDP_SUPPORT 0 // Publish device using SSDP protocol by default (4.59Kb)
  377. // Not compatible with ALEXA_SUPPORT at the moment
  378. #endif
  379. #ifndef SSDP_DEVICE_TYPE
  380. #define SSDP_DEVICE_TYPE "upnp:rootdevice"
  381. //#define SSDP_DEVICE_TYPE "urn:schemas-upnp-org:device:BinaryLight:1"
  382. #endif
  383. // -----------------------------------------------------------------------------
  384. // SPIFFS
  385. // -----------------------------------------------------------------------------
  386. #ifndef SPIFFS_SUPPORT
  387. #define SPIFFS_SUPPORT 0 // Do not add support for SPIFFS by default
  388. #endif
  389. // -----------------------------------------------------------------------------
  390. // OTA
  391. // -----------------------------------------------------------------------------
  392. #ifndef OTA_PORT
  393. #define OTA_PORT 8266 // OTA port
  394. #endif
  395. #define OTA_GITHUB_FP "D7:9F:07:61:10:B3:92:93:E3:49:AC:89:84:5B:03:80:C1:9E:2F:8B"
  396. // -----------------------------------------------------------------------------
  397. // NOFUSS
  398. // -----------------------------------------------------------------------------
  399. #ifndef NOFUSS_SUPPORT
  400. #define NOFUSS_SUPPORT 0 // Do not enable support for NoFuss by default (12.65Kb)
  401. #endif
  402. #ifndef NOFUSS_ENABLED
  403. #define NOFUSS_ENABLED 0 // Do not perform NoFUSS updates by default
  404. #endif
  405. #ifndef NOFUSS_SERVER
  406. #define NOFUSS_SERVER "" // Default NoFuss Server
  407. #endif
  408. #ifndef NOFUSS_INTERVAL
  409. #define NOFUSS_INTERVAL 3600000 // Check for updates every hour
  410. #endif
  411. // -----------------------------------------------------------------------------
  412. // UART <-> MQTT
  413. // -----------------------------------------------------------------------------
  414. #ifndef UART_MQTT_SUPPORT
  415. #define UART_MQTT_SUPPORT 0 // No support by default
  416. #endif
  417. #ifndef UART_MQTT_USE_SOFT
  418. #define UART_MQTT_USE_SOFT 0 // Use SoftwareSerial
  419. #endif
  420. #ifndef UART_MQTT_HW_PORT
  421. #define UART_MQTT_HW_PORT Serial // Hardware serial port (if UART_MQTT_USE_SOFT == 0)
  422. #endif
  423. #ifndef UART_MQTT_RX_PIN
  424. #define UART_MQTT_RX_PIN 4 // RX PIN (if UART_MQTT_USE_SOFT == 1)
  425. #endif
  426. #ifndef UART_MQTT_TX_PIN
  427. #define UART_MQTT_TX_PIN 5 // TX PIN (if UART_MQTT_USE_SOFT == 1)
  428. #endif
  429. #ifndef UART_MQTT_BAUDRATE
  430. #define UART_MQTT_BAUDRATE 115200 // Serial speed
  431. #endif
  432. #ifndef UART_MQTT_TERMINATION
  433. #define UART_MQTT_TERMINATION '\n' // Termination character
  434. #endif
  435. #define UART_MQTT_BUFFER_SIZE 100 // UART buffer size
  436. // -----------------------------------------------------------------------------
  437. // MQTT
  438. // -----------------------------------------------------------------------------
  439. #ifndef MQTT_SUPPORT
  440. #define MQTT_SUPPORT 1 // MQTT support (22.38Kb async, 12.48Kb sync)
  441. #endif
  442. #ifndef MQTT_USE_ASYNC
  443. #define MQTT_USE_ASYNC 1 // Use AysncMQTTClient (1) or PubSubClient (0)
  444. #endif
  445. // MQTT OVER SSL
  446. // Using MQTT over SSL works pretty well but generates problems with the web interface.
  447. // It could be a good idea to use it in conjuntion with WEB_SUPPORT=0.
  448. // Requires ASYNC_TCP_SSL_ENABLED to 1 and ESP8266 Arduino Core 2.4.0.
  449. //
  450. // You can use SSL with MQTT_USE_ASYNC=1 (AsyncMqttClient library)
  451. // but you might experience hiccups on the web interface, so my recommendation is:
  452. // WEB_SUPPORT=0
  453. //
  454. // If you use SSL with MQTT_USE_ASYNC=0 (PubSubClient library)
  455. // you will have to disable all the modules that use ESPAsyncTCP, that is:
  456. // ALEXA_SUPPORT=0, INFLUXDB_SUPPORT=0, TELNET_SUPPORT=0, THINGSPEAK_SUPPORT=0 and WEB_SUPPORT=0
  457. //
  458. // You will need the fingerprint for your MQTT server, example for CloudMQTT:
  459. // $ echo -n | openssl s_client -connect m11.cloudmqtt.com:24055 > cloudmqtt.pem
  460. // $ openssl x509 -noout -in cloudmqtt.pem -fingerprint -sha1
  461. #ifndef MQTT_SSL_ENABLED
  462. #define MQTT_SSL_ENABLED 0 // By default MQTT over SSL will not be enabled
  463. #endif
  464. #ifndef MQTT_SSL_FINGERPRINT
  465. #define MQTT_SSL_FINGERPRINT "" // SSL fingerprint of the server
  466. #endif
  467. #ifndef MQTT_ENABLED
  468. #define MQTT_ENABLED 0 // Do not enable MQTT connection by default
  469. #endif
  470. #ifndef MQTT_AUTOCONNECT
  471. #define MQTT_AUTOCONNECT 1 // If enabled and MDNS_SERVER_SUPPORT=1 will perform an autodiscover and
  472. // autoconnect to the first MQTT broker found if none defined
  473. #endif
  474. #ifndef MQTT_SERVER
  475. #define MQTT_SERVER "" // Default MQTT broker address
  476. #endif
  477. #ifndef MQTT_USER
  478. #define MQTT_USER "" // Default MQTT broker usename
  479. #endif
  480. #ifndef MQTT_PASS
  481. #define MQTT_PASS "" // Default MQTT broker password
  482. #endif
  483. #ifndef MQTT_PORT
  484. #define MQTT_PORT 1883 // MQTT broker port
  485. #endif
  486. #ifndef MQTT_TOPIC
  487. #define MQTT_TOPIC "{hostname}" // Default MQTT base topic
  488. #endif
  489. #ifndef MQTT_RETAIN
  490. #define MQTT_RETAIN true // MQTT retain flag
  491. #endif
  492. #ifndef MQTT_QOS
  493. #define MQTT_QOS 0 // MQTT QoS value for all messages
  494. #endif
  495. #ifndef MQTT_KEEPALIVE
  496. #define MQTT_KEEPALIVE 300 // MQTT keepalive value
  497. #endif
  498. #ifndef MQTT_RECONNECT_DELAY_MIN
  499. #define MQTT_RECONNECT_DELAY_MIN 5000 // Try to reconnect in 5 seconds upon disconnection
  500. #endif
  501. #ifndef MQTT_RECONNECT_DELAY_STEP
  502. #define MQTT_RECONNECT_DELAY_STEP 5000 // Increase the reconnect delay in 5 seconds after each failed attempt
  503. #endif
  504. #ifndef MQTT_RECONNECT_DELAY_MAX
  505. #define MQTT_RECONNECT_DELAY_MAX 120000 // Set reconnect time to 2 minutes at most
  506. #endif
  507. #ifndef MQTT_SKIP_RETAINED
  508. #define MQTT_SKIP_RETAINED 1 // Skip retained messages on connection
  509. #endif
  510. #ifndef MQTT_SKIP_TIME
  511. #define MQTT_SKIP_TIME 1000 // Skip messages for 1 second anter connection
  512. #endif
  513. #ifndef MQTT_USE_JSON
  514. #define MQTT_USE_JSON 0 // Group messages in a JSON body
  515. #endif
  516. #ifndef MQTT_USE_JSON_DELAY
  517. #define MQTT_USE_JSON_DELAY 100 // Wait this many ms before grouping messages
  518. #endif
  519. #ifndef MQTT_QUEUE_MAX_SIZE
  520. #define MQTT_QUEUE_MAX_SIZE 20 // Size of the MQTT queue when MQTT_USE_JSON is enabled
  521. #endif
  522. // These are the properties that will be sent when useJson is true
  523. #ifndef MQTT_ENQUEUE_IP
  524. #define MQTT_ENQUEUE_IP 1
  525. #endif
  526. #ifndef MQTT_ENQUEUE_MAC
  527. #define MQTT_ENQUEUE_MAC 1
  528. #endif
  529. #ifndef MQTT_ENQUEUE_HOSTNAME
  530. #define MQTT_ENQUEUE_HOSTNAME 1
  531. #endif
  532. #ifndef MQTT_ENQUEUE_DATETIME
  533. #define MQTT_ENQUEUE_DATETIME 1
  534. #endif
  535. #ifndef MQTT_ENQUEUE_MESSAGE_ID
  536. #define MQTT_ENQUEUE_MESSAGE_ID 1
  537. #endif
  538. // These particles will be concatenated to the MQTT_TOPIC base to form the actual topic
  539. #define MQTT_TOPIC_JSON "data"
  540. #define MQTT_TOPIC_ACTION "action"
  541. #define MQTT_TOPIC_RELAY "relay"
  542. #define MQTT_TOPIC_LED "led"
  543. #define MQTT_TOPIC_BUTTON "button"
  544. #define MQTT_TOPIC_IP "ip"
  545. #define MQTT_TOPIC_VERSION "version"
  546. #define MQTT_TOPIC_UPTIME "uptime"
  547. #define MQTT_TOPIC_DATETIME "datetime"
  548. #define MQTT_TOPIC_FREEHEAP "freeheap"
  549. #define MQTT_TOPIC_VCC "vcc"
  550. #define MQTT_TOPIC_STATUS "status"
  551. #define MQTT_TOPIC_MAC "mac"
  552. #define MQTT_TOPIC_RSSI "rssi"
  553. #define MQTT_TOPIC_MESSAGE_ID "id"
  554. #define MQTT_TOPIC_APP "app"
  555. #define MQTT_TOPIC_INTERVAL "interval"
  556. #define MQTT_TOPIC_HOSTNAME "host"
  557. #define MQTT_TOPIC_TIME "time"
  558. #define MQTT_TOPIC_RFOUT "rfout"
  559. #define MQTT_TOPIC_RFIN "rfin"
  560. #define MQTT_TOPIC_RFLEARN "rflearn"
  561. #define MQTT_TOPIC_RFRAW "rfraw"
  562. #define MQTT_TOPIC_UARTIN "uartin"
  563. #define MQTT_TOPIC_UARTOUT "uartout"
  564. #define MQTT_TOPIC_LOADAVG "loadavg"
  565. #define MQTT_TOPIC_BOARD "board"
  566. #define MQTT_TOPIC_PULSE "pulse"
  567. #define MQTT_TOPIC_SPEED "speed"
  568. #define MQTT_TOPIC_IRIN "irin"
  569. #define MQTT_TOPIC_IROUT "irout"
  570. // Light module
  571. #define MQTT_TOPIC_CHANNEL "channel"
  572. #define MQTT_TOPIC_COLOR_RGB "rgb"
  573. #define MQTT_TOPIC_COLOR_HSV "hsv"
  574. #define MQTT_TOPIC_ANIM_MODE "anim_mode"
  575. #define MQTT_TOPIC_ANIM_SPEED "anim_speed"
  576. #define MQTT_TOPIC_BRIGHTNESS "brightness"
  577. #define MQTT_TOPIC_MIRED "mired"
  578. #define MQTT_TOPIC_KELVIN "kelvin"
  579. #define MQTT_STATUS_ONLINE "1" // Value for the device ON message
  580. #define MQTT_STATUS_OFFLINE "0" // Value for the device OFF message (will)
  581. #define MQTT_ACTION_RESET "reboot" // RESET MQTT topic particle
  582. #define MQTT_MESSAGE_ID_SHIFT 1000 // Store MQTT message id into EEPROM every these many
  583. // Custom get and set postfixes
  584. // Use something like "/status" or "/set", with leading slash
  585. // Since 1.9.0 the default value is "" for getter and "/set" for setter
  586. #ifndef MQTT_GETTER
  587. #define MQTT_GETTER ""
  588. #endif
  589. #ifndef MQTT_SETTER
  590. #define MQTT_SETTER "/set"
  591. #endif
  592. // -----------------------------------------------------------------------------
  593. // BROKER
  594. // -----------------------------------------------------------------------------
  595. #ifndef BROKER_SUPPORT
  596. #define BROKER_SUPPORT 1 // The broker is a poor-man's pubsub manager
  597. #endif
  598. // -----------------------------------------------------------------------------
  599. // SETTINGS
  600. // -----------------------------------------------------------------------------
  601. #ifndef SETTINGS_AUTOSAVE
  602. #define SETTINGS_AUTOSAVE 1 // Autosave settings o force manual commit
  603. #endif
  604. #define SETTINGS_MAX_LIST_COUNT 10 // Maximum index for settings lists
  605. // -----------------------------------------------------------------------------
  606. // LIGHT
  607. // -----------------------------------------------------------------------------
  608. // LIGHT_PROVIDER_DIMMER can have from 1 to 5 different channels.
  609. // They have to be defined for each device in the hardware.h file.
  610. // If 3 or more channels first 3 will be considered RGB.
  611. // Usual configurations are:
  612. // 1 channels => W
  613. // 2 channels => WW
  614. // 3 channels => RGB
  615. // 4 channels => RGBW
  616. // 5 channels => RGBWW
  617. #ifndef LIGHT_SAVE_ENABLED
  618. #define LIGHT_SAVE_ENABLED 1 // Light channel values saved by default after each change
  619. #endif
  620. #ifndef LIGHT_SAVE_DELAY
  621. #define LIGHT_SAVE_DELAY 5 // Persist color after 5 seconds to avoid wearing out
  622. #endif
  623. #ifndef LIGHT_MAX_PWM
  624. #if LIGHT_PROVIDER == LIGHT_PROVIDER_MY92XX
  625. #define LIGHT_MAX_PWM 255
  626. #endif
  627. #if LIGHT_PROVIDER == LIGHT_PROVIDER_DIMMER
  628. #define LIGHT_MAX_PWM 10000 // 10000 * 200ns => 2 kHz
  629. #endif
  630. #endif // LIGHT_MAX_PWM
  631. #ifndef LIGHT_LIMIT_PWM
  632. #define LIGHT_LIMIT_PWM LIGHT_MAX_PWM // Limit PWM to this value (prevent 100% power)
  633. #endif
  634. #ifndef LIGHT_MAX_VALUE
  635. #define LIGHT_MAX_VALUE 255 // Maximum light value
  636. #endif
  637. #ifndef LIGHT_MAX_BRIGHTNESS
  638. #define LIGHT_MAX_BRIGHTNESS 255 // Maximun brightness value
  639. #endif
  640. #define LIGHT_MIN_MIREDS 153 // Default to the Philips Hue value that HA also use.
  641. #define LIGHT_MAX_MIREDS 500 // https://developers.meethue.com/documentation/core-concepts
  642. #ifndef LIGHT_STEP
  643. #define LIGHT_STEP 32 // Step size
  644. #endif
  645. #ifndef LIGHT_USE_COLOR
  646. #define LIGHT_USE_COLOR 1 // Use 3 first channels as RGB
  647. #endif
  648. #ifndef LIGHT_USE_WHITE
  649. #define LIGHT_USE_WHITE 0 // Use the 4th channel as (Warm-)White LEDs
  650. #endif
  651. #ifndef LIGHT_USE_CCT
  652. #define LIGHT_USE_CCT 0 // Use the 5th channel as Coldwhite LEDs, LIGHT_USE_WHITE must be 1.
  653. #endif
  654. // Used when LIGHT_USE_WHITE AND LIGHT_USE_CCT is 1 - (1000000/Kelvin = MiReds)
  655. // Warning! Don't change this yet, NOT FULLY IMPLEMENTED!
  656. #define LIGHT_COLDWHITE_MIRED 153 // Coldwhite Strip, Value must be __BELOW__ W2!! (Default: 6535 Kelvin/153 MiRed)
  657. #define LIGHT_WARMWHITE_MIRED 500 // Warmwhite Strip, Value must be __ABOVE__ W1!! (Default: 2000 Kelvin/500 MiRed)
  658. #ifndef LIGHT_USE_GAMMA
  659. #define LIGHT_USE_GAMMA 0 // Use gamma correction for color channels
  660. #endif
  661. #ifndef LIGHT_USE_CSS
  662. #define LIGHT_USE_CSS 1 // Use CSS style to report colors (1=> "#FF0000", 0=> "255,0,0")
  663. #endif
  664. #ifndef LIGHT_USE_RGB
  665. #define LIGHT_USE_RGB 0 // Use RGB color selector (1=> RGB, 0=> HSV)
  666. #endif
  667. #ifndef LIGHT_WHITE_FACTOR
  668. #define LIGHT_WHITE_FACTOR 1 // When using LIGHT_USE_WHITE with uneven brightness LEDs,
  669. // this factor is used to scale the white channel to match brightness
  670. #endif
  671. #ifndef LIGHT_USE_TRANSITIONS
  672. #define LIGHT_USE_TRANSITIONS 1 // Transitions between colors
  673. #endif
  674. #ifndef LIGHT_TRANSITION_STEP
  675. #define LIGHT_TRANSITION_STEP 10 // Time in millis between each transtion step
  676. #endif
  677. #ifndef LIGHT_TRANSITION_TIME
  678. #define LIGHT_TRANSITION_TIME 500 // Time in millis from color to color
  679. #endif
  680. // -----------------------------------------------------------------------------
  681. // DOMOTICZ
  682. // -----------------------------------------------------------------------------
  683. #ifndef DOMOTICZ_SUPPORT
  684. #define DOMOTICZ_SUPPORT MQTT_SUPPORT // Build with domoticz (if MQTT) support (1.72Kb)
  685. #endif
  686. #define DOMOTICZ_ENABLED 0 // Disable domoticz by default
  687. #define DOMOTICZ_IN_TOPIC "domoticz/in" // Default subscription topic
  688. #define DOMOTICZ_OUT_TOPIC "domoticz/out" // Default publication topic
  689. // -----------------------------------------------------------------------------
  690. // HOME ASSISTANT
  691. // -----------------------------------------------------------------------------
  692. #ifndef HOMEASSISTANT_SUPPORT
  693. #define HOMEASSISTANT_SUPPORT MQTT_SUPPORT // Build with home assistant support (if MQTT, 1.64Kb)
  694. #endif
  695. #define HOMEASSISTANT_ENABLED 0 // Integration not enabled by default
  696. #define HOMEASSISTANT_PREFIX "homeassistant" // Default MQTT prefix
  697. #ifndef HOMEASSISTANT_PAYLOAD_ON
  698. #define HOMEASSISTANT_PAYLOAD_ON "1" // Payload for ON and available messages
  699. #endif
  700. #ifndef HOMEASSISTANT_PAYLOAD_OFF
  701. #define HOMEASSISTANT_PAYLOAD_OFF "0" // Payload for OFF and unavailable messages
  702. #endif
  703. #ifndef HOMEASSISTANT_PAYLOAD_AVAILABLE
  704. #define HOMEASSISTANT_PAYLOAD_AVAILABLE "1" // Payload for available messages
  705. #endif
  706. #ifndef HOMEASSISTANT_PAYLOAD_NOT_AVAILABLE
  707. #define HOMEASSISTANT_PAYLOAD_NOT_AVAILABLE "0" // Payload for available messages
  708. #endif
  709. // -----------------------------------------------------------------------------
  710. // INFLUXDB
  711. // -----------------------------------------------------------------------------
  712. #ifndef INFLUXDB_SUPPORT
  713. #define INFLUXDB_SUPPORT 0 // Disable InfluxDB support by default (4.38Kb)
  714. #endif
  715. #ifndef INFLUXDB_ENABLED
  716. #define INFLUXDB_ENABLED 0 // InfluxDB disabled by default
  717. #endif
  718. #ifndef INFLUXDB_HOST
  719. #define INFLUXDB_HOST "" // Default server
  720. #endif
  721. #ifndef INFLUXDB_PORT
  722. #define INFLUXDB_PORT 8086 // Default InfluxDB port
  723. #endif
  724. #ifndef INFLUXDB_DATABASE
  725. #define INFLUXDB_DATABASE "" // Default database
  726. #endif
  727. #ifndef INFLUXDB_USERNAME
  728. #define INFLUXDB_USERNAME "" // Default username
  729. #endif
  730. #ifndef INFLUXDB_PASSWORD
  731. #define INFLUXDB_PASSWORD "" // Default password
  732. #endif
  733. // -----------------------------------------------------------------------------
  734. // THINGSPEAK
  735. // -----------------------------------------------------------------------------
  736. #ifndef THINGSPEAK_SUPPORT
  737. #define THINGSPEAK_SUPPORT 1 // Enable Thingspeak support by default (2.56Kb)
  738. #endif
  739. #ifndef THINGSPEAK_ENABLED
  740. #define THINGSPEAK_ENABLED 0 // Thingspeak disabled by default
  741. #endif
  742. #ifndef THINGSPEAK_APIKEY
  743. #define THINGSPEAK_APIKEY "" // Default API KEY
  744. #endif
  745. #define THINGSPEAK_USE_ASYNC 1 // Use AsyncClient instead of WiFiClientSecure
  746. // THINGSPEAK OVER SSL
  747. // Using THINGSPEAK over SSL works well but generates problems with the web interface,
  748. // so you should compile it with WEB_SUPPORT to 0.
  749. // When THINGSPEAK_USE_ASYNC is 1, requires ASYNC_TCP_SSL_ENABLED to 1 and ESP8266 Arduino Core 2.4.0.
  750. #define THINGSPEAK_USE_SSL 0 // Use secure connection
  751. #define THINGSPEAK_FINGERPRINT "78 60 18 44 81 35 BF DF 77 84 D4 0A 22 0D 9B 4E 6C DC 57 2C"
  752. #define THINGSPEAK_HOST "api.thingspeak.com"
  753. #if THINGSPEAK_USE_SSL
  754. #define THINGSPEAK_PORT 443
  755. #else
  756. #define THINGSPEAK_PORT 80
  757. #endif
  758. #define THINGSPEAK_URL "/update"
  759. #define THINGSPEAK_MIN_INTERVAL 15000 // Minimum interval between POSTs (in millis)
  760. // -----------------------------------------------------------------------------
  761. // SCHEDULER
  762. // -----------------------------------------------------------------------------
  763. #ifndef SCHEDULER_SUPPORT
  764. #define SCHEDULER_SUPPORT 1 // Enable scheduler (1.77Kb)
  765. #endif
  766. #ifndef SCHEDULER_MAX_SCHEDULES
  767. #define SCHEDULER_MAX_SCHEDULES 10 // Max schedules alowed
  768. #endif
  769. // -----------------------------------------------------------------------------
  770. // NTP
  771. // -----------------------------------------------------------------------------
  772. #ifndef NTP_SUPPORT
  773. #define NTP_SUPPORT 1 // Build with NTP support by default (6.78Kb)
  774. #endif
  775. #ifndef NTP_SERVER
  776. #define NTP_SERVER "pool.ntp.org" // Default NTP server
  777. #endif
  778. #ifndef NTP_TIMEOUT
  779. #define NTP_TIMEOUT 1000 // Set NTP request timeout to 2 seconds (issue #452)
  780. #endif
  781. #ifndef NTP_TIME_OFFSET
  782. #define NTP_TIME_OFFSET 60 // Default timezone offset (GMT+1)
  783. #endif
  784. #ifndef NTP_DAY_LIGHT
  785. #define NTP_DAY_LIGHT 1 // Enable daylight time saving by default
  786. #endif
  787. #ifndef NTP_SYNC_INTERVAL
  788. #define NTP_SYNC_INTERVAL 60 // NTP initial check every minute
  789. #endif
  790. #ifndef NTP_UPDATE_INTERVAL
  791. #define NTP_UPDATE_INTERVAL 1800 // NTP check every 30 minutes
  792. #endif
  793. #ifndef NTP_START_DELAY
  794. #define NTP_START_DELAY 1000 // Delay NTP start 1 second
  795. #endif
  796. #ifndef NTP_DST_REGION
  797. #define NTP_DST_REGION 0 // 0 for Europe, 1 for USA (defined in NtpClientLib)
  798. #endif
  799. // -----------------------------------------------------------------------------
  800. // ALEXA
  801. // -----------------------------------------------------------------------------
  802. // This setting defines whether Alexa support should be built into the firmware
  803. #ifndef ALEXA_SUPPORT
  804. #define ALEXA_SUPPORT 1 // Enable Alexa support by default (10.84Kb)
  805. #endif
  806. // This is default value for the alexaEnabled setting that defines whether
  807. // this device should be discoberable and respond to Alexa commands.
  808. // Both ALEXA_SUPPORT and alexaEnabled should be 1 for Alexa support to work.
  809. #ifndef ALEXA_ENABLED
  810. #define ALEXA_ENABLED 1
  811. #endif
  812. // -----------------------------------------------------------------------------
  813. // RFBRIDGE
  814. // This module is not compatible with RF_SUPPORT=1
  815. // -----------------------------------------------------------------------------
  816. #ifndef RF_SEND_TIMES
  817. #define RF_SEND_TIMES 4 // How many times to send the message
  818. #endif
  819. #ifndef RF_SEND_DELAY
  820. #define RF_SEND_DELAY 500 // Interval between sendings in ms
  821. #endif
  822. #ifndef RF_RECEIVE_DELAY
  823. #define RF_RECEIVE_DELAY 500 // Interval between recieving in ms (avoid debouncing)
  824. #endif
  825. #ifndef RF_RAW_SUPPORT
  826. #define RF_RAW_SUPPORT 0 // RF raw codes require a specific firmware for the EFM8BB1
  827. // https://github.com/rhx/RF-Bridge-EFM8BB1
  828. #endif
  829. // -----------------------------------------------------------------------------
  830. // IR Bridge
  831. // -----------------------------------------------------------------------------
  832. #ifndef IR_SUPPORT
  833. #define IR_SUPPORT 0 // Do not build with IR support by default (10.25Kb)
  834. #endif
  835. //#define IR_RX_PIN 5 // GPIO the receiver is connected to
  836. //#define IR_TX_PIN 4 // GPIO the transmitter is connected to
  837. #ifndef IR_USE_RAW
  838. #define IR_USE_RAW 0 // Use raw codes
  839. #endif
  840. #ifndef IR_BUFFER_SIZE
  841. #define IR_BUFFER_SIZE 1024
  842. #endif
  843. #ifndef IR_TIMEOUT
  844. #define IR_TIMEOUT 15U
  845. #endif
  846. #ifndef IR_REPEAT
  847. #define IR_REPEAT 1
  848. #endif
  849. #ifndef IR_DELAY
  850. #define IR_DELAY 100
  851. #endif
  852. #ifndef IR_DEBOUNCE
  853. #define IR_DEBOUNCE 500 // IR debounce time in milliseconds
  854. #endif
  855. #ifndef IR_BUTTON_SET
  856. #define IR_BUTTON_SET 0 // IR button set to use (see below)
  857. #endif
  858. // -----------------------------------------------------------------------------
  859. // Remote Buttons SET 1 (for the original Remote shipped with the controller)
  860. #if IR_BUTTON_SET == 1
  861. /*
  862. +------+------+------+------+
  863. | UP | Down | OFF | ON |
  864. +------+------+------+------+
  865. | R | G | B | W |
  866. +------+------+------+------+
  867. | 1 | 2 | 3 |FLASH |
  868. +------+------+------+------+
  869. | 4 | 5 | 6 |STROBE|
  870. +------+------+------+------+
  871. | 7 | 8 | 9 | FADE |
  872. +------+------+------+------+
  873. | 10 | 11 | 12 |SMOOTH|
  874. +------+------+------+------+
  875. */
  876. #define IR_BUTTON_COUNT 24
  877. const uint32_t IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  878. { 0xFF906F, IR_BUTTON_MODE_BRIGHTER, 1 },
  879. { 0xFFB847, IR_BUTTON_MODE_BRIGHTER, 0 },
  880. { 0xFFF807, IR_BUTTON_MODE_STATE, 0 },
  881. { 0xFFB04F, IR_BUTTON_MODE_STATE, 1 },
  882. { 0xFF9867, IR_BUTTON_MODE_RGB, 0xFF0000 },
  883. { 0xFFD827, IR_BUTTON_MODE_RGB, 0x00FF00 },
  884. { 0xFF8877, IR_BUTTON_MODE_RGB, 0x0000FF },
  885. { 0xFFA857, IR_BUTTON_MODE_RGB, 0xFFFFFF },
  886. { 0xFFE817, IR_BUTTON_MODE_RGB, 0xD13A01 },
  887. { 0xFF48B7, IR_BUTTON_MODE_RGB, 0x00E644 },
  888. { 0xFF6897, IR_BUTTON_MODE_RGB, 0x0040A7 },
  889. { 0xFFB24D, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FLASH },
  890. { 0xFF02FD, IR_BUTTON_MODE_RGB, 0xE96F2A },
  891. { 0xFF32CD, IR_BUTTON_MODE_RGB, 0x00BEBF },
  892. { 0xFF20DF, IR_BUTTON_MODE_RGB, 0x56406F },
  893. { 0xFF00FF, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_STROBE },
  894. { 0xFF50AF, IR_BUTTON_MODE_RGB, 0xEE9819 },
  895. { 0xFF7887, IR_BUTTON_MODE_RGB, 0x00799A },
  896. { 0xFF708F, IR_BUTTON_MODE_RGB, 0x944E80 },
  897. { 0xFF58A7, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FADE },
  898. { 0xFF38C7, IR_BUTTON_MODE_RGB, 0xFFFF00 },
  899. { 0xFF28D7, IR_BUTTON_MODE_RGB, 0x0060A1 },
  900. { 0xFFF00F, IR_BUTTON_MODE_RGB, 0xEF45AD },
  901. { 0xFF30CF, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_SMOOTH }
  902. };
  903. #endif
  904. //Remote Buttons SET 2 (another identical IR Remote shipped with another controller)
  905. #if IR_BUTTON_SET == 2
  906. /*
  907. +------+------+------+------+
  908. | UP | Down | OFF | ON |
  909. +------+------+------+------+
  910. | R | G | B | W |
  911. +------+------+------+------+
  912. | 1 | 2 | 3 |FLASH |
  913. +------+------+------+------+
  914. | 4 | 5 | 6 |STROBE|
  915. +------+------+------+------+
  916. | 7 | 8 | 9 | FADE |
  917. +------+------+------+------+
  918. | 10 | 11 | 12 |SMOOTH|
  919. +------+------+------+------+
  920. */
  921. #define IR_BUTTON_COUNT 24
  922. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  923. { 0xFF00FF, IR_BUTTON_MODE_BRIGHTER, 1 },
  924. { 0xFF807F, IR_BUTTON_MODE_BRIGHTER, 0 },
  925. { 0xFF40BF, IR_BUTTON_MODE_STATE, 0 },
  926. { 0xFFC03F, IR_BUTTON_MODE_STATE, 1 },
  927. { 0xFF20DF, IR_BUTTON_MODE_RGB, 0xFF0000 },
  928. { 0xFFA05F, IR_BUTTON_MODE_RGB, 0x00FF00 },
  929. { 0xFF609F, IR_BUTTON_MODE_RGB, 0x0000FF },
  930. { 0xFFE01F, IR_BUTTON_MODE_RGB, 0xFFFFFF },
  931. { 0xFF10EF, IR_BUTTON_MODE_RGB, 0xD13A01 },
  932. { 0xFF906F, IR_BUTTON_MODE_RGB, 0x00E644 },
  933. { 0xFF50AF, IR_BUTTON_MODE_RGB, 0x0040A7 },
  934. { 0xFFD02F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FLASH },
  935. { 0xFF30CF, IR_BUTTON_MODE_RGB, 0xE96F2A },
  936. { 0xFFB04F, IR_BUTTON_MODE_RGB, 0x00BEBF },
  937. { 0xFF708F, IR_BUTTON_MODE_RGB, 0x56406F },
  938. { 0xFFF00F, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_STROBE },
  939. { 0xFF08F7, IR_BUTTON_MODE_RGB, 0xEE9819 },
  940. { 0xFF8877, IR_BUTTON_MODE_RGB, 0x00799A },
  941. { 0xFF48B7, IR_BUTTON_MODE_RGB, 0x944E80 },
  942. { 0xFFC837, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_FADE },
  943. { 0xFF28D7, IR_BUTTON_MODE_RGB, 0xFFFF00 },
  944. { 0xFFA857, IR_BUTTON_MODE_RGB, 0x0060A1 },
  945. { 0xFF6897, IR_BUTTON_MODE_RGB, 0xEF45AD },
  946. { 0xFFE817, IR_BUTTON_MODE_EFFECT, LIGHT_EFFECT_SMOOTH }
  947. };
  948. #endif
  949. //Remote Buttons SET 3 (samsung AA59-00608A 8 Toggle Buttons for generic 8CH module)
  950. #if IR_BUTTON_SET == 3
  951. /*
  952. +------+------+------+
  953. | 1 | 2 | 3 |
  954. +------+------+------+
  955. | 4 | 5 | 6 |
  956. +------+------+------+
  957. | 7 | 8 | 9 |
  958. +------+------+------+
  959. | | 0 | |
  960. +------+------+------+
  961. */
  962. #define IR_BUTTON_COUNT 10
  963. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  964. { 0xE0E020DF, IR_BUTTON_MODE_TOGGLE, 0 }, // Toggle Relay #0
  965. { 0xE0E0A05F, IR_BUTTON_MODE_TOGGLE, 1 }, // Toggle Relay #1
  966. { 0xE0E0609F, IR_BUTTON_MODE_TOGGLE, 2 }, // Toggle Relay #2
  967. { 0xE0E010EF, IR_BUTTON_MODE_TOGGLE, 3 }, // Toggle Relay #3
  968. { 0xE0E0906F, IR_BUTTON_MODE_TOGGLE, 4 }, // Toggle Relay #4
  969. { 0xE0E050AF, IR_BUTTON_MODE_TOGGLE, 5 }, // Toggle Relay #5
  970. { 0xE0E030CF, IR_BUTTON_MODE_TOGGLE, 6 }, // Toggle Relay #6
  971. { 0xE0E0B04F, IR_BUTTON_MODE_TOGGLE, 7 } // Toggle Relay #7
  972. //{ 0xE0E0708F, IR_BUTTON_MODE_TOGGLE, 8 } //Extra Button
  973. //{ 0xE0E08877, IR_BUTTON_MODE_TOGGLE, 9 } //Extra Button
  974. };
  975. #endif
  976. //Remote Buttons SET 4
  977. #if IR_BUTTON_SET == 4
  978. /*
  979. +------+------+------+
  980. | OFF | SRC | MUTE |
  981. +------+------+------+
  982. ...
  983. +------+------+------+
  984. */
  985. #define IR_BUTTON_COUNT 1
  986. const unsigned long IR_BUTTON[IR_BUTTON_COUNT][3] PROGMEM = {
  987. { 0xFFB24D, IR_BUTTON_MODE_TOGGLE, 0 } // Toggle Relay #0
  988. };
  989. #endif
  990. #ifndef IR_BUTTON_COUNT
  991. #define IR_BUTTON_COUNT 0
  992. #endif
  993. //--------------------------------------------------------------------------------
  994. // Custom RF module
  995. // Check http://tinkerman.cat/adding-rf-to-a-non-rf-itead-sonoff/
  996. // Enable support by passing RF_SUPPORT=1 build flag
  997. // This module is not compatible with RFBRIDGE or SONOFF RF
  998. //--------------------------------------------------------------------------------
  999. #ifndef RF_SUPPORT
  1000. #define RF_SUPPORT 0
  1001. #endif
  1002. #ifndef RF_PIN
  1003. #define RF_PIN 14
  1004. #endif
  1005. #define RF_DEBOUNCE 500
  1006. #define RF_LEARN_TIMEOUT 60000
  1007. //--------------------------------------------------------------------------------
  1008. // Custom RFM69 to MQTT bridge
  1009. // Check http://tinkerman.cat/rfm69-wifi-gateway/
  1010. // Enable support by passing RFM69_SUPPORT=1 build flag
  1011. //--------------------------------------------------------------------------------
  1012. #ifndef RFM69_SUPPORT
  1013. #define RFM69_SUPPORT 0
  1014. #endif
  1015. #ifndef RFM69_MAX_TOPICS
  1016. #define RFM69_MAX_TOPICS 50
  1017. #endif
  1018. #ifndef RFM69_DEFAULT_TOPIC
  1019. #define RFM69_DEFAULT_TOPIC "/rfm69gw/{node}/{key}"
  1020. #endif
  1021. #ifndef RFM69_NODE_ID
  1022. #define RFM69_NODE_ID 2
  1023. #endif
  1024. #ifndef RFM69_GATEWAY_ID
  1025. #define RFM69_GATEWAY_ID 2
  1026. #endif
  1027. #ifndef RFM69_NETWORK_ID
  1028. #define RFM69_NETWORK_ID 164
  1029. #endif
  1030. #ifndef RFM69_PROMISCUOUS
  1031. #define RFM69_PROMISCUOUS 1
  1032. #endif
  1033. #ifndef RFM69_PROMISCUOUS_SENDS
  1034. #define RFM69_PROMISCUOUS_SENDS 0
  1035. #endif
  1036. #ifndef RFM69_FREQUENCY
  1037. #define RFM69_FREQUENCY RF69_868MHZ
  1038. #endif
  1039. #ifndef RFM69_ENCRYPTKEY
  1040. #define RFM69_ENCRYPTKEY "fibonacci0123456"
  1041. #endif
  1042. #ifndef RFM69_CS_PIN
  1043. #define RFM69_CS_PIN SS
  1044. #endif
  1045. #ifndef RFM69_IRQ_PIN
  1046. #define RFM69_IRQ_PIN 5
  1047. #endif
  1048. #ifndef RFM69_RESET_PIN
  1049. #define RFM69_RESET_PIN 7
  1050. #endif
  1051. #ifndef RFM69_IS_RFM69HW
  1052. #define RFM69_IS_RFM69HW 0
  1053. #endif