thebradleysanders / ESPHome-Arduino-Port-Expander

An Arduino Port Expander for ESPHome with added Arduino Mega 2560 support
14 stars 10 forks source link

Adding a text sensor option (Dev workflow) #3

Closed drewgreenwell closed 2 years ago

drewgreenwell commented 2 years ago

Hey thanks for this update, it is great. I got My Mega 2560 up and running quickly. I have a few sensors like temperature that the data is pre formatted and some arbitrary data that I'd like to send. I started to add in an ape_text_sensor option but I'm using VS code and cant seem to get the include paths setup to not throw a bunch of false errors on things like "using namespace esphome". I cloned the esphome repo and set an include path to the root of the repo recursively but that's not been working for me. What's your dev setup like to work on this? Is there a way I can contribute or customize for my own purpose that I can get some proper intellisense?

drewgreenwell commented 2 years ago

I got this working by pointing my includesFolders to the esphome repo root, then adding this to the top of arduino_port_expander.h. It doesnt seem to be required for the esp build but it gets rid of all of the false errors and gives me proper intellisense

#include "esphome/core/component.h"
#include "esphome/core/application.h"
#include "esphome/components/i2c/i2c.h"

using namespace i2c;