MySensors Library & Examples  2.3.2
Macros
+ Collaboration diagram for Gateway:

Detailed Description

These options control gateway specific configurations.

Macros

#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_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_INCLUSION_LED_PIN
 Enables an inclusion mode LED indicator on the gateway device. More...
 
#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_EXTERNAL_PULLUP
 Define this to change the default state for MY_INCLUSION_BUTTON_PRESSED.
 
#define MY_INCLUSION_BUTTON_PRESSED   (LOW)
 The logical level indicating a pressed inclusion mode button. 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_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_DEBUG_VERBOSE_GATEWAY
 Define this for verbose debug prints related to the gateway transport.
 
#define MY_WIFI_SSID
 SSID of your WiFi network.
 
#define MY_WIFI_BSSID   NULL
 BSSID 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   "MYSENSORS_DEVICE"
 Hostname of your device.
 
#define MY_HOSTNAME
 Hostname of your device.
 
#define MY_PORT   5003
 The Ethernet TCP/UDP port to open on controller or gateway.
 
#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_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_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_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...
 

Macro Definition Documentation

◆ MY_CONTROLLER_IP_ADDRESS

#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.

Example:

#define MY_CONTROLLER_IP_ADDRESS 192,168,178,254

If left un-defined, gateway acts as server allowing incoming connections.

See also
MY_CONTROLLER_URL_ADDRESS

Definition at line 2294 of file MyConfig.h.

◆ MY_CONTROLLER_URL_ADDRESS

#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.

If left un-defined, gateway acts as server allowing incoming connections. Example:

#define MY_CONTROLLER_URL_ADDRESS "test.mosquitto.org"
See also
MY_CONTROLLER_IP_ADDRESS
MY_GATEWAY_MQTT_CLIENT

Definition at line 2295 of file MyConfig.h.

◆ MY_INCLUSION_BUTTON_FEATURE

#define MY_INCLUSION_BUTTON_FEATURE

Enables inclusion-mode button feature on the gateway device.

With this defined, you can put the GW in inclusion mode by pressing a button attached to the GW.

Definition at line 2247 of file MyConfig.h.

◆ MY_INCLUSION_BUTTON_PRESSED

#define MY_INCLUSION_BUTTON_PRESSED   (LOW)

The logical level indicating a pressed inclusion mode button.

If MY_INCLUSION_BUTTON_EXTERNAL_PULLUP is defined, this defaults to HIGH.

Definition at line 1353 of file MyConfig.h.

◆ MY_INCLUSION_LED_PIN

#define MY_INCLUSION_LED_PIN

Enables an inclusion mode LED indicator on the gateway device.

With this defined, inclusion mode status (on or off) is indicated by the LED. This feature obeys MY_WITH_LEDS_BLINKING_INVERSE

Definition at line 2277 of file MyConfig.h.

◆ MY_IP_ADDRESS

#define MY_IP_ADDRESS

Static ip address of gateway. If not defined, DHCP will be used.

Example:

#define MY_IP_ADDRESS 192,168,178,66

Definition at line 2290 of file MyConfig.h.

◆ MY_IP_GATEWAY_ADDRESS

#define MY_IP_GATEWAY_ADDRESS

IP address of your broadband router/gateway, if not using DHCP.

Example:

#define MY_IP_GATEWAY_ADDRESS 192,168,1,1

Definition at line 2291 of file MyConfig.h.

◆ MY_IP_SUBNET_ADDRESS

#define MY_IP_SUBNET_ADDRESS

Subnet address of your local network, if not using DHCP.

Example:

#define MY_IP_SUBNET_ADDRESS 255,255,255,0

Definition at line 2292 of file MyConfig.h.

◆ MY_MAC_ADDRESS

#define MY_MAC_ADDRESS   0xDE,0xAD,0xBE,0xEF,0xFE,0xED

Ethernet MAC address.

Note
This needs to be unique on the network.

Definition at line 1533 of file MyConfig.h.

◆ MY_MQTT_CLIENT_ID

#define MY_MQTT_CLIENT_ID

Set client ID for MQTT connections.

This define is mandatory for all MQTT client gateways. Example:

#define MY_MQTT_CLIENT_ID "mysensors-1"

Definition at line 2262 of file MyConfig.h.

◆ MY_MQTT_PASSWORD

#define MY_MQTT_PASSWORD

Used for authenticated MQTT connections.

Set if your MQTT broker requires username/password. Example:

#define MY_MQTT_PASSWORD "secretpassword"
See also
MY_MQTT_USER

Definition at line 2260 of file MyConfig.h.

◆ MY_MQTT_PUBLISH_TOPIC_PREFIX

#define MY_MQTT_PUBLISH_TOPIC_PREFIX

Set prefix for MQTT topic to publish to.

This define is mandatory for all MQTT client gateways. Example:

#define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"

Definition at line 2263 of file MyConfig.h.

◆ MY_MQTT_SUBSCRIBE_TOPIC_PREFIX

#define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX

Set prefix for MQTT topic to subscribe to.

This define is mandatory for all MQTT client gateways. Example:

#define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"

Definition at line 2264 of file MyConfig.h.

◆ MY_MQTT_USER

#define MY_MQTT_USER

Used for authenticated MQTT connections.

Set if your MQTT broker requires username/password. Example:

#define MY_MQTT_USER "username"
See also
MY_MQTT_PASSWORD

Definition at line 2261 of file MyConfig.h.

◆ MY_USE_UDP

#define MY_USE_UDP

Enables UDP mode for Ethernet gateway.

Note
This is not supported on ENC28J60 and Linux based GWs.

Definition at line 2293 of file MyConfig.h.