Created
October 20, 2017 18:09
-
-
Save SijmenHuizenga/1ed33db34c4c1e80c3ede600b6f1c01a to your computer and use it in GitHub Desktop.
Files for the MySensors network in my home
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MY_MQTT_USER "" | |
#define MY_MQTT_PASSWORD "" | |
#define MY_CONTROLLER_URL_ADDRESS "" | |
#define MY_PORT 1234 | |
#define MY_DEBUG | |
#define MY_RADIO_NRF24 | |
#define MY_GATEWAY_MQTT_CLIENT | |
#define MY_MQTT_PUBLISH_TOPIC_PREFIX "shome-out" | |
#define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "shome-in" | |
#define MY_MQTT_CLIENT_ID "shome-gateway" | |
#define MY_SOFTSPI | |
#define MY_SOFT_SPI_SCK_PIN 14 | |
#define MY_SOFT_SPI_MISO_PIN 16 | |
#define MY_SOFT_SPI_MOSI_PIN 15 | |
#define MY_RF24_CE_PIN 5 | |
#define MY_RF24_CS_PIN 6 | |
#include <Ethernet.h> | |
#include <MySensors.h> | |
void setup(){} | |
void presentation(){} | |
void loop(){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MY_DEBUG | |
#define MY_RADIO_NRF24 | |
#define MY_REPEATER_FEATURE | |
#include <MySensors.h> | |
#define RELAYPIN 7 | |
#define RELAY_ON 1 | |
#define RELAY_OFF 0 | |
void before(){ | |
pinMode(RELAYPIN, OUTPUT); | |
} | |
void setup(){} | |
void loop(){} | |
void presentation(){ | |
sendSketchInfo("Relay", "1.0"); | |
present(RELAYPIN, S_BINARY); | |
} | |
void receive(const MyMessage &message){ | |
if (message.type == V_STATUS) { | |
digitalWrite(RELAYPIN, message.getBool() ? RELAY_ON : RELAY_OFF); | |
Serial.print("Incoming change for sensor:"); | |
Serial.print(message.sensor); | |
Serial.print(", New status: "); | |
Serial.println(message.getBool()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment