MySensors Library & Examples  2.3.2
Macros

Detailed Description

MySensors specific configuration flags.

Set these in your sketch before including MySensors.h to customize the library to your needs. If the sketch does not define these flags, they will get default values where applicable.

Definition in file MyConfig.h.

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MY_RS485_BAUD_RATE   (9600)
 The RS485 BAUD rate.
 
#define MY_RS485_MAX_MESSAGE_LENGTH   (40)
 The maximum message length used for RS485.
 
#define MY_RS485_SOH_COUNT   (1)
 Use this in case of collisions on the bus. 3 might be a good setting.
 
#define MY_RF24_SPI_SPEED   (2*1000000ul)
 Define this if you need to run the SPI clock at a different frequency than the default. More...
 
#define MY_RF24_CE_PIN   (DEFAULT_RF24_CE_PIN)
 Define this to change the chip enable pin from the default.
 
#define MY_RF24_CS_PIN   (DEFAULT_RF24_CS_PIN)
 Define this to change the chip select pin from the default.
 
#define MY_RF24_PA_LEVEL   (RF24_PA_HIGH)
 Default RF24 PA level. Override in sketch if needed. More...
 
#define MY_RF24_CHANNEL   (76)
 RF channel for the sensor net, 0-125. More...
 
#define MY_RF24_DATARATE   (RF24_250KBPS)
 RF24 data rate. More...
 
#define MY_RF24_BASE_RADIO_ID   0x00,0xFC,0xE1,0xA8,0xA8
 RF24 radio network identifier. More...
 
#define MY_RF24_ADDR_WIDTH   (5)
 RF24 base address width.
 
#define MY_NRF5_ESB_PA_LEVEL   (NRF5_PA_MAX)
 Default nRF5 PA level. Override in sketch if needed. More...
 
#define MY_NRF5_ESB_CHANNEL   (76)
 RF channel for the sensor net, 0-125. More...
 
#define MY_NRF5_ESB_MODE   (NRF5_250KBPS)
 nRF5 mode. More...
 
#define MY_NRF5_ESB_BASE_RADIO_ID   0x00, 0xFC, 0xE1, 0xA8, 0xA8
 nRF5 radio network identifier. More...
 
#define MY_NRF5_ESB_ADDR_WIDTH   (5)
 nRF5 base address width.
 
#define MY_NRF5_ESB_RX_BUFFER_SIZE   (20)
 Declare the amount of incoming messages that can be buffered at driver level.
 
#define MY_RFM69_FREQUENCY   (RFM69_868MHZ)
 The frequency to use. More...
 
#define MY_RFM69HW   false
 Set to true if MY_IS_RFM69HW is set. More...
 
#define MY_RFM69_TX_POWER_DBM   (5)
 Set TX power level, default 5dBm (overridden if ATC mode enabled).
 
#define MY_RFM69_ATC_TARGET_RSSI_DBM   (-80)
 Target RSSI level (in dBm) for RFM69 ATC mode.
 
#define MY_RFM69_NETWORKID   (100)
 RFM69 Network ID. Use the same for all nodes that will talk to each other.
 
#define MY_RFM69_IRQ_PIN   DEFAULT_RFM69_IRQ_PIN
 Define this to override the default RFM69 IRQ pin assignment.
 
#define MY_RFM69_IRQ_NUM   digitalPinToInterrupt(MY_RFM69_IRQ_PIN)
 RFM69 IRQ number.
 
#define MY_RFM69_CS_PIN   DEFAULT_RFM69_CS_PIN
 RFM69 SPI chip select pin.
 
#define MY_RFM69_SPI_SPEED   (4*1000000ul)
 Set to overrule default RFM69 SPI speed.
 
#define MY_RFM95_FREQUENCY   (RFM95_868MHZ)
 The frequency to use. More...
 
#define MY_RFM95_MODEM_CONFIGRUATION   RFM95_BW125CR45SF128
 RFM95 modem configuration. More...
 
#define MY_RFM95_IRQ_PIN   DEFAULT_RFM95_IRQ_PIN
 Define this to use the RFM95 IRQ pin.
 
