MySensors Library & Examples  2.3.2-62-ge298769
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_ESP8266_SECURE
 Define this for Ethernet GW based on the ESP8266 with TLS.
 
#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. Only supported on ESP8266 and ESP32.
 
#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_MQTT_CA_CERT1
 Up to three root Certificates Authorities could be defined to validate the mqtt server' certificate. The most secure. More...
 
#define MY_MQTT_CA_CERT2
 Up to three root Certificates Authorities could be defined to validate the mqtt serv.
 
#define MY_MQTT_CA_CERT3
 Up to three root Certificates Authorities could be defined to validate the mqtt serv.
 
#define MY_MQTT_FINGERPRINT
 Server certificate validation with its fingerprint. More...
 
#define MY_MQTT_CLIENT_CERT
 Set a client certificate to send to a MQTT server that requests one over TLS connection. More...
 
#define MY_MQTT_CLIENT_KEY
 Set the client private key generated with the MY_MQTT_CLIENT_CERT. 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_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 2697 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 2698 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 2644 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 1642 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 2681 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 2693 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 2694 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 2695 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 1923 of file MyConfig.h.

◆ MY_MQTT_CA_CERT1

#define MY_MQTT_CA_CERT1

Up to three root Certificates Authorities could be defined to validate the mqtt server' certificate. The most secure.

This define is mandatory when you need connect MQTT over SSL/TLS. Certificate Authorities. The best method to validate server certificates. Advised to retrieve root Certificate Authorities as they expire less often than server certificates. With let's encrypt you may need up to three Certificate Authorities

Example:

const char cert_isrgrootx1_Authority[] PROGMEM = R"EOF(
----- BEGIN THE CERTIFICATE -----
XXX ... XXX
----- FINISH CERTIFICATE -----
)EOF";
const char cert_isrgrootx2_Authority[] PROGMEM = R"EOF(
----- BEGIN THE CERTIFICATE -----
XXX ... XXX
----- FINISH CERTIFICATE -----
)EOF";
const char cert_letsEncryptR3_Authority[] PROGMEM = R"EOF(
----- BEGIN THE CERTIFICATE -----
XXX ... XXX
----- FINISH CERTIFICATE -----
)EOF";
#define MY_MQTT_CA_CERT1 cert_isrgrootx1_Authority
#define MY_MQTT_CA_CERT2 cert_isrgrootx2_Authority
#define MY_MQTT_CA_CERT3 cert_letsEncryptR3_Authority

Definition at line 2662 of file MyConfig.h.

◆ MY_MQTT_CLIENT_CERT

#define MY_MQTT_CLIENT_CERT

Set a client certificate to send to a MQTT server that requests one over TLS connection.

This define is mandatory when you need connect MQTT over SSL/TLS and client certificate is requested. Example:

const char mqtt_client_cert[] PROGMEM = R"EOF(
----- BEGIN THE CERTIFICATE -----
XXX ... XXX
----- FINISH CERTIFICATE -----
)EOF";
#define MY_MQTT_CLIENT_CERT mqtt_client_cert

Definition at line 2666 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 2659 of file MyConfig.h.

◆ MY_MQTT_CLIENT_KEY

#define MY_MQTT_CLIENT_KEY

Set the client private key generated with the MY_MQTT_CLIENT_CERT.

This define is mandatory when you need connect MQTT over SSL/TLS and client certificate is requested. Example:

const char mqtt_client_key[] PROGMEM = R"EOF(
----- START THE RSA PRIVATE KEY -----
XXX ... XXX
----- FINISH THE RSA PRIVATE KEY -----
)EOF";
#define MY_MQTT_CLIENT_KEY mqtt_client_key

Definition at line 2667 of file MyConfig.h.

◆ MY_MQTT_FINGERPRINT

#define MY_MQTT_FINGERPRINT

Server certificate validation with its fingerprint.

The finger print to validate the mqtt server certificate. This is less secure and less convenient than using certificate authorities. Command (3 lines...) to obtain the certificate finger print:

$>openssl s_client -connect <hostname>:<host port> < /dev/null 2>/dev/null | \
openssl x509 -fingerprint -noout -in /dev/stdin \
awk -F= '{print $2}'

Example:

const char mqtt_fingerprint [] PROGMEM = "CA:CE:2B:MD:D3:32:A3:F1:8C:73:9E:1B:B7:D5:75:4A:10:61:E4:05";

Definition at line 2665 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 2657 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 2660 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 2661 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 2658 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 2696 of file MyConfig.h.