-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👕 Make all files LF instead of CRLF/mixed
- Loading branch information
1 parent
cdfb1e7
commit 26dafb8
Showing
14 changed files
with
297 additions
and
297 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/config.json | ||
/config.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
language: python | ||
python: | ||
- "2.7" | ||
|
||
env: | ||
- PLATFORMIO_CI_SRC=examples/CustomSettings | ||
- PLATFORMIO_CI_SRC=examples/DoorSensor | ||
- PLATFORMIO_CI_SRC=examples/HookToEvents | ||
- PLATFORMIO_CI_SRC=examples/IteadSonoff | ||
- PLATFORMIO_CI_SRC=examples/LightOnOff | ||
- PLATFORMIO_CI_SRC=examples/TemperatureSensor | ||
- PLATFORMIO_CI_SRC=examples/LedStrip | ||
- PLATFORMIO_CI_SRC=examples/Broadcast | ||
- PLATFORMIO_CI_SRC=examples/GlobalInputHandler | ||
- CPPLINT=true | ||
|
||
install: | ||
- pip install -U platformio | ||
- pip install cpplint | ||
# install current build as a library with all dependencies | ||
- platformio lib -g install file://. | ||
|
||
script: | ||
- if [[ "$CPPLINT" ]]; then make cpplint; else platformio ci --board=esp01 --board=nodemcuv2; fi | ||
language: python | ||
python: | ||
- "2.7" | ||
|
||
env: | ||
- PLATFORMIO_CI_SRC=examples/CustomSettings | ||
- PLATFORMIO_CI_SRC=examples/DoorSensor | ||
- PLATFORMIO_CI_SRC=examples/HookToEvents | ||
- PLATFORMIO_CI_SRC=examples/IteadSonoff | ||
- PLATFORMIO_CI_SRC=examples/LightOnOff | ||
- PLATFORMIO_CI_SRC=examples/TemperatureSensor | ||
- PLATFORMIO_CI_SRC=examples/LedStrip | ||
- PLATFORMIO_CI_SRC=examples/Broadcast | ||
- PLATFORMIO_CI_SRC=examples/GlobalInputHandler | ||
- CPPLINT=true | ||
|
||
install: | ||
- pip install -U platformio | ||
- pip install cpplint | ||
# install current build as a library with all dependencies | ||
- platformio lib -g install file://. | ||
|
||
script: | ||
- if [[ "$CPPLINT" ]]; then make cpplint; else platformio ci --board=esp01 --board=nodemcuv2; fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
cpplint: | ||
cpplint --repository=. --recursive --filter=-whitespace/line_length,-legal/copyright,-runtime/printf,-build/include,-build/namespace,-runtime/int ./src | ||
.PHONY: cpplint | ||
cpplint: | ||
cpplint --repository=. --recursive --filter=-whitespace/line_length,-legal/copyright,-runtime/printf,-build/include,-build/namespace,-runtime/int ./src | ||
.PHONY: cpplint |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"name": "Kitchen light", | ||
"wifi": { | ||
"ssid": "Network_1", | ||
"password": "I'm a Wi-Fi password!" | ||
}, | ||
"mqtt": { | ||
"host": "192.168.1.20", | ||
"port": 1883 | ||
}, | ||
"ota": { | ||
"enabled": false | ||
} | ||
} | ||
{ | ||
"name": "Kitchen light", | ||
"wifi": { | ||
"ssid": "Network_1", | ||
"password": "I'm a Wi-Fi password!" | ||
}, | ||
"mqtt": { | ||
"host": "192.168.1.20", | ||
"port": 1883 | ||
}, | ||
"ota": { | ||
"enabled": false | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
#include <Homie.h> | ||
|
||
bool broadcastHandler(const String& level, const String& value) { | ||
#include <Homie.h> | ||
|
||
bool broadcastHandler(const String& level, const String& value) { | ||
Homie.getLogger() << "Received broadcast level " << level << ": " << value << endl; | ||
return true; | ||
} | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
Serial << endl << endl; | ||
Homie_setFirmware("broadcast-test", "1.0.0"); | ||
Homie.setBroadcastHandler(broadcastHandler); | ||
|
||
Homie.setup(); | ||
} | ||
|
||
void loop() { | ||
Homie.loop(); | ||
} | ||
return true; | ||
} | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
Serial << endl << endl; | ||
Homie_setFirmware("broadcast-test", "1.0.0"); | ||
Homie.setBroadcastHandler(broadcastHandler); | ||
|
||
Homie.setup(); | ||
} | ||
|
||
void loop() { | ||
Homie.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
#include <Homie.h> | ||
|
||
const int DEFAULT_TEMPERATURE_INTERVAL = 300; | ||
|
||
unsigned long lastTemperatureSent = 0; | ||
|
||
HomieNode temperatureNode("temperature", "temperature"); | ||
|
||
#include <Homie.h> | ||
|
||
const int DEFAULT_TEMPERATURE_INTERVAL = 300; | ||
|
||
unsigned long lastTemperatureSent = 0; | ||
|
||
HomieNode temperatureNode("temperature", "temperature"); | ||
|
||
HomieSetting<long> temperatureIntervalSetting("temperatureInterval", "The temperature interval in seconds"); | ||
|
||
void setupHandler() { | ||
temperatureNode.setProperty("unit").send("c"); | ||
} | ||
|
||
void loopHandler() { | ||
if (millis() - lastTemperatureSent >= temperatureIntervalSetting.get() * 1000UL || lastTemperatureSent == 0) { | ||
float temperature = 22; // Fake temperature here, for the example | ||
|
||
void setupHandler() { | ||
temperatureNode.setProperty("unit").send("c"); | ||
} | ||
|
||
void loopHandler() { | ||
if (millis() - lastTemperatureSent >= temperatureIntervalSetting.get() * 1000UL || lastTemperatureSent == 0) { | ||
float temperature = 22; // Fake temperature here, for the example | ||
Homie.getLogger() << "Temperature: " << temperature << " °C" << endl; | ||
temperatureNode.setProperty("degrees").send(String(temperature)); | ||
lastTemperatureSent = millis(); | ||
} | ||
} | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
Serial << endl << endl; | ||
Homie_setFirmware("temperature-setting", "1.0.0"); | ||
Homie.setSetupFunction(setupHandler).setLoopFunction(loopHandler); | ||
|
||
temperatureNode.advertise("unit"); | ||
temperatureNode.advertise("degrees"); | ||
|
||
temperatureNode.setProperty("degrees").send(String(temperature)); | ||
lastTemperatureSent = millis(); | ||
} | ||
} | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
Serial << endl << endl; | ||
Homie_setFirmware("temperature-setting", "1.0.0"); | ||
Homie.setSetupFunction(setupHandler).setLoopFunction(loopHandler); | ||
|
||
temperatureNode.advertise("unit"); | ||
temperatureNode.advertise("degrees"); | ||
|
||
temperatureIntervalSetting.setDefaultValue(DEFAULT_TEMPERATURE_INTERVAL).setValidator([] (long candidate) { | ||
return candidate > 0; | ||
}); | ||
|
||
Homie.setup(); | ||
} | ||
|
||
void loop() { | ||
Homie.loop(); | ||
} | ||
|
||
Homie.setup(); | ||
} | ||
|
||
void loop() { | ||
Homie.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
#include <Homie.h> | ||
|
||
HomieNode lightNode("light", "switch"); | ||
|
||
bool globalInputHandler(const HomieNode& node, const String& property, const HomieRange& range, const String& value) { | ||
#include <Homie.h> | ||
|
||
HomieNode lightNode("light", "switch"); | ||
|
||
bool globalInputHandler(const HomieNode& node, const String& property, const HomieRange& range, const String& value) { | ||
Homie.getLogger() << "Received on node " << node.getId() << ": " << property << " = " << value << endl; | ||
return true; | ||
} | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
Serial << endl << endl; | ||
Homie_setFirmware("global-input-handler", "1.0.0"); | ||
Homie.setGlobalInputHandler(globalInputHandler); | ||
|
||
lightNode.advertise("on").settable(); | ||
|
||
Homie.setup(); | ||
} | ||
|
||
void loop() { | ||
Homie.loop(); | ||
} | ||
return true; | ||
} | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
Serial << endl << endl; | ||
Homie_setFirmware("global-input-handler", "1.0.0"); | ||
Homie.setGlobalInputHandler(globalInputHandler); | ||
|
||
lightNode.advertise("on").settable(); | ||
|
||
Homie.setup(); | ||
} | ||
|
||
void loop() { | ||
Homie.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
#include <Homie.h> | ||
|
||
const unsigned char NUMBER_OF_LED = 4; | ||
const unsigned char LED_PINS[NUMBER_OF_LED] = { 16, 5, 4, 0 }; | ||
|
||
HomieNode stripNode("strip", "strip"); | ||
|
||
bool stripLedHandler(const HomieRange& range, const String& value) { | ||
if (!range.isRange) return false; // if it's not a range | ||
|
||
if (range.index < 1 || range.index > NUMBER_OF_LED) return false; // if it's not a valid range | ||
|
||
if (value != "on" && value != "off") return false; // if the value is not valid | ||
|
||
bool on = (value == "on"); | ||
|
||
digitalWrite(LED_PINS[range.index - 1], on ? HIGH : LOW); | ||
stripNode.setProperty("led").setRange(range).send(value); // Update the state of the led | ||
#include <Homie.h> | ||
|
||
const unsigned char NUMBER_OF_LED = 4; | ||
const unsigned char LED_PINS[NUMBER_OF_LED] = { 16, 5, 4, 0 }; | ||
|
||
HomieNode stripNode("strip", "strip"); | ||
|
||
bool stripLedHandler(const HomieRange& range, const String& value) { | ||
if (!range.isRange) return false; // if it's not a range | ||
|
||
if (range.index < 1 || range.index > NUMBER_OF_LED) return false; // if it's not a valid range | ||
|
||
if (value != "on" && value != "off") return false; // if the value is not valid | ||
|
||
bool on = (value == "on"); | ||
|
||
digitalWrite(LED_PINS[range.index - 1], on ? HIGH : LOW); | ||
stripNode.setProperty("led").setRange(range).send(value); // Update the state of the led | ||
Homie.getLogger() << "Led " << range.index << " is " << value << endl; | ||
|
||
return true; | ||
} | ||
|
||
void setup() { | ||
for (int i = 0; i < NUMBER_OF_LED; i++) { | ||
pinMode(LED_PINS[i], OUTPUT); | ||
digitalWrite(LED_PINS[i], LOW); | ||
} | ||
|
||
Serial.begin(115200); | ||
Serial << endl << endl; | ||
|
||
Homie_setFirmware("awesome-ledstrip", "1.0.0"); | ||
|
||
stripNode.advertiseRange("led", 1, NUMBER_OF_LED).settable(stripLedHandler); | ||
|
||
Homie.setup(); | ||
} | ||
|
||
void loop() { | ||
Homie.loop(); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
void setup() { | ||
for (int i = 0; i < NUMBER_OF_LED; i++) { | ||
pinMode(LED_PINS[i], OUTPUT); | ||
digitalWrite(LED_PINS[i], LOW); | ||
} | ||
|
||
Serial.begin(115200); | ||
Serial << endl << endl; | ||
|
||
Homie_setFirmware("awesome-ledstrip", "1.0.0"); | ||
|
||
stripNode.advertiseRange("led", 1, NUMBER_OF_LED).settable(stripLedHandler); | ||
|
||
Homie.setup(); | ||
} | ||
|
||
void loop() { | ||
Homie.loop(); | ||
} |
Oops, something went wrong.