#define MY_RFM95_IRQ_NUM   digitalPinToInterrupt(MY_RFM95_IRQ_PIN)
 RFM95 IRQ number.
 
#define MY_RFM95_CS_PIN   DEFAULT_RFM95_CS_PIN
 RFM95 SPI chip select pin.
 
#define MY_RFM95_SPI_SPEED   (4*1000000ul)
 Set to overrule default RFM95 SPI speed.
 
#define MY_RFM95_TX_POWER_DBM   (13u)
 Set TX power level, default 13dBm (overridden if ATC mode enabled) More...
 
#define MY_RFM95_ATC_TARGET_RSSI   (-70)
 Target RSSI level (in dBm) for RFM95 ATC mode.
 
#define MY_SOFT_SPI_SCK_PIN   (14)
 Soft SPI SCK pin.
 
#define MY_SOFT_SPI_MISO_PIN   (16)
 Soft SPI MISO pin.
 
#define MY_SOFT_SPI_MOSI_PIN   (15)
 Soft SPI MOSI pin.
 
#define MY_RAM_ROUTING_TABLE_FEATURE
 If enabled, the routing table is kept in RAM (if memory allows) and saved in regular intervals. More...
 
#define MY_ROUTING_TABLE_SAVE_INTERVAL_MS   (30*60*1000ul)
 Interval to dump content of routing table to EEPROM.
 
#define MY_NODE_ID   (AUTO)
 Node id defaults to AUTO (tries to fetch id from controller).
 
#define MY_PARENT_NODE_ID   (AUTO)
 Node parent defaults to AUTO (tries to find a parent automatically).
 
#define MY_TRANSPORT_SANITY_CHECK_INTERVAL_MS   (15*60*1000ul)
 Interval (in ms) for transport sanity checks.
 
#define MY_TRANSPORT_DISCOVERY_INTERVAL_MS   (20*60*1000ul)
 This is a gateway-only feature: Interval (in ms) to issue network discovery checks.
 
#define MY_TRANSPORT_WAIT_READY_MS   (0)
 Timeout in ms until transport is ready during startup, set to 0 for no timeout.
 
#define MY_REGISTRATION_FEATURE
 If enabled, node has to register to GW/controller before being allowed to send sensor data. More...
 
#define MY_REGISTRATION_RETRIES   (3u)
 Number of registration retries if no reply received from GW/controller.
 
#define MY_REGISTRATION_DEFAULT   (true)
 Node registration default - this applies if no registration response is received from controller.
 
#define MY_CORE_COMPATIBILITY_CHECK
 If defined, library compatibility is checked during node registration. Incompatible libraries are unable to send sensor data.
 
#define MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS   (10*1000ul)
 Timeout (in ms) to re-establish link if node is send to sleep and transport is not ready.
 
#define MY_SMART_SLEEP_WAIT_DURATION_MS   (500ul)
 The wait period (in ms) before going to sleep when using smartSleep-functions. More...
 
#define MY_OTA_FLASH_SS   (8)
 Slave select pin for external flash used for OTA.
 
#define MY_OTA_FLASH_JDECID   (0x1F65)
 Flash JDECID used for OTA. Use (0x00) if unknown.
 
#define MY_GATEWAY_MAX_RECEIVE_LENGTH   (100u)
 Max buffersize needed for messages coming from controller.
 
#define MY_GATEWAY_MAX_SEND_LENGTH   (120u)
 Max buffer size when sending messages.
 
#define MY_GATEWAY_MAX_CLIENTS   (1u)
 Max number of parallel clients (sever mode).
 
#define MY_INCLUSION_MODE_BUTTON_PIN   (3)
 The default input pin used for the inclusion mode button.
 
#define MY_INCLUSION_MODE_DURATION   (60)
 Number of seconds inclusion mode should be enabled.
 
#define MY_INCLUSION_BUTTON_PRESSED   (LOW)
 The logical level indicating a pressed inclusion mode button. More...
 
#define MY_WIFI_BSSID   NULL
 BSSID of your WiFi network.
 
#define MY_HOSTNAME   "MYSENSORS_DEVICE"
 Hostname of your device.
 
