forked from davidecavestro/ESPHomeRoombaComponent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revised instructions; example project
- Loading branch information
Showing
5 changed files
with
122 additions
and
106 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.vscode | ||
example/roomba/.pio* | ||
example/roomba/.esphomelib_version |
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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
esphomeyaml: | ||
use_custom_code: True | ||
name: roomba | ||
platform: ESP8266 | ||
board: esp01_1m | ||
|
||
wifi: | ||
ssid: "My Wifi SSID" | ||
password: "My Wifi Password" | ||
|
||
mqtt: | ||
broker: "mosquitto.org" | ||
discovery: true | ||
|
||
logger: | ||
level: info | ||
|
||
ota: |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
; Auto generated code by esphomeyaml | ||
|
||
[common] | ||
lib_deps = | ||
ESPHomeLibRoombaComponent=https://github.com/mannkind/ESPHomeLibRoombaComponent | ||
Roomba=http://www.airspayce.com/mikem/arduino/Roomba/Roomba-1.4.zip | ||
build_flags = | ||
upload_flags = | ||
|
||
; ===== DO NOT EDIT ANYTHING BELOW THIS LINE ===== | ||
; ========== AUTO GENERATED CODE BEGIN =========== | ||
[env:roomba] | ||
platform = espressif8266@>=1.8.0 | ||
board = esp01_1m | ||
framework = arduino | ||
lib_deps = | ||
ArduinoOTA | ||
ESP8266WiFi | ||
ESP8266mDNS | ||
Hash | ||
https://github.com/OttoWinter/esphomelib.git#v1.9.1 | ||
${common.lib_deps} | ||
build_flags = | ||
-DESPHOMELIB_LOG_LEVEL=ESPHOMELIB_LOG_LEVEL_INFO | ||
-DUSE_NEW_OTA | ||
${common.build_flags} | ||
upload_speed = 115200 | ||
; =========== AUTO GENERATED CODE END ============ | ||
; ========= YOU CAN EDIT AFTER THIS LINE ========= |
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Auto generated code by esphomeyaml | ||
#include "esphomelib/application.h" | ||
#include "ESPHomeLibRoombaComponent.h" | ||
|
||
using namespace esphomelib; | ||
|
||
void setup() { | ||
// ===== DO NOT EDIT ANYTHING BELOW THIS LINE ===== | ||
// ========== AUTO GENERATED CODE BEGIN =========== | ||
App.set_name("roomba"); | ||
App.set_compilation_datetime(__DATE__ ", " __TIME__); | ||
::LogComponent *_logcomponent = App.init_log(115200); | ||
_logcomponent->set_global_log_level(ESPHOMELIB_LOG_LEVEL_INFO); | ||
::WiFiComponent *_wificomponent = App.init_wifi(); | ||
_wificomponent->set_sta(::WiFiAp{ | ||
.ssid = "My Wifi SSID", | ||
.password = "My Wifi Password", | ||
.channel = -1, | ||
}); | ||
::OTAComponent *_otacomponent = App.init_ota(); | ||
_otacomponent->start_safe_mode(); | ||
mqtt::MQTTClientComponent *mqtt_mqttclientcomponent = App.init_mqtt("mosquitto.org", 1883, "", ""); | ||
// =========== AUTO GENERATED CODE END ============ | ||
// ========= YOU CAN EDIT AFTER THIS LINE ========= | ||
|
||
auto *custom_roomba = new RoombaComponent( | ||
"Distance", | ||
"Voltage", | ||
"Current", | ||
"Charge", | ||
"Capacity", | ||
"Charging", | ||
"Docked", | ||
"Cleaning", | ||
"On", | ||
"Off", | ||
"Dock", | ||
"Locate", | ||
"Spot Clean", | ||
"Roomba/command", /* command_topic */ | ||
4, /* BRC Pin */ | ||
5000 /* Update Interval */ | ||
); | ||
|
||
App.register_component(custom_roomba); | ||
App.register_sensor(custom_roomba->distance_sensor); | ||
App.register_sensor(custom_roomba->voltage_sensor); | ||
App.register_sensor(custom_roomba->current_sensor); | ||
App.register_sensor(custom_roomba->charge_sensor); | ||
App.register_sensor(custom_roomba->capacity_sensor); | ||
App.register_binary_sensor(custom_roomba->chargingState_sensor); | ||
App.register_binary_sensor(custom_roomba->dockedState_sensor); | ||
App.register_binary_sensor(custom_roomba->cleaningState_sensor); | ||
App.register_switch(custom_roomba->on_switch); | ||
App.register_switch(custom_roomba->off_switch); | ||
App.register_switch(custom_roomba->dock_switch); | ||
App.register_switch(custom_roomba->locate_switch); | ||
App.register_switch(custom_roomba->spot_switch); | ||
|
||
App.setup(); | ||
} | ||
|
||
void loop() { | ||
App.loop(); | ||
delay(16); | ||
} |