diff --git a/lora_sender.h b/lora_sender.h deleted file mode 100644 index 1e08382..0000000 --- a/lora_sender.h +++ /dev/null @@ -1,58 +0,0 @@ -#include "esphome.h" -#include "TinyLoRa.h" -#include "SPI.h" - -using namespace esphome; - -class lora_sender : public PollingComponent, public text_sensor::TextSensor { - public: - // constructor - lora_sender() : PollingComponent(15000) {} - - // Network Session Key (MSB) - uint8_t NwkSkey[16] = { 0x31, 0x36, 0x41, 0x2E, 0xFE, 0x06, 0x84, 0x0B, 0x70, 0xB6, 0xCE, 0xBF, 0xBC, 0xAB, 0x06, 0x79 }; - - // Application Session Key (MSB) - uint8_t AppSkey[16] = { 0x93, 0x42, 0xD6, 0x50, 0xE4, 0xDE, 0x36, 0x11, 0x4E, 0x28, 0xEC, 0x31, 0xF5, 0x3A, 0xD7, 0x10 }; - - // Device Address (MSB) - uint8_t DevAddr[4] = { 0x26, 0x01, 0x17, 0xE0 }; - // Data Packet to Send to TTN - //unsigned char loraData[11] = {"hello LoRa"}; - char loraData[11]; - - // How many times data transfer should occur, in seconds - const unsigned int sendInterval = 30; - - // Pinout for Adafruit Feather 32u4 LoRa - // TinyLoRa lora = TinyLoRa(irq, cs, rst); - TinyLoRa lora = TinyLoRa(18, 14, 26); - - void setup() override { - //Serial.begin(115200); - Serial.begin(9600); - Serial.println("LoRa Sender"); - //LoRa.setPins(18, 14, 26); - lora.setChannel(MULTI); - // set datarate - lora.setDatarate(SF7BW125); - if (!lora.begin()) { - Serial.println("Starting LoRa failed!"); - while (1); - delay(1000); - } - Serial.println("Sending data packet..."); - } - - void update() override { - // This will be called every "update_interval" milliseconds. - // Publish state - publish_state("Hello World"); - Serial.println("Sending LoRa Data..."); - strcpy(loraData,"Hello Lora"); - lora.sendData((unsigned char *)loraData, sizeof(loraData), lora.frameCounter); - Serial.print("Frame Counter: ");Serial.println(lora.frameCounter); - lora.frameCounter++; - } -}; - diff --git a/test.yaml b/test.yaml deleted file mode 100644 index a073b58..0000000 --- a/test.yaml +++ /dev/null @@ -1,50 +0,0 @@ -esphome: - name: test - friendly_name: test - -esp32: - board: esp32dev - framework: - type: arduino - -# Enable logging -logger: - -# Enable Home Assistant API -api: - encryption: - key: "C/WOiMXnADdqmMWMOSt3TjE2OfvLKgykU6Jkem4CJXg=" - -ota: - password: "71d15cd28c99fe71164f7f606c391123" - -wifi: - ssid: !secret wifi_ssid - password: !secret wifi_password - - # Enable fallback hotspot (captive portal) in case wifi connection fails - ap: - ssid: "Test Fallback Hotspot" - password: "9UVFXZ8ufySW" - -captive_portal: - - -sensor: - - platform: bmi160 - address: 0x68 - update_interval: 60s - acceleration_x: - name: "BMI160 Accel X" - acceleration_y: - name: "BMI160 Accel Y" - acceleration_z: - name: "BMI160 Accel z" - gyroscope_x: - name: "BMI160 Gyro X" - gyroscope_y: - name: "BMI160 Gyro Y" - gyroscope_z: - name: "BMI160 Gyro z" - temperature: - name: "BMI160 Temperature" \ No newline at end of file