#define MY_PORT   5003
 The Ethernet TCP/UDP port to open on controller or gateway.
 
#define MY_IP_RENEWAL_INTERVAL_MS   (60*1000ul)
 DHCP, default renewal setting in milliseconds.
 
#define MY_MAC_ADDRESS   0xDE,0xAD,0xBE,0xEF,0xFE,0xED
 Ethernet MAC address. More...
 
#define MY_DEFAULT_LED_BLINK_PERIOD   300
 Default LEDs blinking period in milliseconds.
 
#define MY_VERIFICATION_TIMEOUT_MS   (5*1000ul)
 Define a suitable timeout for a signature verification session. More...
 
#define MY_SIGNING_ATSHA204_PIN   (17)
 Atsha204a default pin setting. Set it to match the pin the device is attached to.
 
#define MY_SIGNING_SOFT_RANDOMSEED_PIN   (7)
 Pin used for random seed generation in soft signing. More...
 
#define MY_NODE_UNLOCK_PIN   (14)
 By grounding this pin during reset of a locked node, the node will unlock. More...
 
#define MY_NODE_LOCK_COUNTER_MAX   (5)
 Maximum accepted occurrences of suspected malicious activity in a node. More...
 
#define MY_ESP8266_SERIAL_MODE   SERIAL_FULL
 ESP8266 serial modes. More...
 
#define MY_LINUX_CONFIG_FILE   "/etc/mysensors.conf"
 Sets the filepath for the gateway config file. More...
 
#define MY_IS_GATEWAY
 true when configuration indicate a gateway device, More...
 
#define MY_NODE_TYPE
 "GW" for gateways, REPEATER" for repeaters, "NODE" for nodes, More...
 
#define DEBUG_OUTPUT(x, ...)
 debug NULL
 
#define ARDUINO_ARCH_SAMD
 Automatically set when building for SAMD targets.
 
#define ARDUINO_ARCH_NRF5
 Automatically set when building for nRF5 targets.
 
#define ARDUINO_ARCH_ESP8266
 Automatically set when building for ESP8266 targets.
 
#define ARDUINO_ARCH_ESP32
 Automatically set when building for ESP32 targets.
 
#define ARDUINO_ARCH_AVR
 Automatically set when building for AVR targets.
 
#define ARDUINO_ARCH_STM32F1
 Automatically set when building for STM32F1 targets.
 
#define TEENSYDUINO
 Automatically set when building for Teensy targets.
 
#define MY_LINUX_SERIAL_PORT
 Serial device port.
 
#define MY_LINUX_SERIAL_IS_PTY
 Set serial as a pseudo terminal. More...
 
#define MY_LINUX_SERIAL_GROUPNAME
 Grant access to the specified system group for the serial device.
 
#define MY_LINUX_SERIAL_PTY
 deprecated option
 
#define MY_LINUX_IS_SERIAL_PTY
 deprecated option
 
#define MY_INCLUSION_MODE_FEATURE
 Define this to enable the inclusion mode feature.
 
#define MY_INCLUSION_BUTTON_FEATURE
 Enables inclusion-mode button feature on the gateway device. More...
 
#define MY_PARENT_NODE_IS_STATIC
 Define MY_PARENT_NODE_IS_STATIC to disable fall back if parent node fails.
 
#define MY_REGISTRATION_CONTROLLER
 If defined, node registration request has to be handled by controller.
 
#define MY_TRANSPORT_UPLINK_CHECK_DISABLED
 If defined, disables uplink check to GW during transport initialisation.
 
#define MY_TRANSPORT_SANITY_CHECK
 If defined, will cause node to check transport in regular intervals to detect HW issues and re-initialize in case of failure. More...
 
#define MY_NODE_LOCK_FEATURE
 Enable this to activate intrusion prevention mechanisms on the node.
 
#define MY_REPEATER_FEATURE
 Enables repeater functionality (relays messages from other nodes) More...
 
#define MY_PASSIVE_NODE
 If enabled, the node operates fully autonomously, i.e. messages are sent without ACKing. More...
 
#define MY_MQTT_CLIENT_PUBLISH_RETAIN
 Enables MQTT client to set the retain flag when publishing specific messages.
 
#define MY_MQTT_PASSWORD
 Used for authenticated MQTT connections. More...
 
#define MY_MQTT_USER
 Used for authenticated MQTT connections. More...
 
#define MY_MQTT_CLIENT_ID
 Set client ID for MQTT connections. More...
 
#define MY_MQTT_PUBLISH_TOPIC_PREFIX
 Set prefix for MQTT topic to publish to. More...
 
#define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX
 Set prefix for MQTT topic to subscribe to. More...
 
#define MY_SIGNAL_REPORT_ENABLED
 Enables signal report functionality. More...
 
#define MY_WITH_LEDS_BLINKING_INVERSE
 Define this to inverse the LED blinking. More...
 
#define MY_INDICATION_HANDLER
 Define to use own indication handler.
 
#define MY_DISABLE_REMOTE_RESET
 Disables over-the-air reset of node.
 
#define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
 If defined, routing table will not be kept in RAM. More...
 
#define MY_LOCK_DEVICE
 Enable read back protection. More...
 
#define MY_CORE_ONLY
 Define this if you want to use core functions without loading the framework.
 
#define MY_DEBUG_VERBOSE_GATEWAY
 Define this for verbose debug prints related to the gateway transport.
 
#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
 Define this to change the default state for MY_INCLUSION_BUTTON_PRESSED.
 
#define MY_INCLUSION_LED_PIN
 Enables an inclusion mode LED indicator on the gateway device. More...
 
#define MY_GATEWAY_W5100
 Define this for Ethernet GW based on the W5100 module.
 
#define MY_GATEWAY_ENC28J60
 Define this for Ethernet GW based on the ENC28J60 module.
 
#define MY_GATEWAY_ESP8266
 Define this for Ethernet GW based on the ESP8266.
 
#define MY_GATEWAY_ESP32
 Define this for Ethernet GW based on the ESP32.
 
#define MY_WIFI_SSID
 SSID of your WiFi network.
 
#define MY_WIFI_BSSID
 BSSID of your WiFi network.
 
#define MY_WIFI_PASSWORD
 Password of your WiFi network.
 
#define MY_HOSTNAME
 Hostname of your device.
 
#define MY_GATEWAY_LINUX
 Define this for Ethernet GW based on Linux.
 
#define MY_GATEWAY_TINYGSM
 Define this for Ethernet GW based on GSM modems supported by TinyGSM library.
 
#define MY_GATEWAY_MQTT_CLIENT
 Define this for MQTT client GW.
 
#define MY_GATEWAY_SERIAL
 Define this for Serial GW.
 
#define MY_IP_ADDRESS
 Static ip address of gateway. If not defined, DHCP will be used. More...
 
#define MY_IP_GATEWAY_ADDRESS
 IP address of your broadband router/gateway, if not using DHCP. More...
 
#define MY_IP_SUBNET_ADDRESS
 Subnet address of your local network, if not using DHCP. More...
 
#define MY_USE_UDP
 Enables UDP mode for Ethernet gateway. More...
 
#define MY_CONTROLLER_IP_ADDRESS
 If this is defined, gateway will act as a client trying to contact controller on MY_PORT using this IP address. More...
 
#define MY_CONTROLLER_URL_ADDRESS
 If this is defined, gateway will act as a client (ethernet or MQTT) trying to contact controller on the given URL. More...
 
#define MY_GSM_APN
 APN from your cell carrier / mobile provider. Example: 4g.tele2.se.
 
#define MY_GSM_BAUDRATE
 Baudrate for your GSM modem. If left undefined, TinyGSM will try to auto detect the correct rate.
 
#define MY_GSM_PIN
 PIN code for your SIM card, if PIN lock is active.
 
#define MY_GSM_PSW
 If using a GSM modem, this is the password supplied by your cell carrier / mobile provider. If using ESP8266 as a WiFi modem, this is your WiFi network password.
 
#define MY_GSM_RX
 If defined, uses softSerial using defined pins (must also define MY_GSM_TX)
 
#define MY_GSM_SSID
 If using ESP8266 as WiFi modem, this is your network SSID.
 
#define MY_GSM_TX
 If defined, uses softSerial using defined pins (must also define MY_GSM_RX)
 
