ESPHome Basic Setup For All ESP Devices
HTML-код
- Опубликовано: 15 июл 2024
- In this tutorial, I will be explaining in details my foundation configuration for all ESP devices.
You will find the accompanying code on my GitHub Repo @ github.com/homeautomatorza/es...
Support me by
▶ Buying me a tea: www.buymeacoffee.com/homeauto...
▶ On Patreon: / homeautomatorza
▶ Timestamps ⌚:
00:00 - Opening
01:51 - About this tutorial
04:12 - The code
05:36 - Substitutions
07:05 - Naming convention
07:53 - Globals
10:02 - Board Configuration
11:42 - Frameworks
17:19 - Logging
18:19 - Home Assistant API
20:12 - Over-the-air updates
21:52 - WiFi
26:40 - Web Server
27:54 - Status LED
28:39 - Time
30:35 - Binary Sensors
31:35 - WiFi Sensor
32:27 - Uptime Sensor
33:55 - Text Sensors
36:21 - Switches
37:11 - Intervals
38:02 - Compiling the code
38:36 - Uploading the firmware to the ESP32
39:37 - Demo of the Web Server
41:20 - Demo of the Home Assistant integration
43:01 - Recap
▶ Links in Video 🔗:
- ESPHome: esphome.io/
- Code: github.com/homeautomatorza/es...
▶ Copyrights
•••••••••••• Intro and Outtro Music By •••••••••••••
"Soaring''
Jay Man - OurMusicBox
www.our-music-box.com
/ourmusicbox
#smarthome #homeassistant #esphome #diyelectronics #diyiot #esp32 #esp8266 - Хобби
Absolutely hands down the best ESPHome video I’ve seen to date. Great information here.
Great video. Now I know how to connect my ESP32’s to Home Assistant. Excellent start!
Glad I could help!
Wow Pascal ..... another fantastic video. You definitely Rock !!!!
Thank you for all your effort putting this together.
My pleasure!
Excellent tutorial, I really enjoyed this video. I learnt a lot...
Glad it was helpful!
Got into HA and ESPHome a few months ago. This video is so absolutely packed with information. Amazing!
Thank you, you check out the series on the Room Sensor where I am building a room sensor packed with usefull sensors, the 2nd one is probably coming out tomorrow around 15:00 UTC
I have watched a ton of tutorials on youtube and you go the extra mile to explain why versus just showing what to do. I look forward to subscribing to your channel
Thank you.
Thx Pascal. I have been playing a while with ESPHome and started to work on a basic setup template. Your style, tempo and amount of info you shared is excellent. Well done.
tnx, will use the template from the site
Thank you so much for knowledge transfer its really helpful.😀😀
My pleasure
Thank you. I'm just getting started and this was a fantastic introduction.
Great job !
Thank you
Thank you!
You're welcome!
Amaizing video, keep them coming
Thanks, will do!
What a fantastic video. Gave me lots to think about
Glad you enjoyed it!
900th subscriber!
Yeah! Live stream for a 1000?
This is excellent, just looking into esp home, and learnt so much here.
Great video, thanks for sharing your knowledge.
New subscriber 👍
Glad I could help, a channel update is coming soon, lot's of exiting stuff coming.
Thanks for the reply. I am structuring all my new devices that I am adding to have your suggestion structure approach.
The old devices I think I have to reload the firmware (won't work OTA) with the new secrets structures..
If you use a underscore on the "device_internal_name" value you will get an notification when compiling that you should not use underscore for the host name for the device. And if yo use a - instead then it's not compiling as you can't use - in ids.
I apologize for the late response, I’ve been tied up to an hospital bed since last Saturday, I am still there.
This happens because older WiFi protocols do not “like” underscores in the host name, most modern WiFi protocols are not as fussy, hence the warning.
Having said that I find it odd that I did not pick up my oversight, I’ll need to compare the code of the video and my GitHub. This will have to happen when I return home.
Thank you for pointing it out.
- Pascal
Pascal - A very elegant and streamlined way of coding a standard 'foundation' for esp home devices. Thank you.
BTW the second link above to the code, doesn't work.
Wait until Saturday’s livestream where I’ll show more advanced ways to do the code and stream line it even more.
I’ll check the link, thanks.
Pascal, I have a question for you, finally I have some times to deep dive this video. I love the structure for all the devices.
1) I do have a question for you. This assumes that in the secrets, the api_encryption_key, the web_server_password, web_server_user they all are going to be the same for each sensor ? If that is true (correct me if understood this right), is not an issue to have different sensors with the same api_encryption_key, web_server_password .... etc been the same ???
2) If 1) is correct can I do the same (for all the devices) to have the gateway_address and subnet_address been the same in the secrets.yaml ?
Thanks a lot for all your videos !!!! They are awesome. Well structure and super detail. Thank you for doing all of that for your followers and subcribers.
THANKS AGAIN !!!!!!
Makes sure you don't miss the Solar Eclipse, for me it will be at 3:00PM (Michigan, USA) .... Not sure if you will get to see it where you are !!!!
Hey Miguel,
Thank you, though a tweaked the structure to allow for a few other things, unfortunately the next video will probably only be available in a couple of weeks 😟.
My body is not leaving a choice.
1. Your assumption is correct, I use a single randomized password and key for all my devices. It makes life so much easier with very little drawbacks security wise as all the devices are within my internal network.
2. Well that too, the only one I change is the IP Address, I keep a spreadsheet for that
Thank you for the support
Great video
I learn a lot of things from your video. I instald thelas esphome add on version on my home assistant. But every time i want to compile a node the add on gives an eror. The eror is maximum resources reced.
Thanks for the help
You can try 2 things,
1. Reboot the Home Assistant machine, that worked for me last time.
2. You may be short on memory, that would require more RAM. If you have 4Gb or more this should not be a problem though.
I see in your secret.yaml a line with APIkey for HA the question is: for all your esphome nodes you are using the same APIkey?
Is it working?
Yes I am using the same API key and it’s working.
It makes management so much easier
I have manually typed this into my home assistant and it kept not working, i then copied yours and yours also isn't working. Have there maybe been updates that have made this coding stoip working? It stops at the Binary Sensor name "id: ${device_internal_name}_status" where in the fault says the name cannot have a $ , Can anyone help me out, i have been trouble shooting this for 4 hours without any luck.
I am not sure I understand, but here are 2 things you can try
1. Is device_internal_name defined?
2. Are you typing as follows:
id: ${device_internal_name}_status
Lastly, are you doing this in ESPHome or Home Assistant ?
The code that I have on GitHub is fully tested, except for the ota change there is nothing else that should break it.
Can you maybe paste the full error, so I can help?
Sure will do, am using in esphome in home assistant. Will message you in the morning, many thanks, Michael
@@homeautomatorza I have a screen shot of the error code and the actions that have run before it. is there anyway i can forward this to you at all please ?
@@homeautomatorza INFO ESPHome 2024.6.6
INFO Reading configuration /config/esphome/foundation-device.yaml...
WARNING Found '${device_internal_name}_status' (see binary_sensor->0->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_wifi_signal_sensor' (see sensor->0->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_uptime_sensor' (see sensor->1->name) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_uptime_human' (see sensor->1->on_raw_value->then->0->text_sensor.template.publish->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found 'int seconds = round(id(${device_internal_name}_uptime_sensor).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? to_string(days) + "d " : "") +
(hours ? to_string(hours) + "h " : "") +
(minutes ? to_string(minutes) + "m " : "") +
to_string(seconds) + "s")
).c_str();' (see sensor->1->on_raw_value->then->0->text_sensor.template.publish->state) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_ip_address' (see text_sensor->0->ip_address->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_connected_ssid' (see text_sensor->0->ssid->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_mac_address' (see text_sensor->0->mac_address->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_uptime_human' (see text_sensor->2->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_status' (see binary_sensor->0->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_wifi_signal_sensor' (see sensor->0->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_uptime_sensor' (see sensor->1->name) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_uptime_human' (see sensor->1->on_raw_value->then->0->text_sensor.template.publish->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found 'int seconds = round(id(${device_internal_name}_uptime_sensor).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? to_string(days) + "d " : "") +
(hours ? to_string(hours) + "h " : "") +
(minutes ? to_string(minutes) + "m " : "") +
to_string(seconds) + "s")
).c_str();' (see sensor->1->on_raw_value->then->0->text_sensor.template.publish->state) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_ip_address' (see text_sensor->0->ip_address->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_connected_ssid' (see text_sensor->0->ssid->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_mac_address' (see text_sensor->0->mac_address->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING Found '${device_internal_name}_uptime_human' (see text_sensor->2->id) which looks like a substitution, but 'device_internal_name' was not declared
WARNING 'esphome_foundation_device': Using the '_' (underscore) character in the hostname is discouraged as it can cause problems with some DHCP and local name services. For more information, see esphome.io/guides/faq.html#why-shouldn-t-i-use-underscores-in-my-device-name
WARNING GPIO2 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Detected timezone 'Europe/London'
Failed config
binary_sensor.status: [source /config/esphome/foundation-device.yaml:111]
platform: status
name: Status
IDs must only consist of upper/lowercase characters, the underscorecharacter and numbers. The character '$' cannot be used.
id: ${device_internal_name}_status
@@homeautomatorza Hello Pascal, i have uploaded the error code for you to review if you would be so kind please ?