Smart-Home am Beispiel der Präsenzerkennung im Raum Projektarbeit Lennart Heimbs, Johannes Krug, Sebastian Dohle und Kevin Holzschuh bei Prof. Oliver Hofmann SS2019
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.

GatewayESP32MQTTClient.ino 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 <henrik.ekblad@mysensors.org>
  9. * Copyright (C) 2013-2018 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. // Enable debug prints to serial monitor
  31. #define MY_DEBUG
  32. // Enables and select radio type (if attached)
  33. #define MY_RADIO_RF24
  34. //#define MY_RADIO_RFM69
  35. //#define MY_RADIO_RFM95
  36. #define MY_GATEWAY_MQTT_CLIENT
  37. #define MY_GATEWAY_ESP32
  38. // Set this node's subscribe and publish topic prefix
  39. #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
  40. #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
  41. // Set MQTT client id
  42. #define MY_MQTT_CLIENT_ID "mysensors-1"
  43. // Enable these if your MQTT broker requires usenrame/password
  44. //#define MY_MQTT_USER "username"
  45. //#define MY_MQTT_PASSWORD "password"
  46. // Set WIFI SSID and password
  47. #define MY_WIFI_SSID "MySSID"
  48. #define MY_WIFI_PASSWORD "MyVerySecretPassword"
  49. // Set the hostname for the WiFi Client. This is the hostname
  50. // it will pass to the DHCP server if not static.
  51. #define MY_HOSTNAME "ESP32_MQTT_GW"
  52. // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
  53. //#define MY_IP_ADDRESS 192,168,178,87
  54. // If using static ip you can define Gateway and Subnet address as well
  55. //#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
  56. //#define MY_IP_SUBNET_ADDRESS 255,255,255,0
  57. // MQTT broker ip address.
  58. #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 5
  59. // The MQTT broker port to to open
  60. #define MY_PORT 1883
  61. #include <MySensors.h>
  62. void setup()
  63. {
  64. // Setup locally attached sensors
  65. }
  66. void presentation()
  67. {
  68. // Present locally attached sensors here
  69. }
  70. void loop()
  71. {
  72. // Send locally attech sensors data here
  73. }