#define MY_GSM_USR
 Supplied by your cell carrier / mobile operator. If not required, leave undefined.
 
#define MY_DEFAULT_ERR_LED_PIN
 Define this with a value that correspond to your placement of the error indication LED. More...
 
#define MY_DEFAULT_TX_LED_PIN
 Define this with a value that correspond to your placement of the TX indication LED. More...
 
#define MY_DEFAULT_RX_LED_PIN
 Define this with a value that correspond to your placement of the RX indication LED. More...
 
#define MY_SECURITY_SIMPLE_PASSWD
 Enables SW backed signing functionality and encryption functionality in library and uses provided password as key. More...
 
#define MY_SIGNING_SIMPLE_PASSWD
 Enables SW backed signing functionality in library and uses provided password as key. More...
 
#define MY_ENCRYPTION_SIMPLE_PASSWD
 Enables encryption on all radio transports that supports it and uses provided password as key. More...
 
#define MY_SIGNING_ATSHA204
 Enables HW backed signing functionality in library.
 
#define MY_SIGNING_SOFT
 Enables SW backed signing functionality in library.
 
#define MY_SIGNING_REQUEST_SIGNATURES
 Enable this to inform gateway to sign all messages sent to this node. More...
 
#define MY_SIGNING_WEAK_SECURITY
 Enable this to permit downgrade of security preferences and relaxed gateway signing requirements. More...
 
#define MY_SIGNING_NODE_WHITELISTING
 Define to turn on whitelisting. More...
 
#define MY_DEBUG_VERBOSE_SIGNING
 Define this for verbose debug prints related to signing.
 
#define MY_SIGNING_FEATURE
 Helper flag to indicate that some signing feature is enabled, set automatically.
 
#define MY_ENCRYPTION_FEATURE
 Helper flag to indicate that some encryption feature is enabled, set automatically. More...
 
#define MY_DEBUG_VERBOSE_OTA_UPDATE
 Define this for verbose debug prints related to FOTA updates.
 
#define MY_OTA_USE_I2C_EEPROM
 Define this if you want I2C EEPROM instead of a SPI flash. Used EEPROM needs to be large enough, an 24(L)C256 will do as minimum. HW I2C assumed. This will exclude the SPI flash code. Note that you also need an updated DualOptiboot supporting I2C EEPROM!
 
#define MY_RS485
 Define this to use the RS485 wired transport for sensor network communication.
 
#define MY_RS485_DE_PIN
 RS485 driver enable pin.
 
#define MY_RS485_DE_INVERSE
 Define this if RS485 driver enable pin polarity is inverted (low-active).
 
#define MY_RS485_HWSERIAL
 Define this if RS485 is connected to a hardware serial port. More...
 
#define MY_RADIO_RF24
 Define this to use a RF24-based radio transport for sensor network communication.
 
#define MY_RADIO_NRF24
 Define this to use a RF24-based radio transport for sensor network communication. More...
 
#define MY_DEBUG_VERBOSE_RF24
 Define this for verbose debug prints related to the RF24 driver.
 
#define MY_RF24_POWER_PIN
 Define this to use the RF24 power pin (optional).
 
#define MY_RF24_IRQ_PIN
 Define this to use the IRQ pin of the RF24 module (optional).
 
#define MY_RF24_ENABLE_ENCRYPTION
 Define this to enable software based AES encryption. More...
 
#define MY_RX_MESSAGE_BUFFER_FEATURE
 This enables the receiving buffer feature. More...
 
#define MY_RX_MESSAGE_BUFFER_SIZE
 Define this to change the incoming message buffer size from the default. More...
 
#define MY_RADIO_NRF5_ESB
 Define this to use nRF5 based radios for sensor network communication. More...
 
#define MY_NRF5_ESB_ENABLE_ENCRYPTION
 Define this to enable software based (RF24 compatible) AES encryption. More...
 
#define MY_DEBUG_VERBOSE_NRF5_ESB
 Define this for verbose debug prints related to the nRF5 driver.
 
#define MY_NRF5_ESB_REVERSE_ACK_RX
 Switch to SI24R1 or faked nRF24L01+ compatible ACK mode. ACK bit is reversed on RX side.
 
#define MY_NRF5_ESB_REVERSE_ACK_TX
 Switch to SI24R1 or faked nRF24L01+ compatible ACK mode. ACK bit is reversed on TX side.
 
#define MY_RADIO_RFM69
 Define this to use RFM69 based radios for sensor network communication.
 
#define MY_IS_RFM69HW
 Define this if you are using the RFM69HW model.
 
#define MY_RFM69_NEW_DRIVER
 Define this to enable the improved RFM69 driver. More...
 
#define MY_RFM69_POWER_PIN
 Define this to use the RFM69 power pin (optional).
 
#define MY_RFM69_MODEM_CONFIGURATION
 RFM69 modem configuration, default is RFM69_FSK_BR55_5_FD50 More...
 
#define MY_RFM69_ENABLE_ENCRYPTION
 Define this to enable AES encryption in the RFM69 module. More...
 
#define MY_RFM69_ATC_MODE_DISABLED
 Define to disable ATC mode of RFM69 driver.
 
#define MY_RFM69_MAX_POWER_LEVEL_DBM
 Set max TX power in dBm if local legislation requires this. More...
 
#define MY_RFM69_RST_PIN
 Define this to use the RFM69 reset pin (optional).
 
#define MY_DEBUG_VERBOSE_RFM69
 Define this for verbose debug prints related to the RFM69 driver.
 
#define MY_DEBUG_VERBOSE_RFM69_REGISTERS
 Define this for verbose dumping of the RFM69 registers.
 
#define MY_RADIO_RFM95
 Define this to use RFM95 based radios for sensor network communication.
 
#define MY_DEBUG_VERBOSE_RFM95
 Define this for verbose debug prints related to the RFM95 driver.
 
#define MY_RFM95_ENABLE_ENCRYPTION
 Define this to enable software based AES encryption. More...
 
#define MY_RFM95_ATC_MODE_DISABLED
 Define to disable ATC mode of RFM95 driver.
 
#define MY_RFM95_RST_PIN
 Define this to use the RFM95 reset pin (optional).
 
#define MY_RFM95_MODEM_CONFIGRUATION
 RFM95 modem configuration. More...
 
#define MY_RFM95_POWER_PIN
 Define this to use the RFM95 power pin (optional).
 
#define MY_RFM95_TCXO
 Enable to force your radio to use an external frequency source (e.g. TCXO, if present). More...
 
#define MY_RFM95_MAX_POWER_LEVEL_DBM
 Set max TX power in dBm if local legislation requires this. More...
 
#define MY_SOFTSPI
 Define this to use a software based SPI driver which allows more freedom in pin selection for the (supported) radio module.
 
#define MY_BAUD_RATE   (115200ul)
 Serial output baud rate (debug prints and serial gateway speed). More...
 
#define MY_SERIAL_OUTPUT_SIZE   (120u)
 Maximum characters for serial output. More...
 
#define MY_DEBUG
 Define MY_DEBUG to show debug prints. More...
 
#define MY_DEBUGDEVICE
 Define MY_DEBUGDEVICE to redirect debug prints. More...
 
#define MY_DEBUG_OTA
 Define MY_DEBUG_OTA to (nodeID) to redirect debug prints to given node ID. More...
 
#define MY_DEBUG_OTA_DISABLE_ECHO
 Define MY_DEBUG_OTA_DISABLE_ECHO to send messages without requesting the destination to echo the message. More...
 
#define MY_SPECIAL_DEBUG
 Define MY_SPECIAL_DEBUG to enable support for I_DEBUG messages. More...
 
#define MY_DISABLED_SERIAL
 Define MY_DISABLED_SERIAL if you want to use the UART TX/RX pins as normal I/O pins. More...
 
#define MY_SPLASH_SCREEN_DISABLED
 If defined, will disable the MySensors splash screen. More...
 
#define MY_OTA_LOG_RECEIVER_FEATURE
 Define this to enable printing of OTA logs. More...
 
#define MY_OTA_LOG_SENDER_FEATURE
 Define this to enable printing of OTA logs. More...