to access cpp src from haos, do this: - open terminal (don't have it? have it...) - go inside the esphome container: docker exec -it $(docker ps --filter "name=esphome" --format "{{.Names}}") bash - go in /data/build/your_device_name/src pin this if you want
@AndreasSpiessАй бұрын
Cool! It works! Thank you. Pinned.
@oscargr_Ай бұрын
Classic, classic Spiess video. Breaking down how things work, followed by examples and then a clear conclusion. 👍🏼💁🏻♂️
@AndreasSpiessАй бұрын
Thank you for your kind words!
@oscargr_Ай бұрын
@AndreasSpiess So well deserved. You put so much work into those videos.
@MrCWoodhouseАй бұрын
@andreasspiess thank you for all your great work!
@ei23deАй бұрын
00:00 Arduino IDE vs. ESPHome: Introduction 01:05 Understanding the Fundamentals: C++ vs. YAML 03:08 Basics of YAML for ESPHome: Key-Value Pairs & Objects 06:10 First ESPHome Project: Wi-Fi Connectivity and Basic Setup 07:50 Building a Sensor with ESPHome: BME280 Example 09:33 Adding Outputs and Switches: Controlling LEDs 10:48 Examining the Generated Arduino Code: PlatformIO Project 12:10 Integrating an OLED Display: Lambda Functions in YAML 14:08 Implementing Logic with Automations: Button and Switch Control 15:56 Using Scripts in ESPHome: Reusable Functionality 18:19 Verdict: ESPHome vs. Arduino IDE - Pros and Cons 21:03 Future Use Cases and Conclusion These chapters were created entirely locally on my Debian machine using open-source software (Whisper, Ollama, Qwen2.5:14b). @Andreas Spiess - Use the chapters in your video description if you want, no need for credits.
@markxexar9386Ай бұрын
Great overview of ESPhome concepts - this would have saved me so much time when getting started. A few other tips that I learnt the hard way, and wish I took this path from the beginning: 1) Compiling ESPhome is so slow on something like a RPi for Home Assistant. It is far better to do the compiling and flashing from a high performance desktop (running ESPhome as a container). The devices can still be discovered by Home Assistant. 2) Keep all your secrets (passwords and IP addresses) in the secrets yaml file. This simplifiles your boilerplate code for each project. 3) Use name substitutions at the top of your file, which means the main yaml body is more generic and can easily be shared with others, or duplicated across similar projects and devices.
@AndreasSpiessАй бұрын
Thank you for your additions. I agree with all of them. Frequent users know that one of the reasons I moved to X86 and Proxmox was the slow speed of ESPhome compilation on the Raspberry 4. With my second-hand miniPC the speed is ok...
@xwhyzzwhyАй бұрын
A fantastic guide and a huge time saver. I might never have gone in this direction, but I probably will now. We definitely will need a way to get the data out to complete the job and enable so many other great projects. Thanks again!
@AndreasSpiessАй бұрын
Good that I motivated you to try it!
@dougle03Ай бұрын
MQTT is supported. Also, you can write your own components if the existing ones don't quite do what you want... Plenty of Open Source components to clone and modify for your needs.
@ws_stelzi79Ай бұрын
One thing with YAML is to understand the difference between declarative (= describing the end result and the system figures everything out) and imperative (= do this then do something else, ...) coding. Most coding was always done imperative and declarative is a fairly new thing.
@AndreasSpiessАй бұрын
I agree. Plus, ESPhome is a mixture of both...
@deivissergio2378Ай бұрын
YAML is not a programming language, but a configuration file (like JSON), by the way is quite similar to JSON but uses less data... 😊👍👍👍
@michaels3003Ай бұрын
Yes Sir.
@michaels3003Ай бұрын
"Human-readable data-serialization language."
@AndreasSpiessАй бұрын
You are right!
@mikejones-vd3fgАй бұрын
@@michaels3003 lol human readable, key value pairs? ... thats machine readable, if i have to memorize these high level abstractions of what they mean when they say "home:something" i might as well learn the code that manipulates the registers that set these functions instead, maybe not as "easy" to read but you have to understand what they mean just the same as any readable word anyway so i dont see the effeciencey gains here, infact you just have to memorize a layer of bloat and lose the undersatnding of what youre actually doing with these high level abstractions and now youre stuck when something goes wrong or want to add a feature. Im all for abstracting messy code awway, but it should be code you wrote, or at leaste copied. I have 250 lines of code that uses no libraries except a font.h file written in arduino IDE stm32c6 (the low ram version) that sets up the BME sensor and calibrates it too your liking, weather (pun intended) you want to oversample temp/ humidity or preasure, or not which is critical for any power savings for a usable weaher station on batttery. Outputting to an oled display with a handsome font ,fittingon 32 kb or ram. I wonder how much ram this esp32 bloatware version cost us eh Andreas? ;) I kid, the register manipulation code is ugly, but kind of simple, and now you know where the data is and can interface it with whatever database you want. By the way i not a pro programmer, i just used chatgtps help to setup this sensor with minimal libraries and resources.
@jmrАй бұрын
I liked JSON immediately but YAML sucked at first.
@lemd49Ай бұрын
A well structured and educational video from Andreas, what a nice way to spend a few relaxing moments on Sunday afternoon 😊
@AndreasSpiessАй бұрын
Thank you for your kind words!
@r7boatguyАй бұрын
I kind of knew a lot of this, but had never really thought about it in a structured way. Thank you for making this video, it was really helpful and added to my knowledge! Merry Xmas to you and your family!
@AndreasSpiessАй бұрын
Merry Christmas, too!
@ReneKnuvers74rkАй бұрын
We are back at the first row!
@AndreasSpiessАй бұрын
Yes! Some viewers wished it...
@AndreasDelleskeАй бұрын
The first row had several thousand seats today!
@ei23deАй бұрын
There are various ways to write ESPHome sensors to a database such as InfluxDB, depending on what you want to do. - ESPHome + MQTT: ESPHome offers support for sending data to MQTT topics, so you can go the route completely without Home Assistant. The data could then be written to InfluxDB, for example, using your own program or Node-RED. - ESPHome + Home Assistant + Nodered: The Home Assistant add-on for Node-RED can capture specific sensor data and write it to the desired database using a database add-on such as InfluxDB. - Customize Home Assistant Recorder: There are ways to customize the recorder in Home Assistant so that certain values are written to the desired location, such as the Influx database. - Long-term sensor data in Home Assistant: If the data ends up in Home Assistant anyway, there is the option of writing long-term data to the Home Assistant database. It is not always necessary to use an Influx database for long-term data.
@AndreasSpiessАй бұрын
Thank you for your answer. Currently, I use Node-Red to post the data to influxDB (your 3rd proposal) and I once used influxDB for all HA data. After your comment, I looked again at this integration, and it seems you can now limit the sensor data written to influxDB. And maybe I could even have more than one bucket. That would solve my problem of having topic-specific buckets.
@ei23deАй бұрын
@AndreasSpiess Yes, it did so too. (Inspired by your videos) But unfortunately Influx1.8 is discontinued and migration to newer versions is complicated. So i switched to postgres as my main database, since there is a "postgres for everything" movement.
@AndreasSpiessАй бұрын
@@ei23de I am also not happy with the "behavior" of the organization behind influx. For the moment, I try to stick with it because I did not want the effort for migration. Mabe, one day it anyway has to be done...
@ei23deАй бұрын
@@AndreasSpiess Kind of this is what they mean when they say "there is no free lunch", right?
@osaetherАй бұрын
Very good video! I have been using ESPHome for a couple of years now but I still learned a lot from your video! Thanks!
@AndreasSpiessАй бұрын
Glad it was helpful!
@trentbrown3714Ай бұрын
I have been avoiding ESPhome but after watching this video I see using ESPhome for HA projects in my future - thanks Andreas!
@AndreasSpiessАй бұрын
Very good! Trying is a good concept. Then you still can decide not to use it.
@MrCWoodhouseАй бұрын
I love the way you can make almost any appliance or gadget smart with a quickly built esphome node. Just need a relay or a motor to actuate. So many integrated components. It is amazing !
@Grrr2048Ай бұрын
As always, a good and informative video full of relevant info
@AndreasSpiessАй бұрын
Thank you!
@LimBo3500Ай бұрын
Perfect timing, after just setting up my Home Assistant to monitor and control my home, and now adding modules to support my filament storage, and humidity control.
@AndreasSpiessАй бұрын
Indeed a perfect example for ESPhome.
@basgroАй бұрын
Very nice creating this overview, to the point and sufficient depth. Thank you!
@AndreasSpiessАй бұрын
Glad it was helpful!
@squelchstuffАй бұрын
I've been on the journey of learning ESPhome recently, and this video condenses much of what I've discovered. Thank you Andreas. A tip I learned recently concerning the use of LVGL and local displays, is to build a simulation environment using SDL2. It saves all of those flash writes whilst making small changes to layout and data formatting and can connect to live ESPhome. eg: I connect my sensors to ESPhome, and then fiddle with the display output on my PC simulation until I'm happy, and then flash the local display.
@AndreasSpiessАй бұрын
So far I did not use LVGL. So thank you for the tip!
@koeiekop1973Ай бұрын
Thank you again, even after experimenting and quite some frustrations on the YAML code I got things working. This video still learned me a lot! And happy to see you use chat gpt for help as well. This tool makes programming so much easier!
@AndreasSpiessАй бұрын
YAML is hard for many "conventional" programmers. I assume it is much easier for a guy not knowing how to program...
@graemebrowne1463Ай бұрын
That was fantastic, you clearly explained the problems I was having.
@AndreasSpiessАй бұрын
Thank you!
@asiwАй бұрын
Wow, wow, wow. So informative and useful. Its amazing what you do.
@AndreasSpiessАй бұрын
Thank you very much!
@SebaOPLАй бұрын
My daily driver for hobby projects is PlatformIO, but after seeing your video, I will give ESP-IDF with yaml a shot. Thanks for the new ideas!
@AndreasSpiessАй бұрын
For a quick project it is perfect! My last one: A wake-on-lan button in a different subnet with an ESP8266...
@anithasshenoy66624 күн бұрын
Thank you. Your video inspired me to take a look at ESPHome again.
@AndreasSpiess2 күн бұрын
A good decision!
@XavierGrАй бұрын
What a nice subject to cover after our discussion on your previous video about the lora mailbox notifier. Thank you for bringing attention to ESPhome.
@AndreasSpiessАй бұрын
My pleasure!
@rudieo3113Ай бұрын
To have direct control and read out without HomeAssistant use the included webserver this can have a output window for log too. web_server: port: 80
@AndreasSpiessАй бұрын
Thank you for the additional info.
@bgable7707Ай бұрын
Long over due clear explaination of YAML which I still loathe!!! Wish I had this 4 years ago. JSON is easier for me to read and understand due to the open/close separation of items. Seeing how list, ie, arrays, and automation, decision branches, are created helps a lot! As always, you're clear and concise, and great to see an fellow DECcie still "Kicking it"
@AndreasSpiessАй бұрын
Indeed, some fellow DECies still kick while others are already dead. So let's enjoy the rest ;-)
@jrioublancАй бұрын
Thanks for this introduction on YAML, you triggered my interest.
@AndreasSpiessАй бұрын
Glad it was helpful!
@catalinalb1722Ай бұрын
Exactly what I need a great clarification from the Master :) with the help of chatGPT I managed to setup a Victron UART reader for my solar system, Bedroom Air Qualtiy sensor running BME680 and MH Z17 CO2 sensor, and HX711 for weight scale. Thank you!
@AndreasSpiessАй бұрын
Cool projects! Indeed, ChatGPT became a regular "CoPilot" for me. Sometimes very helpful and in the worst case just a waste of a bit of time.
@sunhillman63Ай бұрын
Thanks Andreas for the video and for the good and helpful information - I will try it also and I guess your info will save a lot of experimental time on my side.
@AndreasSpiessАй бұрын
Enjoy!
@dougbas3980Ай бұрын
Yes, I run home-assistant with esp-home. It is good but I am not a trusting sort. YAML is me calling other peoples code. I started programming in assembly language where nothing executed beside what you wrote. If you have a problem, it is your code that is causing it. As I progressed to C, C++, Python, and now YAML, not much of what is executing is code I wrote. It is a paradigm shift and a lesson in trust. And now I ask Claude AI to help me code and more trust required. I am an old dog having some problems learning new tricks, but alas, I am adjusting🤔 For sure this speeds up my results orders of magnitude in time. I watch the esp-home compile and ponder all the code I did not have to write
@AndreasSpiessАй бұрын
I understand your point. Unfortunately, I do not trust myself because many of my programs contain errors;-) Also with Ardino IDE and ESP32 we run on other's code (libraries or Wi-Fi for example). Working in the industry with complex systems, my firm believe became that testing is the aproach, not understanding the code. Particularly not in programs with parallel execution. I always told people: "Assume that an untested system does not work". However, I wonder how this will be done with "AI automations" when the response on certain input can be different.
@dan-nutuАй бұрын
The whole "IoT" thing is layers upon layers of code written by God knows who/where/how. Testing can help with some assurance for functionality. Now think how much trust you can put in the security of these things. For me it felt similar to bungee jumping 😀
@dan-nutuАй бұрын
And I know you're going to say that you don't care who can see the temperature in your fridge Andreas :) The trouble is - you never know where people use the same devices/libraries/framework for something more important, and you find out when it's too late
@dougle03Ай бұрын
@@dan-nutu You can always review the component code that underpins the higher abstract layer ESPHome works on. The world runs on common libraries these days. With ESPHome, all of those are open source and thus available for inspection. Writing your own functions is entirely possible too.
@oscargr_Ай бұрын
@@AndreasSpiessDo they really run in parallel though? Isn't it just you declare your components in parallel, but the compiler still calls an update function on each of the components you declare in YAML. I didn't quite get the use of lambda functions and scripts in ESP-Home. (And their difference)
@ZiggeАй бұрын
Your video has expanded my understanding of ESPhome immensely as I am a noob in the HA world. If you feel comfortable with it, I would appreciate a video in which you expand on the methods for making sequential code in ESPhome. I see implementing this as bringing the best of both worlds together.
@AndreasSpiessАй бұрын
I showed the principle (with consecutive actions), so I do not plan such a video. And as I said, Ask ChatGPT. It can help a lot.
@FPol-if6bmАй бұрын
indeed, great thanks for this well explained guide. Even for using esphome for long time, you explained me the concept much better. That's what i really about your channel, the well explained concepts of various topcs.
@AndreasSpiessАй бұрын
Thank you for your kind words. giving a bit of structure to the things is one of the main goals of this channel.
@MikesTropicalTechАй бұрын
Another super useful video! I had heard of ESPhome but didn't know its capabilities. I have a project idea for a stepper motor control that will raise and lower my window blinds and the Home Assistant instant integration made it an easy choice! As you say I'll still use Arduino/PlatformIO for things like my circuit board that drives the gas gauge in my converted electric Porsche based on the state of charge of the battery pack.
@AndreasSpiessАй бұрын
Cool! You have an electric Porsche!
@andresaksalu5189Ай бұрын
I have waited for this video on this channel for about a year 🙂 - to me the Arduino IDE is already painful today if you do not need the millisecond response from the chip. Having different chips and screens around house and ESPhome makes it easy to implement new ideas. Mentioning the easy implementation and immediate feedback from “system” is also to me an important feature when comparing ESPhome with Arduino IDE
@AndreasSpiessАй бұрын
Indeed, the speed of implementation is a good thing. Yesterday, I needed a Wake on LAN button in a different subnet. An ESP8266 and a few lines of YAML...
@gedgicat2063Ай бұрын
A great video, that explains everything really really well. As a novice with esp32's in general you have massively increased my understanding. Especially thst red squiggly line don't always mean a syntax error in the code i've just pasted.. 😂.
@AndreasSpiessАй бұрын
Indeed, the best is really to hit "install"...
@WilliamVirkinАй бұрын
I really like you videos, thanks soooooo much for your content!!
@AndreasSpiessАй бұрын
My pleasure!
@MarcelHugueninАй бұрын
Thanks Andreas, this was another very interesting video. I like the way you setup your videos. If I have a home project to do, I will definitely check back and let them guide me.
@AndreasSpiessАй бұрын
Thank you for your feedback!
@eduardocenteno3769Ай бұрын
Another great video. EspHome is a very powerful tools.
@AndreasSpiessАй бұрын
Thank you!
@wjn777Ай бұрын
Great video, thank you for sharing. Definitely food for thought, I will try to use ESPHome more often. I've never seen a good example of running it standalone though, that is an interesting option
@AndreasSpiessАй бұрын
It should be easy: Omit api: and add for example MQTT for communication (if you need it).
@CamiloSperbergАй бұрын
Nice to see this video from a perspective of somebody who never quite got to play with arduino ide and only knows esphome. I know this is surely not helping but I ditched my grafana + influxdb stack due to the added complexity it brought + extra maintenance time it required. To be very honest I have enough data I need from Home Assistant itself. That being said, very good video! Learned some stuff as well which I had no idea about :)
@AndreasSpiessАй бұрын
Thank you for sharing your thoughts. Interesting to see that needs can be different. I interact much more with Grafana than with HA (things in HA are often automated).
@laurieinjapanАй бұрын
ESPhome is a fantastic project! I have to agree with you that the documentation, while detailed, misses explaining some key concepts. It often talks about "platforms" and it took me quite a long time to realize platforms are analogous to components.
@AndreasSpiessАй бұрын
I treat "platforms" as containing the code, and "components" as the object containing code and other definitions. This helps me to understand lists, for example.
@oscargr_Ай бұрын
So true, lots and lots of details, but not an overview of the basic concepts. (For a beginner to wrap his/her head around) This is the power of Andreas!!
@mkpearsАй бұрын
an EXCELLENT video ! ...I have been wondering how to learn programming ESPHome for HomeAssistant, and have looked at the ESPHome website, but it really does not have a structured learning path, just examples of code for each sensor, ESP proce, etc... I am an old fart that programmed in FORTRAN many years ago, and was looking for a more detailed learning source, like also the C++ programming texts... while your video is VERY helpful in understanding, I still would like to find a good learning source... cheers !!
@AndreasSpiessАй бұрын
The next step is trying a few projects with the help of ChatGPT (not Gemini)...
@mkpearsАй бұрын
@@AndreasSpiess will try that, Thanks !!
@BerndFelscheАй бұрын
Thanks for the primer.
@AndreasSpiessАй бұрын
You are welcome!
@JulianKnight-ITАй бұрын
You don't have to use ESPHome with Home Assistant, I use it directly with Node-RED And MQTT. Also, if using multiple devices, even of different types, one of the advantages of ESPHome is that you can split the YAML into components and then simply stich together the ones you want. So you get great reusability. ESPHome is the near enough the perfect balance between modularity and bespoke and I've used it now in preference to other ESP platforms for some years.
@AndreasSpiessАй бұрын
I agree that splitting YAML (also in HA) is a good idea. And I thought I had mentioned that ESPhome can be used stand-alone and integrated with MQTT.
@ezinatxАй бұрын
Like the others commenting here, I found this to be an excellent resource. The comments add value too. Andreas Spiess made my day and earned 10 Attaboys. 🤩
@AndreasSpiessАй бұрын
Indeed, in the comments of my videos usually is more content than in the video ;-)
@nzhillnetАй бұрын
Great video Andreas. I run InfluxDb and Grafana in Home Assistant OS, with sensor data being fed in etc. If this is of interest I'm more than happy to knowledge share etc. All the best from New Zealand.
@AndreasSpiessАй бұрын
Thank you! My question is very specific: How can I write the data of one sensor to one influxDB bucket and the data of another into a different bucket.
@mikejones-vd3fgАй бұрын
I was skeptical Andreas, with my recent forray into bare metal programming with stm32 I have an unhealthy obsession with having to know exactly what the bits are doing and why and even fondle them as they move along their path, and these high level markup languages dont give me that fix. But i need to stop twiddling the bits and make something useful and this shoulld help, especially the easy wifi setup and integration into a control app. Thanks for introducing us to this.
@AndreasSpiessАй бұрын
I am old, and therefore, time is valuable (it soon will run out). That is why I like such time-savers ;-)
@PhG1961Ай бұрын
Very informative and usefull!
@AndreasSpiessАй бұрын
Thank you!
@OldCurmudgeon3DPАй бұрын
Thanks for the video. Will an ESPHome device continue to run unaffected if it loses connection to HA? If not then that's another use case for the IDE (i.e. hvac, water heater). I've had my water heater on an ESP32 since '17 after I got tired of the mechanical system failing. I wrote code for an HVAC controller back then too but have yet to test it. My telescope mount is driven by IDE code as well. 🙂
@CamiloSperbergАй бұрын
Yeah all code runs locally. You won't be able to control it from ha for obvious reasons but all code that you write in esphome runs locally
@AndreasSpiessАй бұрын
If you omit the line "api:" you will have no HA connection. But you still have Wi-Fi or OTS, and can add MQTT
@g.s.3389Ай бұрын
great, i moved to esphome when i started to use homeassistant heavily, it is very easy to use and there iis nearly always someone that had your same problem and someone else helped to solve it.... :)
@AndreasSpiessАй бұрын
I agree. The community is already huge!
@Rainer_LandesАй бұрын
Thank you, Andreas! Perfect timing, and perfect "translation" from c++ concepts to yaml concepts ;-) One question though: What do I do, if my new sensor is not covered by the vast list of ESPhome sensors? It is connected by I2C and there exists working Arduino code for it. How do I turn this into a ESPhome device?
@AndreasSpiessАй бұрын
First, I would use a different sensor. And second, I probably would use C++. Third: Learn how to write an ESP32 component. Not impossible, but probably too much for just one sensor.
@Rainer_LandesАй бұрын
@@AndreasSpiess thank you for your comment!
@koenvanduffel2084Ай бұрын
Working with Home Assistant and ESPhome for like 2 years now i still don't find it easy to work with YAML. The whole concept in both is still misterious at times. Recapping those concepts well surely help, t thanks for that.
@AndreasSpiessАй бұрын
You are welcome!
@abboberg987Ай бұрын
This video is not for me (i use ESPHome for a few years now), still i learned some: coding and routines in ESPHome. I use the ESP's with ESPHome as a sensor-device, including buzzer, BME280 and RGB-led. But all the 'automations' are done in HomeAssistant. (Just as you stated in the end of the video). But if you don't have HA, an ESP with ESPHome can work on its own. How nice.
@AndreasSpiessАй бұрын
I share your concept of having the complexity inside HA. Still, some applications (particularly interactions) are probably better executed on the device itself (faster reaction, for example).
@LimBo3500Ай бұрын
I see devices as standalone that get parameters from HA. So it HA fails, the basic functionality still works. Eg thermostat. I'm the only "technerd" in the family and everything is setup so no basic (house) functionality is lost when I'm out of the country or otherwise occupied. I like this video because it gives me options to keep local logic without the need to go full Arduino. Thanks.
@dan-nutuАй бұрын
I sometimes need things to be taken care of even if the (Wi-Fi) connection to Home Assistant is temporarily not available, so for these cases I write the automations to run on the esp device running ESPHome (BTW Andreas, I think it would have been useful to drop a quick mention in the video that ESPHome works on both esp8266 and esp32 chips). Example: I have one esp8266 module that monitors the temperature sensors in my 19" rack and sets the PWM ratio for the cooling fans. I want the fans to work even if the connection to HA is temporarily down for whatever reason. So running the automations on the esp module allows me to do that, simply updating HA with the current values when the connection is reestablished.
@anthonvanderneutАй бұрын
4:19 The YAML specification states that the order of keys in a mapping is undefined (this corresponds e.g. to the behaviour of dict in Python 2), even though of course there is an ordering in the YAML document. That you can move around keys (and their values) in documents providing ESP32 specification is a logical result of that.
@AndreasSpiessАй бұрын
I agree with the definition. However, I never read it :-( Looking at the generated code helped me to understand it from the point of view of a "sequential" programmer...
@anthonvanderneutАй бұрын
@@AndreasSpiess Yes it is nice if you can get away with not reading the specs. I had to go over it multiple times for my Python library (ruamel.yaml) in which I wanted to be able keep the order of the keys (easier when you compare versions). And I still find things missed in the first few readings ...
@tullguttenАй бұрын
Thank you for this video. As a total noob and beginner to ESP and HA i can't get anything to work like i want 😅 especially since i don't even have HA yet
@AndreasSpiessАй бұрын
So: One step after the other ;-)
@rklaucoАй бұрын
Influx? In the integration for influxDB (the yaml) you can set which data is stored in influx - and as soon as such data is populated, it's sent to influx instance. No problem at all. The only thing is you have to have HA in the middle of it.
@AndreasSpiessАй бұрын
Thank you for the tip! So I have to investigate a bit more. I do not want to have only one database for all data. I want to separate them (weather, energy, for example).
@dan-nutuАй бұрын
I'd also be interested to find this (i.e. how to separate data sent to influxdb).
@Darkk6969Ай бұрын
I currently use influxDB and Grafana that is integrated into HA. I currently run HA as a VM and works pretty well. I already have a separate influxDB and Grafana VM for other uses.
@DanielFSmithАй бұрын
I haven't looked at the Influx problem, but if I were starting out, I'd get HA's Node Red listening on the sensors, then process, and feed them in to the database.
@dankarau23075 күн бұрын
You can use Node Red to parse out (and manipilate if necessary) the data you want to move to InfluxDB.
@AndreasSpiess2 күн бұрын
I agree. That is what I currently do.
@MikeKranidisАй бұрын
Perfect introduction. I found the esphome and yaml configuration very strange or confused to me, to be honest !
@AndreasSpiessАй бұрын
So we are already 2 ;-)
@Steven_Bennett_YTАй бұрын
How can one open the device dashboard shown at 7:39? I am running ESPHome from within Home Assistant running as a VM in VirtualBox, all on Win 11. Thank you
@efimovvАй бұрын
This is device in Homeassistant. Settings --> devices and integrations --> ESPhome --> some device.
@rudieo3113Ай бұрын
ESPhome works also fine on the Raspberry Pi Pico.
@AndreasSpiessАй бұрын
Thank you for the info. Where would you prefer it over an ESP32?
@rudieo3113Ай бұрын
@@AndreasSpiess When more i/o ports are needed, ESP32 have a number of GPIO which are restricted in use, example 34 and up are input only.
@rudieo3113Ай бұрын
have not a real preference for small projects. For real small projects as one or two sensors only the ESP 8266 prefers even.
@ligius3Ай бұрын
You can use the mqtt component to publish to mqtt the values which will get picked up by influxdb. I think before the easy "homeassistant:" tag this is how it was done, many years ago, but I might confuse it with a different project.
@AndreasSpiessАй бұрын
Thank you. So far, I have never come across a direct input of mqtt into influxDB. Maybe they use a converter. I will have to investigate
@zeffster2Ай бұрын
YAML is just a config data format. pure data. kinda like json or xml
@klassichd10Ай бұрын
@zeffster2 I am always asking why yaml was created instead of using existing standards such as json.
@AndreasSpiessАй бұрын
Writing JSON manually on one line is not easy for me. So I usually use a structure similar to YAML (Counting the {{}} is not easy for my old eyes). So the natural decision probably was: If you anyway need a sort of structure, why not omit the {{}}? As showed in the video, ESPhome YAML can contain also programming logic. So it is probably a mixture between both.
@klassichd10Ай бұрын
@@AndreasSpiess my first programming language was Algol 60 using 'begin' and 'end' as structural elements. C uses {} as json does. And I have not to count spaces which was the source of the majority of errors when I started ESPHome. Anyway, it is as it is and at the end of the day ESPHome is faster than writing arduino C-code by myself
@regispriqueler8745Ай бұрын
@@AndreasSpiess json is not a programing language, YAML is not a language. Why always trying to reinvent the wheel ? All hat ESP home do could be done with library and an adhoc IDE, using C, C++, javascript or python. Using a data format to make code is absurd. And don't tell me it's easier for beginner just because not learning a real language is easier. What Home assistant have done is starting with creating a domotic system base you can managesd by configuring on the shelp component, but then they rapidly have been confronted to more complex logic and to keep a "simple" link between the graphical configuration interface and the scriptabale files they have put logic into configuration files. But it's confusing, annoying and quit cumbersome to write if you want complex logic to be implemented into Home Assistant. But as you conclude, it's the way to go if the project is adding relatively simple on the shelf components to our Home Assitant ecosystem.
@zyghomАй бұрын
I have tones of devices in ESPhome but also another tone of C++ ones. All depends what the usage is - for Home Assistant for sure ESPHome is much, much easier, unless it is very complicated device i.e. Hot Plate or so.
@AndreasSpiessАй бұрын
Thank you for sharing your experience. It will help others to decide.
@YigalBZАй бұрын
I am curious: the push button you used requires debounce. Is that generated automatically? Time control?
@efimovvАй бұрын
It controlled via separate options. In binary sensor component you have filters, like delayed_on: 100ms or delayed_off: 100ms (i.e. you must hold for 100ms ). You can even implement different actions on short and long press, double and triple clicks - via automations IIRC (I did implement double click long time ago)
@ristomattiАй бұрын
The declarative YAML stuff is also at the heart of what "DevOps" or "cloud engineers" do these days. It is in a way very powerful or expressive way to get a lot of done with "just a few lines". But on the contrast, it lacks a lot of convenient features developers have gotten used to with modern programming languages and IDE's such static analysis and autocomplete. In my experience there's typically 1:10 ratio of engineers that know their way around this in a typical project. These engineers often end up being the bottlenecks. In the worst case a "bus factor" of 1. MCU's are a very different topic as cloud engineering, but the principle here is the same. In essence, it's a GUI interface without the GUI. It might contain snippets of code/script but code it is not. I guess it is called "infrastructure as code" as it can be committed to version control with the rest of the code and also peer reviewed the same way. 😁
@AndreasSpiessАй бұрын
At least, autocomplete is built-in ESPhome. And the squiggles help to avoid obvious errors. But many more complex errors are only discovered during compilation. Maybe this will become better in the future, if the overall code is regularly checked, not only the few lines around where your write.
@michaels3003Ай бұрын
Internet says ESPHome uses Python to generate C++ code that is then compiled.
@gungun974Ай бұрын
@@michaels3003 this is true, the ESPHome CLI is at the end a program written in Python that parse YAML files and decide to copy blob of c++ code in a directory to form a real project and than compile it for you.
@jmrАй бұрын
I find sometimes order matters In YAML. The file seems to execute top to bottom and sometimes A must happen before B. Maybe not a problem with ESP Home but definitely an issue for the HA config file.
@AndreasSpiessАй бұрын
I did not recognize it in ESPhome. But maybe it is also true here. But I only meant components in this respect. Inside components, the sequence can matter a lot.
@pperrinukАй бұрын
Very interesting - It would be interesting to see you ask an AI to write the equivalent arduino studio code from your esphome code... In my experience people are massively underestimating the existing power of AI. With a good AI whisperer like me, things go amazingly fast.
@AndreasSpiessАй бұрын
I also use ChatGPT for coding C++ and I agree, it is very helpful. Still, the differences stay more or less the same.
@ezrakoperАй бұрын
How zigbee and ZHA which are native to home assistant fit in
@AndreasSpiessАй бұрын
Most ESP32 use WiFi, not Zigbee.
@kirovolegАй бұрын
For InfluxDB I have the esphome sensors send data to mqtt and then nodered takes it and sends to influx
@AndreasSpiessАй бұрын
Currently, I use HA sensors (from the companion app) in Node-Red and do the same. So, I do not need MQTT. This is what I would like to avoid...
@kirovolegАй бұрын
@AndreasSpiess then you may be able to use an http request directly on esphome to the Influxdb url. I use this on my raspberry pi but never tried it on esphome.
@gjb.80Ай бұрын
Yaml can seem difficult at first but it’s superior to JSON on the whole after you learn it.
@AndreasSpiessАй бұрын
JSON is probably more made for machines with all the patentesis...
@GunXterАй бұрын
Well for me as a programmer its a big difference: ESPHome you are just configuring existing program. ArduinoIDE YOU are making the program
@AndreasSpiessАй бұрын
And where does AI fit in? As a programmer, your boss or customer will ask you in the future to use these new tools to save time. He will call it "productivity increase" ;-)
@kmtsvetanovАй бұрын
Hello. Can you help me with ESPHome? How to work with SD? I wish to play a mp3 or wav file. I have media player and DAC and I can play music using Home Assistant but not from SD. I was looking for a solution for the past week 😢. I have esp32 and a SD board connected
@AndreasSpiessАй бұрын
I would have to google, too to find an answer :-(
@NatepwnsuАй бұрын
O man my petibro cat fountain has a mode that turns it on when the cat is in range if you have it set to battery mode which is the default setting when it's not plugged into the wall.
@AndreasSpiessАй бұрын
It's the same here, with the exception that my PIR sensor also starts the pump when anyone else is within its range. That is what I want to omit.
@TheRajeev7778Ай бұрын
Do we have a good source of YAML tutorial for beginners?
@AndreasSpiessАй бұрын
Many of the typical HA channels have some sort of YAML tutorials for HA (e.g. Smart Home Junkie). KZbin search should find them for you.
@TheRajeev7778Ай бұрын
@AndreasSpiess Thankyou
@222inverterАй бұрын
I use ESPHome in some of my sensors at home...but on one occasion a ESPHome update screwed up my Hot Water sensor???...I re-flashed with a clean install of ESPHome...configured it...still did not work??? I think that updates should be pointed out is a possible flaw in their process???? I ended up reflashing it in Arduino MQTT code....been working ever since.
@dougle03Ай бұрын
I generally don't update existing devices unless I'm making changes to the device... I would suggest not updating unless you really need to. If you do, then take the time to read the breaking changes carefully to understand the impacts of revision changes...
@AndreasSpiessАй бұрын
I agree: MQTT is more standardized. And the ESPhome (fast) update policy is not always good ( mentioned that fact in my HA video). I would create an issue in the sensor project that the maintainer can correct it. It seems to be a classical bug.
@bitosdelaplayaАй бұрын
Thanks for this good video. What do you think about micropython on esp32 ???? I already use arduino ide, but for my work i need to program some app and i think about learning python (one language multiple platform : i'm not a big c++ fan). Thanks for your response
@AndreasSpiessАй бұрын
Micropython is also a language on a higher level. For me, it is replaced by ESPhome for most applications. Complex and fast things are done in C++ anyway.
@bitosdelaplayaАй бұрын
@@AndreasSpiess Thanks
@yoalmiravendano1569Ай бұрын
Hello Sir this comment is not related to the video, but I’m looking for some information, im trying to make a device wireless I’m normally send and receive data from it but I have issues with the cable is an usb device so I was thinking to add an ESP32 on the end of the device and another ESP32 to the computer, I don’t have much knowledge, being watching your videos I’m trying to learn so any answer will be appreciated
@AndreasSpiessАй бұрын
Maybe you start acquiring knowledge with a simple project and add more functionality with more knowledge? But it will take time :-(
@bendunselmanАй бұрын
How does it compare if you take Home Assistent and ChatGPT out of the comparison?
@AndreasSpiessАй бұрын
I think similar because I use ChatGPT also to write Arduino code...
@101jtagАй бұрын
Hassio cannot be run offline, right ? I dont trust the interweb, nor do i want to become dependent. So i need a fallback. I choose MQTT. So i prefer ESPEasy for my sensors.
@AndreasSpiessАй бұрын
Home Assistant runs completely offline (except for getting the files and updates).
@efimovvАй бұрын
If you prefer you can install Homeaasistan as python app to wheel and run it directly from there. As well as ESPHome can be installed directly (I run it from my notebook).
@bendunselmanАй бұрын
How much time per line of code did it take? How much time would it take in either IDE?
@AndreasSpiessАй бұрын
No idea. But the # of lines of code would probably be 10x more in C++. And do not forget the debugging and testing...
@michaels3003Ай бұрын
Internet says ESPHome uses Python to generate C++ code from YAML configuration files edited by the user. This is a very old idea, but not much used up to this point (I think).
@michaels3003Ай бұрын
I meant code generation from configuration files, not from YAML specifically.
@AndreasSpiessАй бұрын
AFAIK you are right!
@MSP_TechLabАй бұрын
This style of modern programming with something like app.run() inside the main loop makes me frustrating. I once spent more than half an hour trying to understand how nordics ble example with simle blink logic works. It appeared that particular led.on/off() function was buried five leves deep (if count from main). I still don't understand why on earth they need so much levels of abstraction on a such small device. 😢
@AndreasSpiessАй бұрын
Welcome to the new world. Somebody has to use the power of the new MCUs ;-)
@Nebbia_affaraccimieiАй бұрын
what i hate about esphome is the lack of clear guidance and examples on what is supported and what not.
@AndreasSpiessАй бұрын
This frustration lead to this video ;-)
@Darkk6969Ай бұрын
Same here. I had to do alot of research to figure out how to get MQTT devices working properly in HA. Once I figured out the logic it's not too bad.
@DaveSomethingАй бұрын
that's pretty, I have to do it in CLI, using Nano... then I type: esphome run thingy.yaml. Sometimes I have to add the name to my hosts file so it can upload to the esp32 OTA. HA then grabs it.
@AndreasSpiessАй бұрын
That is what I called "offline". A good way if your HA runs on a Raspberry Pi because compiling is usually much faster on a Desktop PC.
@DaveSomethingАй бұрын
@AndreasSpiess I tried the other ways, but went back to core install.
@jerzyrzaniak4437Ай бұрын
you're breaking my 'tasmota-lover' heart, esphome looks more technically elegant. BTW have you tried berry on Tasmota for these purposes?
@AndreasSpiessАй бұрын
No, I never used it. I tend to stick to one solution for a particular problem to save the initial time for learning :-(
@ifell3Ай бұрын
Wow, sounds great for the part time hobbiest. Wonder if the forums are full of people that will make you work to solve a question.
@AndreasSpiessАй бұрын
The community is big already, and many solution are documented as entries there. If you do not find your problem discussed somewhere, you know: It will be hard ;-)
@dougle03Ай бұрын
Like all forums, ESPHome is not immune to idiots and superior complex people... I moderate the FB group and we generally mute or remove the worst offenders...
@ifell3Ай бұрын
@dougle03 never thought about looking at the groups on Facebook.
@menhirmikeАй бұрын
As a longtime software engineer, let me say that it’s okay that you didn’t like YAML. I don’t know anyone that actually _likes_ it, we just learned to deal with, like Stockholm Syndrome.
@AndreasSpiessАй бұрын
:-))
@pcfreak1992Ай бұрын
Liking is a strong word. I *prefer* it though 😅
@neithere21 күн бұрын
YAML is a very good and readable language. It's just too complex and the early versions had a few stupid decisions ("on" being interpreted as a bool, etc). We need a subset of it (not JSON but a readable one). Unfortunately TOML has appeared to fill this niche and it's basically all the worst traits of YAML and ini-files combined...
@ralfoide17 күн бұрын
*YAML is not a "programming language"* -- it's just a data model language, similar to XML or JSON. In this case, the YAML data format is just used to configure the ESPHome framework. The difference between something like ESPHome and an Arduino INO is that the former can only execute whatever components have already been defined in the ESPHome ecosystem. That said, a lot of Arduino users like Arduino because it's "simple" and they are not programmers. In that case, a simple configuration language like the one used by ESPHome is much better for these users -- they can just use the existing bricks, without having to build their own.
@AndreasSpiess13 күн бұрын
It depends on your definition of "programming language". However, most "programmers" would agree.
@Doping1234Ай бұрын
I wrote a component for ESPhome (though not merged). The project is awesome, but yaml code is horrible to look at and it is not beginner friendly.
@AndreasSpiessАй бұрын
Cool! I have no clue how to write a component. So I am thankful for all of you doing this work!
@Doping1234Ай бұрын
@@AndreasSpiess Well I don't really know either, I took a similar component and adjusted the code :D
@derickmachaaАй бұрын
I enjoyed the video, @AndreasSpiess do you use platform IO as an alternative for Arduino IDE?
@AndreasSpiessАй бұрын
I sometimes do, but not for videos. The Arduino IDE is more used by my viewers.
@derickmachaaАй бұрын
@@AndreasSpiess Thanks
@SamLaybrizАй бұрын
I prefer personnaly Annex32 RDS and his mqtt commands, it runs on a esp8666/esp32 wich is programmable in basic via a web browser.😊
@AndreasSpiessАй бұрын
I never used it, so I cannot tell the difference :-(
@PersonXesАй бұрын
When you talk about using Home Assistant instead of Node Red, I guess you're not referring to automations, but all the rest. There's a lot of information coming from my esphome devices to home assistant, that I use in node red automations
@AndreasSpiessАй бұрын
I already started to transfer some of the simple automations to HA because then it is in one place. The more complex flows are still in Node-Red and I heavily use the interaction between the two.
@PersonXesАй бұрын
@AndreasSpiess my reasoning is the opposite of yours: I don't transfer any automations from node red to Home Assistant, as otherwise I have my automations in two places which will confuse me when I need to start digging 😊
@dougle03Ай бұрын
@@PersonXes All of my automations are in NodeRed... Automations in HA 5 years ago were terribly limited, thus NR was prefered. HA automations today are better, but I'm sticking with what I know and the flexibility NR offers still leaves HA in the dust.. I have elements in NodeRed that are not possible to get into HA natively, thus it is the better place for automation.
@PersonXesАй бұрын
@dougle03 I'm in exactly the same situation as you 😉
@murraymadness4674Ай бұрын
How would you save data to a SDcard in YAML, and make it write in a circular buffer, so only saving the latest data. It only works for an ESP32 ? Isn't that rather limited? Being an old salt, I can't stand having to learn new gizmo languages just to do what I already can do. I know I should learn python, but I just can't. I discovered uLisp (being an old Lisp guy) and it actually runs on all the micros that have enough memory. But frankly C does the job for small apps. In fact, I hate C++ when C is just fine for a tiny micro, I just rewrote the only actually working RTSP code for arduino I could find, and what a mess of C++ it was, crudely adapted to arduino. Now its a single arduino ino file you just load and compile in the ide, no libraries, it just works now.
@dougle03Ай бұрын
ESP32 can interface with SD storage, there is example code in the ESPHome docs on how to do this. I'd recommend against rapid writes to flash media as they don't last long if constantly being written to. Might be better to use MQTT and have the data off loaded to a more appropriate storage device. You can still locally store latest data for on-chip logic of course...
@AndreasSpiessАй бұрын
The idea of ESPhome is to create connected devices. This is why I do not use SD cards anymore. I transfer the readings to a more capable device for future use. So I do not know.
@rickharold7884Ай бұрын
Super cool
@AndreasSpiessАй бұрын
Thank you!
@MrFlagstafАй бұрын
hey andi! mini antwort im breite bärndütsch 😄 merci für dä abriib. also quasi es "deklerativs modäll" wome mit yaml files erstellt. gueti abstraktion vo esphome! mache itz ou no eine uf tüpflischisser... hesch gwüsst, yaml isch ke programiersprach 😂... uuhhh de muess me de aube grad korrigiere. aber weme z video luegt zeigsch ja genau dr ungerschiid vo programiere zu deklariere. aber houpsach me het öpis chönne "korrigiere" 🤪... mach witer mit tüftle, häb spass u aues guete🫡
@AndreasSpiessАй бұрын
Wenn wir ganz genau werden wollen gehen wir zum "Duden". Der schreibt: Programmiersprache: System von Wörtern und Symbolen, die zur Formulierung von Programmen (4) für die elektronische Datenverarbeitung verwendet werden. Jetzt bist du dran ;-)
@holgerschurig4430Ай бұрын
0:20 So if you understand YAML to be a programming language ... then there you have your error. YAML is a configuration language. Like TOML, Windows INI files etc. It is used to configure a program generator (this is what ESPHome actually is). But it isn't really a programming language in itself.
@AndreasSpiessАй бұрын
You are right!
@ralfjahns3777Ай бұрын
YAML is a markup language and therefore totally inappropriate for programming (sequences, loops, branching). So it fits well for describing the properties of a sensor but fails when it comes to automation (for example).
@AndreasSpiessАй бұрын
I think, ESPhome found a good compromise with the "common actions" and with the "lambda code"
@MasterBoyZsАй бұрын
this very nice
@AndreasSpiessАй бұрын
Thank you!
@ThomasHaberkornАй бұрын
ProgramIO in VS code
@AndreasSpiessАй бұрын
Did I say that? Then it was definitively wrong :-(
@calvinbrowne2126Ай бұрын
Biggest problem I've yet to figure out with esphome is how to do things that require deep sleep.
@AndreasSpiessАй бұрын
I played around with deep sleep, and it worked. However, I did not take any measurements (e.g., how long it takes to wake up).
@calvinbrowne2126Ай бұрын
@AndreasSpiess I must revisit....
@AndreasSpiessАй бұрын
@@calvinbrowne2126 It did not make it into the video (it was already too long ;-)
@edmilinski1295Ай бұрын
It's silly to compare c++ with yaml. These technologies help us achieve completely different things. You could also compare it with Microsoft word...
@AndreasSpiessАй бұрын
Where are the "completely different things". Both create a device that does what I want (if I am happy). Just two different roads or vehicles, perfect for a comparison in my view.