MySensors Library & Examples
2.3.2
examples
GatewayESP32
GatewayESP32.ino
1
/*
2
* The MySensors Arduino library handles the wireless radio link and protocol
3
* between your home built sensors/actuators and HA controller of choice.
4
* The sensors forms a self healing radio network with optional repeaters. Each
5
* repeater and gateway builds a routing tables in EEPROM which keeps track of the
6
* network topology allowing messages to be routed to nodes.
7
*
8
* Created by Henrik Ekblad <
[email protected]
>
9
* Copyright (C) 2013-2019 Sensnology AB
10
* Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
11
*
12
* Documentation: http://www.mysensors.org
13
* Support Forum: http://forum.mysensors.org
14
*
15
* This program is free software; you can redistribute it and/or
16
* modify it under the terms of the GNU General Public License
17
* version 2 as published by the Free Software Foundation.
18
*
19
*******************************
20
*
21
* REVISION HISTORY
22
* Version 1.0 - tekka
23
*
24
* DESCRIPTION
25
* The ESP32 gateway sends data received from sensors to the WiFi link.
26
* The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
27
*
28
* Make sure to fill in your ssid and WiFi password below.
29
*/
30
31
// Enable debug prints to serial monitor
32
#define MY_DEBUG
33
34
// Enables and select radio type (if attached)
35
#define MY_RADIO_RF24
36
//#define MY_RADIO_RFM69
37
//#define MY_RADIO_RFM95
38
39
#define MY_GATEWAY_ESP32
40
41
#define MY_WIFI_SSID "MySSID"
42
#define MY_WIFI_PASSWORD "MyVerySecretPassword"
43
44
// Enable UDP communication
45
//#define MY_USE_UDP // If using UDP you need to set MY_CONTROLLER_IP_ADDRESS or MY_CONTROLLER_URL_ADDRESS below
46
47
// Set the hostname for the WiFi Client. This is the hostname
48
// passed to the DHCP server if not static.
49
#define MY_HOSTNAME "ESP32_GW"
50
51
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
52
//#define MY_IP_ADDRESS 192,168,1,100
53
54
// If using static ip you can define Gateway and Subnet address as well
55
//#define MY_IP_GATEWAY_ADDRESS 192,168,1,1
56
//#define MY_IP_SUBNET_ADDRESS 255,255,255,0
57
58
// The port to keep open on node server mode
59
#define MY_PORT 5003
60
61
// How many clients should be able to connect to this gateway (default 1)
62
#define MY_GATEWAY_MAX_CLIENTS 2
63
64
// Controller ip address. Enables client mode (default is "server" mode).
65
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
66
//#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
67
//#define MY_CONTROLLER_URL_ADDRESS "my.controller.org"
68
69
#include <
MySensors.h
>
70
71
void
setup
()
72
{
73
// Setup locally attached sensors
74
}
75
76
void
presentation
()
77
{
78
// Present locally attached sensors here
79
}
80
81
void
loop
()
82
{
83
// Send locally attached sensors data here
84
}
loop
void loop()
Main loop.
Definition:
GatewayESP32.ino:81
presentation
void presentation()
Node presentation.
Definition:
GatewayESP32.ino:76
setup
void setup()
Called after node initialises but before main loop.
Definition:
GatewayESP32.ino:71
MySensors.h
API declaration for MySensors.
Copyright (C) 2013-2019 Sensnology AB. Generated by
doxygen
1.8.17