Created
June 10, 2021 13:23
-
-
Save jasonblewis/b0a7a09c89d97bb4145bafaad233ac8e to your computer and use it in GitHub Desktop.
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
// Auto generated code by esphome | |
// ========== AUTO GENERATED INCLUDE BLOCK BEGIN =========== | |
#include "esphome.h" | |
using namespace esphome; | |
using namespace binary_sensor; | |
using namespace light; | |
logger::Logger *logger_logger; | |
using namespace sensor; | |
using namespace i2c; | |
i2c::I2CComponent *bus_a; | |
using namespace i2c; | |
i2c::I2CComponent *bus_b; | |
gpio::GPIOBinarySensor *gpio_gpiobinarysensor; | |
monochromatic::MonochromaticLightOutput *monochromatic_monochromaticlightoutput; | |
light::LightState *led1; | |
using namespace output; | |
esp32_ble_beacon::ESP32BLEBeacon *esp32_ble_beacon_esp32blebeacon; | |
axp192::AXP192Component *axp192_axp192component; | |
bmp280::BMP280Component *bmp280_bmp280component; | |
sht3xd::SHT3XDComponent *sht3xd_sht3xdcomponent; | |
binary_sensor::ReleaseTrigger *binary_sensor_releasetrigger; | |
Automation<> *automation; | |
ledc::LEDCOutput *builtin_led; | |
light::ToggleAction<> *light_toggleaction; | |
sensor::Sensor *m5stick_batterylevel; | |
sensor::Sensor *sensor_sensor; | |
sensor::Sensor *sensor_sensor_3; | |
sensor::Sensor *sensor_sensor_2; | |
sensor::Sensor *sensor_sensor_4; | |
// ========== AUTO GENERATED INCLUDE BLOCK END ===========" | |
void setup() { | |
// ===== DO NOT EDIT ANYTHING BELOW THIS LINE ===== | |
// ========== AUTO GENERATED CODE BEGIN =========== | |
// esphome: | |
// name: m5stickc | |
// platform: ESP32 | |
// board: m5stick-c | |
// includes: [] | |
// platformio_options: | |
// upload_speed: '1500000' | |
// arduino_version: platformio/[email protected] | |
// build_path: m5stickc | |
// libraries: [] | |
// name_add_mac_suffix: false | |
App.pre_setup("m5stickc", __DATE__ ", " __TIME__, false); | |
// binary_sensor: | |
// light: | |
// logger: | |
// level: VERY_VERBOSE | |
// id: logger_logger | |
// baud_rate: 115200 | |
// tx_buffer_size: 512 | |
// hardware_uart: UART0 | |
// logs: {} | |
logger_logger = new logger::Logger(115200, 512, logger::UART_SELECTION_UART0); | |
logger_logger->pre_setup(); | |
App.register_component(logger_logger); | |
// sensor: | |
// i2c: | |
// id: bus_a | |
// sda: 32 | |
// scl: 33 | |
// frequency: 100000.0 | |
// scan: true | |
bus_a = new i2c::I2CComponent(); | |
App.register_component(bus_a); | |
// i2c: | |
// id: bus_b | |
// sda: 21 | |
// scl: 22 | |
// scan: true | |
// frequency: 400000.0 | |
bus_b = new i2c::I2CComponent(); | |
App.register_component(bus_b); | |
// binary_sensor.gpio: | |
// platform: gpio | |
// pin: | |
// number: 37 | |
// inverted: true | |
// mode: INPUT | |
// name: ${upper_devicename} Button A | |
// on_release: | |
// - then: | |
// - light.toggle: | |
// id: led1 | |
// type_id: light_toggleaction | |
// automation_id: automation | |
// trigger_id: binary_sensor_releasetrigger | |
// id: gpio_gpiobinarysensor | |
gpio_gpiobinarysensor = new gpio::GPIOBinarySensor(); | |
App.register_component(gpio_gpiobinarysensor); | |
// light.monochromatic: | |
// platform: monochromatic | |
// output: builtin_led | |
// name: ${upper_devicename} Led | |
// id: led1 | |
// restore_mode: RESTORE_DEFAULT_OFF | |
// gamma_correct: 2.8 | |
// default_transition_length: 1s | |
// output_id: monochromatic_monochromaticlightoutput | |
monochromatic_monochromaticlightoutput = new monochromatic::MonochromaticLightOutput(); | |
led1 = new light::LightState("${upper_devicename} Led", monochromatic_monochromaticlightoutput); | |
App.register_light(led1); | |
App.register_component(led1); | |
// output: | |
// output.ledc: | |
// platform: ledc | |
// pin: | |
// number: 10 | |
// mode: OUTPUT | |
// inverted: false | |
// inverted: true | |
// id: builtin_led | |
// frequency: 1000.0 | |
// esp32_ble_beacon: | |
// type: IBEACON | |
// uuid: 75febca7-0081-4201-b1f1-4a84d05d9f43 | |
// id: esp32_ble_beacon_esp32blebeacon | |
// major: 10167 | |
// minor: 61958 | |
esp32_ble_beacon_esp32blebeacon = new esp32_ble_beacon::ESP32BLEBeacon({0x75, 0xfe, 0xbc, 0xa7, 0x00, 0x81, 0x42, 0x01, 0xb1, 0xf1, 0x4a, 0x84, 0xd0, 0x5d, 0x9f, 0x43}); | |
App.register_component(esp32_ble_beacon_esp32blebeacon); | |
// sensor.axp192: | |
// platform: axp192 | |
// setup_priority: 1000.0 | |
// address: 0x34 | |
// i2c_id: bus_b | |
// update_interval: 30s | |
// battery_level: | |
// name: M5Stick Battery Level | |
// id: m5stick_batterylevel | |
// force_update: false | |
// unit_of_measurement: '%' | |
// icon: mdi:battery | |
// accuracy_decimals: 1 | |
// id: axp192_axp192component | |
// brightness: 1.0 | |
axp192_axp192component = new axp192::AXP192Component(); | |
axp192_axp192component->set_setup_priority(1000.0f); | |
axp192_axp192component->set_update_interval(30000); | |
App.register_component(axp192_axp192component); | |
// sensor.bmp280: | |
// platform: bmp280 | |
// setup_priority: -200.0 | |
// i2c_id: bus_a | |
// address: 0x76 | |
// update_interval: 10s | |
// temperature: | |
// name: BMP280 Temperature | |
// oversampling: 16X | |
// id: sensor_sensor | |
// force_update: false | |
// unit_of_measurement: °C | |
// accuracy_decimals: 1 | |
// device_class: temperature | |
// pressure: | |
// name: Pressure | |
// id: sensor_sensor_2 | |
// force_update: false | |
// unit_of_measurement: hPa | |
// accuracy_decimals: 1 | |
// device_class: pressure | |
// oversampling: 16X | |
// id: bmp280_bmp280component | |
// iir_filter: 'OFF' | |
bmp280_bmp280component = new bmp280::BMP280Component(); | |
bmp280_bmp280component->set_setup_priority(-200.0f); | |
bmp280_bmp280component->set_update_interval(10000); | |
App.register_component(bmp280_bmp280component); | |
// sensor.sht3xd: | |
// platform: sht3xd | |
// i2c_id: bus_a | |
// address: 0x44 | |
// update_interval: 10s | |
// temperature: | |
// name: SHT3xD Temperature | |
// id: sensor_sensor_3 | |
// force_update: false | |
// unit_of_measurement: °C | |
// accuracy_decimals: 1 | |
// device_class: temperature | |
// humidity: | |
// name: Living Room Humidity | |
// id: sensor_sensor_4 | |
// force_update: false | |
// unit_of_measurement: '%' | |
// accuracy_decimals: 1 | |
// device_class: humidity | |
// id: sht3xd_sht3xdcomponent | |
sht3xd_sht3xdcomponent = new sht3xd::SHT3XDComponent(); | |
sht3xd_sht3xdcomponent->set_update_interval(10000); | |
App.register_component(sht3xd_sht3xdcomponent); | |
bus_a->set_sda_pin(32); | |
bus_a->set_scl_pin(33); | |
bus_a->set_frequency(100000); | |
bus_a->set_scan(true); | |
bus_b->set_sda_pin(21); | |
bus_b->set_scl_pin(22); | |
bus_b->set_frequency(400000); | |
bus_b->set_scan(true); | |
App.register_binary_sensor(gpio_gpiobinarysensor); | |
gpio_gpiobinarysensor->set_name("${upper_devicename} Button A"); | |
binary_sensor_releasetrigger = new binary_sensor::ReleaseTrigger(gpio_gpiobinarysensor); | |
automation = new Automation<>(binary_sensor_releasetrigger); | |
led1->set_restore_mode(light::LIGHT_RESTORE_DEFAULT_OFF); | |
led1->set_default_transition_length(1000); | |
led1->set_gamma_correct(2.8f); | |
builtin_led = new ledc::LEDCOutput(new GPIOPin(10, OUTPUT, false)); | |
App.register_component(builtin_led); | |
esp32_ble_beacon_esp32blebeacon->set_major(10167); | |
esp32_ble_beacon_esp32blebeacon->set_minor(61958); | |
led1->add_effects({}); | |
builtin_led->set_inverted(true); | |
light_toggleaction = new light::ToggleAction<>(led1); | |
axp192_axp192component->set_i2c_parent(bus_b); | |
axp192_axp192component->set_i2c_address(0x34); | |
bmp280_bmp280component->set_i2c_parent(bus_a); | |
bmp280_bmp280component->set_i2c_address(0x76); | |
sht3xd_sht3xdcomponent->set_i2c_parent(bus_a); | |
sht3xd_sht3xdcomponent->set_i2c_address(0x44); | |
builtin_led->set_frequency(1000.0f); | |
m5stick_batterylevel = new sensor::Sensor(); | |
App.register_sensor(m5stick_batterylevel); | |
m5stick_batterylevel->set_name("M5Stick Battery Level"); | |
m5stick_batterylevel->set_unit_of_measurement("%"); | |
m5stick_batterylevel->set_icon("mdi:battery"); | |
m5stick_batterylevel->set_accuracy_decimals(1); | |
m5stick_batterylevel->set_force_update(false); | |
sensor_sensor = new sensor::Sensor(); | |
App.register_sensor(sensor_sensor); | |
sensor_sensor->set_name("BMP280 Temperature"); | |
sensor_sensor->set_device_class("temperature"); | |
sensor_sensor->set_unit_of_measurement("\302\260C"); | |
sensor_sensor->set_accuracy_decimals(1); | |
sensor_sensor->set_force_update(false); | |
sensor_sensor_3 = new sensor::Sensor(); | |
App.register_sensor(sensor_sensor_3); | |
sensor_sensor_3->set_name("SHT3xD Temperature"); | |
sensor_sensor_3->set_device_class("temperature"); | |
sensor_sensor_3->set_unit_of_measurement("\302\260C"); | |
sensor_sensor_3->set_accuracy_decimals(1); | |
sensor_sensor_3->set_force_update(false); | |
monochromatic_monochromaticlightoutput->set_output(builtin_led); | |
automation->add_actions({light_toggleaction}); | |
axp192_axp192component->set_batterylevel_sensor(m5stick_batterylevel); | |
axp192_axp192component->set_brightness(1.0f); | |
bmp280_bmp280component->set_temperature_sensor(sensor_sensor); | |
bmp280_bmp280component->set_temperature_oversampling(bmp280::BMP280_OVERSAMPLING_16X); | |
sensor_sensor_2 = new sensor::Sensor(); | |
App.register_sensor(sensor_sensor_2); | |
sensor_sensor_2->set_name("Pressure"); | |
sensor_sensor_2->set_device_class("pressure"); | |
sensor_sensor_2->set_unit_of_measurement("hPa"); | |
sensor_sensor_2->set_accuracy_decimals(1); | |
sensor_sensor_2->set_force_update(false); | |
sht3xd_sht3xdcomponent->set_temperature_sensor(sensor_sensor_3); | |
sensor_sensor_4 = new sensor::Sensor(); | |
App.register_sensor(sensor_sensor_4); | |
sensor_sensor_4->set_name("Living Room Humidity"); | |
sensor_sensor_4->set_device_class("humidity"); | |
sensor_sensor_4->set_unit_of_measurement("%"); | |
sensor_sensor_4->set_accuracy_decimals(1); | |
sensor_sensor_4->set_force_update(false); | |
bmp280_bmp280component->set_pressure_sensor(sensor_sensor_2); | |
bmp280_bmp280component->set_pressure_oversampling(bmp280::BMP280_OVERSAMPLING_16X); | |
sht3xd_sht3xdcomponent->set_humidity_sensor(sensor_sensor_4); | |
gpio_gpiobinarysensor->set_pin(new GPIOPin(37, INPUT, true)); | |
// =========== AUTO GENERATED CODE END ============ | |
// ========= YOU CAN EDIT AFTER THIS LINE ========= | |
App.setup(); | |
} | |
void loop() { | |
App.loop(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment