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.

187 lines
6.4 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
  1. //------------------------------------------------------------------------------
  2. // GENERAL
  3. //------------------------------------------------------------------------------
  4. #define SERIAL_BAUDRATE 115200
  5. #define HOSTNAME DEVICE
  6. #define BUFFER_SIZE 1024
  7. #define HEARTBEAT_INTERVAL 300000
  8. //--------------------------------------------------------------------------------
  9. // EEPROM
  10. //--------------------------------------------------------------------------------
  11. #define EEPROM_RELAY_STATUS 0
  12. #define EEPROM_ENERGY_COUNT 1
  13. //--------------------------------------------------------------------------------
  14. // BUTTON
  15. //--------------------------------------------------------------------------------
  16. #define BUTTON_EVENT_NONE 0
  17. #define BUTTON_EVENT_PRESSED 1
  18. #define BUTTON_EVENT_CLICK 2
  19. #define BUTTON_EVENT_DBLCLICK 3
  20. #define BUTTON_EVENT_LNGCLICK 4
  21. #define BUTTON_MODE_NONE 0
  22. #define BUTTON_MODE_TOGGLE 1
  23. #define BUTTON_MODE_AP 2
  24. #define BUTTON_MODE_RESET 3
  25. #define BUTTON_MODE_PULSE 4
  26. #define BUTTON_DEFAULT_MODE BUTTON_MODE_TOGGLE
  27. //--------------------------------------------------------------------------------
  28. // RELAY
  29. //--------------------------------------------------------------------------------
  30. #define RELAY_MODE_OFF 0
  31. #define RELAY_MODE_ON 1
  32. #define RELAY_MODE_SAME 2
  33. #define RELAY_MODE_TOOGLE 3
  34. #define RELAY_SYNC_ANY 0
  35. #define RELAY_SYNC_NONE_OR_ONE 1
  36. #define RELAY_SYNC_ONE 2
  37. #define RELAY_SYNC_SAME 3
  38. #define RELAY_PULSE_NONE 0
  39. #define RELAY_PULSE_OFF 1
  40. #define RELAY_PULSE_ON 2
  41. // Pulse time in seconds
  42. #define RELAY_PULSE_TIME 1
  43. // 0 means OFF, 1 ON and 2 whatever was before
  44. #define RELAY_MODE RELAY_MODE_OFF
  45. // 0 means ANY, 1 zero or one and 2 one and only one
  46. #define RELAY_SYNC RELAY_SYNC_ANY
  47. // 0 means no pulses, 1 means normally off, 2 normally on
  48. #define RELAY_PULSE_MODE RELAY_PULSE_NONE
  49. //--------------------------------------------------------------------------------
  50. // I18N
  51. //--------------------------------------------------------------------------------
  52. #define TMP_CELSIUS 0
  53. #define TMP_FAHRENHEIT 1
  54. #define TMP_UNITS TMP_CELSIUS
  55. //--------------------------------------------------------------------------------
  56. // LED
  57. //--------------------------------------------------------------------------------
  58. // All defined LEDs in the board can be managed through MQTT
  59. // except the first one when LED_AUTO is set to 1.
  60. // If LED_AUTO is set to 1 the board will use first defined LED to show wifi status.
  61. #define LED_AUTO 1
  62. // -----------------------------------------------------------------------------
  63. // WIFI & WEB
  64. // -----------------------------------------------------------------------------
  65. #define WIFI_RECONNECT_INTERVAL 300000
  66. #define WIFI_MAX_NETWORKS 5
  67. #define ADMIN_PASS "fibonacci"
  68. #define FORCE_CHANGE_PASS 1
  69. #define HTTP_USERNAME "admin"
  70. #define WS_BUFFER_SIZE 5
  71. #define WS_TIMEOUT 1800000
  72. #define WEBSERVER_PORT 80
  73. #define DNS_PORT 53
  74. #define WEB_MODE_NORMAL 0
  75. #define WEB_MODE_PASSWORD 1
  76. #define AP_MODE AP_MODE_ALONE
  77. #define AP_MODE_IP "192.168.4.1"
  78. #define AP_MODE_GW "192.168.4.1"
  79. #define AP_MODE_MASK "255.255.255.0"
  80. // -----------------------------------------------------------------------------
  81. // OTA & NOFUSS
  82. // -----------------------------------------------------------------------------
  83. #define OTA_PORT 8266
  84. #define NOFUSS_SERVER ""
  85. #define NOFUSS_INTERVAL 3600000
  86. // -----------------------------------------------------------------------------
  87. // MQTT
  88. // -----------------------------------------------------------------------------
  89. #define MQTT_SERVER ""
  90. #define MQTT_PORT 1883
  91. #define MQTT_TOPIC "/test/switch/{identifier}"
  92. #define MQTT_RETAIN true
  93. #define MQTT_QOS 0
  94. #define MQTT_KEEPALIVE 30
  95. #define MQTT_RECONNECT_DELAY 10000
  96. #define MQTT_TRY_INTERVAL 30000
  97. #define MQTT_MAX_TRIES 12
  98. #define MQTT_SKIP_RETAINED 1
  99. #define MQTT_SKIP_TIME 1000
  100. #define MQTT_ACTION_TOPIC "/action"
  101. #define MQTT_RELAY_TOPIC "/relay"
  102. #define MQTT_LED_TOPIC "/led"
  103. #define MQTT_BUTTON_TOPIC "/button"
  104. #define MQTT_IP_TOPIC "/ip"
  105. #define MQTT_VERSION_TOPIC "/version"
  106. #define MQTT_HEARTBEAT_TOPIC "/status"
  107. #define MQTT_ACTION_RESET "reset"
  108. #define MQTT_CONNECT_EVENT 0
  109. #define MQTT_DISCONNECT_EVENT 1
  110. #define MQTT_MESSAGE_EVENT 2
  111. // Custom get and set postfixes
  112. // Use something like "/status" or "/set", with leading slash
  113. #define MQTT_USE_GETTER ""
  114. #define MQTT_USE_SETTER ""
  115. // -----------------------------------------------------------------------------
  116. // I2C
  117. // -----------------------------------------------------------------------------
  118. #define ENABLE_I2C 0
  119. #define I2C_SDA_PIN 4
  120. #define I2C_SCL_PIN 14
  121. #define I2C_CLOCK_STRETCH_TIME 200
  122. #define I2C_SCL_FREQUENCY 1000
  123. // -----------------------------------------------------------------------------
  124. // DOMOTICZ
  125. // -----------------------------------------------------------------------------
  126. #ifndef ENABLE_DOMOTICZ
  127. #define ENABLE_DOMOTICZ 1
  128. #endif
  129. #define DOMOTICZ_IN_TOPIC "domoticz/in"
  130. #define DOMOTICZ_OUT_TOPIC "domoticz/out"
  131. // -----------------------------------------------------------------------------
  132. // NTP
  133. // -----------------------------------------------------------------------------
  134. #define NTP_SERVER "pool.ntp.org"
  135. #define NTP_TIME_OFFSET 1
  136. #define NTP_DAY_LIGHT true
  137. #define NTP_UPDATE_INTERVAL 1800
  138. // -----------------------------------------------------------------------------
  139. // FAUXMO
  140. // -----------------------------------------------------------------------------
  141. // This setting defines whether Alexa support should be built into the firmware
  142. #ifndef ENABLE_FAUXMO
  143. #define ENABLE_FAUXMO 1
  144. #endif
  145. // This is default value for the fauxmoEnabled setting that defines whether
  146. // this device should be discoberable and respond to Alexa commands.
  147. // Both ENABLE_FAUXMO and fauxmoEnabled should be 1 for Alexa support to work.
  148. #define FAUXMO_ENABLED 1