ESPHome Basic Setup For All ESP Devices

Home Automator
11 Feb 202444:20

Summary

TLDRIn this informative video, the host discusses the fundamental configuration applied to all ESP home devices, emphasizing minimalism for efficient troubleshooting. They announce a new content schedule, introducing 'The Quickies' series for concise tutorials. The host guides viewers through setting up a new device in ESP home, explaining substitution variables, globals, board configuration, and various sensors. They also cover Wi-Fi connectivity, over-the-air updates, and integration with Home Assistant, demonstrating a step-by-step process for compiling, debugging, and ensuring device functionality.

Takeaways

  • πŸ“… The creator is changing the channel's schedule to add at least one video per week and moving long-form videos to Saturday for flexibility.
  • πŸ†• A new series called 'The Quickies' is introduced, featuring short tutorials under 10 minutes, in addition to the regular long-form content.
  • πŸ›  The video focuses on the basic configuration for ESP home devices, emphasizing the importance of minimalism while maintaining troubleshooting capabilities.
  • πŸ”Œ The foundation configuration includes setting up substitution variables (constants) for device-specific information like device name, Wi-Fi name, and IP address.
  • 🌐 The video discusses the importance of using manual IP addresses for ESP devices to simplify network troubleshooting and device identification.
  • πŸ“ The creator uses a consistent naming convention for device and sensor IDs in the code, which helps in organizing and identifying components quickly.
  • πŸ”„ The video explains the use of globals and board configurations in ESP home, which are essential for setting up device parameters and microprocessor details.
  • πŸ”’ The Home Assistant API is crucial for ESP devices to communicate with Home Assistant, and the video highlights the necessity of having the correct API key.
  • 🌐 The video covers various connectivity options for ESP devices, including Wi-Fi, Bluetooth, Ethernet, LoRa, Zigbee, and RF, but focuses on Wi-Fi configuration.
  • πŸ•’ Time synchronization is discussed, with options like SNTP, GPS, RTC, and Home Assistant for setting the device's time, depending on the user's preference and setup.
  • πŸ”„ The video demonstrates how to compile the ESP home configuration, install the firmware, and add the device to Home Assistant for functionality testing.

Q & A

  • What is the main topic of the video?

    -The main topic of the video is discussing the basic configuration applied to all ESP home devices, focusing on their setup and troubleshooting.

  • Why is the channel schedule changing?

    -The channel schedule is changing because the current Friday afternoon 5:00 PM slot for long-form videos is not suitable for the creator due to lifestyle constraints. The new schedule will move everything to Saturday for more flexibility.

  • What is the purpose of the new series called 'The Quickies'?

    -The Quickies is a new series of tutorials that will be under 10 minutes long. They will cover installations needed for the Saturday videos or address topics and questions from viewers that haven't been discussed in previous videos.

  • What is the significance of minimalism in the base code for ESP home devices?

    -Minimalism in the base code is important for ESP home devices as it helps in conserving limited memory and processing power. However, it should not compromise the ability to troubleshoot and diagnose problems.

  • What are substitution variables in ESP home?

    -Substitution variables in ESP home, also known as constants in coding, are values that are set once and cannot be changed. They are used for defining device names, Wi-Fi names, friendly names, and other constants.

  • Why is the naming convention important in ESP home devices?

    -The naming convention is important for consistency and ease of identification. It helps in organizing and managing devices, especially when searching for specific devices in developer tools.

  • What does the board configuration in ESP home define?

    -The board configuration in ESP home defines the microcontroller type, the amount of SRAM or memory, Wi-Fi type, Bluetooth version, built-in sensors, and the number of SPI, I2C, I2S, and UART interfaces available.

  • Why is the Home Assistant API key important for ESP home devices?

    -The Home Assistant API key is crucial for ESP home devices as it enables communication with Home Assistant. Without it, devices cannot extract information, synchronize time, or initialize properly in Home Assistant.

  • What is the purpose of the over-the-air (OTA) updates in ESP home?

    -OTA updates in ESP home are used for safely updating the device firmware. They ensure that the device reboots into safe mode to focus on updating itself, and if the update fails, it will revert to the old version after a set number of attempts.

  • How does the Wi-Fi configuration in ESP home help in network management?

    -The Wi-Fi configuration in ESP home allows devices to connect to a known access point or become an access point themselves if they fail to connect. This setup helps in managing the network by providing a fallback option and ensuring the device remains connected.

Outlines

00:00

πŸ“… Schedule Change and New Video Series Introduction

The speaker announces a change in the channel's schedule, moving long-form videos to Saturdays for flexibility and quality. They introduce a new series called 'The Quickies,' which will provide short tutorials under 10 minutes, in addition to the main content. The speaker emphasizes the importance of minimalism in their base code for ESP home devices, allowing for efficient troubleshooting without sacrificing functionality.

05:02

πŸ› οΈ Setting Up Basic Configuration for ESP Home Devices

The speaker begins a step-by-step guide to setting up the basic configuration for ESP home devices, starting with a blank canvas in ESP home. They discuss the importance of substitution variables, which are constants set once in the code, and the naming convention used for devices and sensors. The video also covers the use of globals, board configuration, and the choice between different microcontrollers and frameworks like Arduino and ESP-IDF.

10:05

πŸ” Detailed Explanation of Board Configuration and Platform Selection

The speaker delves into the specifics of board configuration, emphasizing the importance of selecting the correct board and microprocessor for the device. They discuss the different platforms available in ESP home, such as ESP8266 and ESP32, and the considerations for choosing between them, including the built-in sensors and connectivity options. The speaker also touches on the use of the ESP-O framework and the importance of defining the platform for memory and functionality.

15:05

πŸ—‚οΈ Home Assistant API and Over-The-Air Updates

The speaker explains the necessity of the Home Assistant API key for communication between ESP home devices and Home Assistant. They discuss the process of setting up over-the-air (OTA) updates, which include safe mode enforcement and reboot timeout settings. The speaker also highlights the importance of using the same password for all devices to simplify the process.

20:05

πŸ“Ά Wi-Fi Connectivity and Access Point Fallback

The speaker discusses the importance of Wi-Fi connectivity for IoT devices and the various connectivity options available in ESP home. They provide a detailed explanation of the Wi-Fi configuration, including the use of manual IP addresses for easier troubleshooting. The speaker also covers the fallback mechanism where the device becomes an access point if it cannot connect to a known Wi-Fi network.

25:07

πŸ•’ Time Configuration and Sensor Setup

The speaker explains different methods of obtaining time for IoT devices, such as SNTP, GPS, and RTC, and their preference for using Home Assistant for time synchronization. They introduce the concept of binary sensors for device status monitoring and the setup of Wi-Fi signal sensors for diagnostics. The speaker also discusses the use of text sensors for displaying information like IP addresses and MAC addresses.

30:10

πŸ”„ Restart Switches and Interval Checks for Connectivity

The speaker introduces the default switches available in ESP32 for restart and safe mode operations. They explain the usefulness of these switches for troubleshooting and device management. The speaker also discusses the use of intervals for continuous Wi-Fi connection checks, emphasizing the importance of this feature for devices with screens.

35:12

πŸ”§ Compilation, Debugging, and Integration with Home Assistant

The speaker guides through the process of compiling the ESP home configuration, checking the debug logs, and ensuring the web server is operational. They demonstrate how to add the device to Home Assistant using the correct API key and encryption key, highlighting the importance of these keys for device recognition and communication.

40:13

πŸ”š Recap and Final Thoughts on ESP Home Device Setup

The speaker concludes the tutorial by summarizing the key points covered, including the setup of basic configurations, the importance of minimalism, and the troubleshooting capabilities of the foundation device. They encourage viewers to like, subscribe, and enable notifications for future tutorials and share their experience with the starting configuration provided.

Mindmap

Keywords

πŸ’‘ESP home devices

ESP home devices refer to smart home gadgets that are based on the ESP8266 or ESP32 microcontrollers and are integrated with the ESP-Home system. These devices are programmable and customizable, allowing users to create various automations and functionalities for their smart homes. In the video, the speaker discusses the basic configuration applied to all their ESP home devices, emphasizing the importance of these configurations for troubleshooting and diagnostics.

πŸ’‘Minimalism

Minimalism, in the context of coding and device configuration, is the principle of using the least amount of code or resources necessary to achieve the desired functionality. The speaker mentions that their base code philosophy is minimalism, but not at the cost of troubleshooting capabilities. This means that while they aim to keep the code simple and efficient, it still needs to provide enough information for diagnosing any potential issues that may arise.

πŸ’‘Troubleshooting

Troubleshooting is the process of identifying, diagnosing, and resolving issues or problems. In the script, the speaker highlights the importance of being able to troubleshoot ESP home devices, especially given their limited memory and processing capabilities. The basic configuration discussed is designed to allow users to effectively diagnose problems through logging and other diagnostic tools.

πŸ’‘Substitution variables

Substitution variables, also known as constants in coding, are predefined values that are set once and not changed during the execution of the code. In ESP-Home, these are used to simplify the code by replacing repetitive values with a single identifier. The speaker discusses using substitution variables for the device name, Wi-Fi name, friendly name, and IP address in their basic configuration.

πŸ’‘Globals

Globals in programming are variables that can be changed and accessed throughout the code. Unlike substitution variables, globals are not static and can be modified at any point in the program. In the video, the speaker uses the example of Wi-Fi connectivity, where the global variable can be toggled to initiate a connection or disconnection as needed.

πŸ’‘Board configuration

Board configuration in the context of ESP-Home refers to the specific settings and parameters assigned to the physical device's microcontroller. This includes the type of microcontroller (e.g., ESP32), the board model (e.g., NodeMCU ESP32), and other relevant settings. The speaker discusses the importance of correctly configuring the board to ensure compatibility and proper functioning of the device.

πŸ’‘OTA updates

OTA (Over-The-Air) updates are a method of delivering software updates to devices wirelessly. In the script, the speaker expresses their appreciation for ESP-Home's OTA update feature, which allows for easy and safe updates of the device's firmware. The process includes a safe mode reboot and a reboot timeout to ensure the device can recover in case of update failure.

πŸ’‘Wi-Fi connectivity

Wi-Fi connectivity is a core aspect of IoT devices, allowing them to connect to a network for remote control and data exchange. The speaker discusses the Wi-Fi configuration in ESP-Home, including setting up the SSID and password, using DHCP for IP address assignment, and implementing a fallback AP (Access Point) mode in case the device cannot connect to a known network.

πŸ’‘Status LED

A status LED is a light-emitting diode used to indicate the operational status of a device. In the video, the speaker mentions configuring a status LED on the ESP home device to provide visual feedback on the device's connectivity and operational status. This can be particularly useful for quickly diagnosing issues with network connectivity.

πŸ’‘Binary sensor

A binary sensor in the context of smart home devices is a type of sensor that detects changes and reports them as on/off or true/false states. The speaker discusses using a binary sensor to monitor the status of the ESP home device, which can be useful for triggering automations or alerts when the device becomes unavailable.

πŸ’‘Text sensor

A text sensor is a type of sensor that outputs textual information rather than numerical data. In the script, the speaker uses text sensors to display information such as the Wi-Fi IP address, connected SSID, and MAC address. This information can be valuable for diagnostics and for configuring network settings manually.

πŸ’‘Up time

Up time refers to the duration that a device has been running without interruption. The speaker discusses implementing an up time sensor in the ESP home device configuration to monitor how long the device has been active. This can be useful for performance monitoring and for understanding the reliability of the device.

πŸ’‘Safe mode

Safe mode is a diagnostic mode that can be used to troubleshoot issues with a device. In the video, the speaker mentions the use of a switch to restart the ESP home device into safe mode, which can help in identifying and resolving problems with the device's operation.

πŸ’‘Captive portal

A captive portal is a feature of an access point that can be used to provide a login page or configuration interface to users before they gain full access to the internet or a network. The speaker discusses the captive portal in the context of the fallback AP mode, where if the ESP home device cannot connect to a known network, it becomes an access point with a captive portal for users to set their Wi-Fi details.

Highlights

Introduction to basic configuration applied to all ESP home devices for effective troubleshooting.

Announcement of channel schedule change to enhance video quality and frequency.

Introduction of a new series 'The Quickies' for concise tutorials under 10 minutes.

Explanation of minimalism in base code for ESP devices without compromising troubleshooting capabilities.

Highlighting the importance of ESP home site and its comprehensive documentation.

Step-by-step coding guidance starting with a blank canvas in ESP home.

Discussion on substitution variables or constants in ESP home configuration.

Clarification on the naming convention for device and sensor IDs in coding.

Introduction to globals in contrast to substitutions, allowing change throughout the code.

Board configuration explanation including the selection of microprocessor and board.

Differentiation between the two frameworks in ESP home: Arduino and ESP IDF.

Importance of selecting the right platform for defining MCU type and memory in ESP home.

Explanation of logging levels and their significance in troubleshooting.

Configuration of Home Assistant API for data extraction and time synchronization.

Overview of Over-The-Air (OTA) updates in ESP home for easy firmware updates.

Wi-Fi configuration essentials for IoT devices in ESP home.

Setup of Access Point (AP) block for devices that fail to connect to a known Wi-Fi network.

Introduction to the web server in ESP home for internal diagnostics.

Configuration of status LED for visual confirmation of network connection.

Time configuration options in ESP home including Home Assistant time sync.

Utilization of binary sensors for device status reporting in Home Assistant.

Setup of Wi-Fi signal sensor for monitoring signal strength.

Implementation of uptime sensor for tracking device runtime.

Introduction to text sensors for displaying information like IP address and MAC address.

Configuration of default switches for restart and safe mode operations.

Explanation of intervals for checking Wi-Fi connection status.

Compilation process of the ESP home configuration file and initial testing.

Integration of the ESP home device with Home Assistant for entity recognition.

Recap of the video content and the provided foundational ESP home device configuration.

Transcripts

play00:02

[Music]

play00:09

hi

play00:09

there today we're going to have a chat

play00:12

about the basic configuration that I

play00:15

apply to all my ESP home devices these

play00:18

are very useful and in some ways vital

play00:22

to be able to tribal shoot and give some

play00:25

diagnosis I will talk further about each

play00:28

one of these before we carry I just want

play00:30

to make a public announcement I'm am

play00:32

going to be changing the schedule of the

play00:35

channel a little bit and I think you'll

play00:37

like it and I'll tell you why I am

play00:40

adding a video at least one video a week

play00:45

there may be more but that's another

play00:47

story right now I promised you that I

play00:50

would do a long form video every Friday

play00:54

afternoon at

play00:55

5:00 this is not suiting me at all I

play00:58

thought I could and to be truthful with

play01:02

you the way that my lifestyle is just

play01:05

doesn't allow me to give you a good

play01:09

quality video by Friday afternoon so I

play01:13

am moving everything to Saturday that

play01:16

will allow me some flexibility in time

play01:18

to be able to give you something decent

play01:21

but in the good news there is now a new

play01:24

series called the quickies and the

play01:25

quickies are going to be tutorials that

play01:28

are going to be under 10 minutes they

play01:30

are additional to my long form videos of

play01:33

the of the

play01:35

Saturdays but also they will cover

play01:38

installations that may be needed for the

play01:41

Saturday video or they will cover things

play01:44

that I haven't talked about in the

play01:46

previous video or questions that come

play01:50

from

play01:56

you before I start coding there are a

play01:58

few things that I need to highlight

play02:01

about ESP H's basic configuration first

play02:04

of all there are some configuration that

play02:06

exists only for the esp32 or only for

play02:11

the ESP

play02:12

8266 well you get the

play02:15

picture these are not going to be

play02:17

included in this video I will talk about

play02:21

the little variances between the

play02:23

different microcontrollers in another

play02:26

video which is coming out next week in

play02:28

which I will speak about Bluetooth and

play02:32

the web server this said one of the

play02:36

philosophies that I use in my base code

play02:40

is

play02:41

minimalism but

play02:42

minimalism not at a cost of not being

play02:46

able to

play02:48

troubleshoot so everything that I'm

play02:50

going to give you today is minimalistic

play02:55

but will allow you to troubleshoot and

play02:57

diagnose problems that's very important

play03:01

because these little

play03:04

fellows

play03:06

have limited memory have limited space

play03:10

on them and have limited speed so we

play03:13

need to say

play03:15

minimalistic but if something goes wrong

play03:18

we need to know what goes

play03:20

wrong and we need to Output that to the

play03:23

logs what you're going to see now every

play03:26

single one of my ESP devices

play03:30

has that in it I call it my Foundation

play03:35

configuration from there I will add

play03:38

other sensors one last thing that I want

play03:41

to say is the ESP home site and the ESP

play03:45

own

play03:46

documentation is absolutely incredible

play03:50

I've written my share of API

play03:53

documentation and I can tell you this

play03:56

documentation has never let me down how

play04:00

about we start with the top and we're

play04:03

going to be talking about the code step

play04:06

by step let's not delay any further and

play04:09

get to do some coding see you

play04:16

there how about we start as you can see

play04:20

I've taken all of the previous devices

play04:23

out and we are back to a blank canvas

play04:26

inside of a us

play04:28

home

play04:31

so first thing that we're going to do is

play04:33

add a new

play04:35

device we don't care much about

play04:38

this we are going to call it

play04:42

Foundation

play04:45

Foundation

play04:49

device and we're going to click

play04:52

next it's anp32 and forward I will be

play04:55

using exclusively

play04:58

esp32s particularly this one which is a

play05:01

node MCU

play05:04

esp32 version

play05:07

1.1 so let's click on esp32 we're not

play05:12

really interested by this we're going to

play05:14

close it click

play05:17

edit and I am going to delete everything

play05:20

up to here now why am I going to do that

play05:24

because I am actually going to put some

play05:26

code that I am going I am about to inst

play05:29

it I just want to copy

play05:33

this okay and we're going to delete it

play05:36

the first code block we're going to talk

play05:38

about are the substitution variables now

play05:42

we've got another name for them in

play05:44

coding which is called constants it's

play05:47

you set them once and that's that you

play05:50

can't set them again you can't change

play05:52

them it's over but those are called sub

play05:56

substitution variables inside of ESP

play06:01

home okay so what are we going to put in

play06:04

there I'm putting the device name I'm

play06:08

putting the device Wi-Fi name because

play06:11

the device name has to have underscore

play06:14

and the Wi-Fi name has to have

play06:16

dashes I'm putting the device friendly

play06:21

name and IP address I will talk about

play06:25

the device something time a little later

play06:28

but in short

play06:29

it's how many times we going to query a

play06:33

sensor per minute or per hour or per day

play06:38

for that matter now we don't want to

play06:41

overcrowd the MCU because once we start

play06:44

to overcrowd the MCU it's going to get

play06:46

slower and slower and it's going to

play06:48

start kicking errors it has a limited

play06:51

speed and we need to be mindful of

play06:55

this but we'll talk about this a bit

play06:58

later possibly

play07:00

in another

play07:02

tutorial right now though I'd like to

play07:04

speak about the naming

play07:07

convention and you will see it later I'm

play07:10

just going to put

play07:12

up a uh the convention on the screen for

play07:16

you to

play07:19

see and then I'll take it out you'll see

play07:22

it later this is my naming convention

play07:25

every ID will have the device name which

play07:28

is the name that we will have here and

play07:32

then the Sens the sensor name is

play07:35

followed by that it's underscore sensor

play07:39

underscore

play07:40

name so a temperature sensor would be

play07:45

Dollar open curly brackets device name

play07:48

close curly brackets underscore

play07:51

temperature okay let's move on from

play07:53

there next we're going to talk about

play07:56

globals unlik substitutions which is set

play07:59

it once and then you can't anymore you

play08:02

can change globals throughout the

play08:05

code that can be very useful I'm going

play08:08

to use Wi-Fi as an

play08:11

example and it might not be the greatest

play08:13

of the example but at least it initiates

play08:17

it as false and that the log can be very

play08:20

useful now a place where actually two

play08:25

places where this could be very useful

play08:27

are number one to set a state of a

play08:33

sensor instead of getting an unknown or

play08:36

unavailable you will get something that

play08:38

makes sense the second one is to use

play08:41

into internal

play08:44

automations ESP home is capable of doing

play08:47

internal

play08:48

automations so we can leverage from that

play08:51

and you're going to ask me okay fine why

play08:54

would you want to do an automation

play08:56

inside of ESP home when you've got home

play09:00

assistant that can do all of that well

play09:02

it's very

play09:04

simple imagine you've got a door lock

play09:07

with an NFC

play09:10

tag if home assistant for some odat

play09:13

reason is

play09:14

offline and your automation to open the

play09:18

door when it recognizes a specific tag

play09:22

is on home assistant what will happen it

play09:26

won't open because home assistant is

play09:29

offline but now imagine that the same

play09:32

microprocessor is controlling both the

play09:35

NFC Reader and the

play09:38

lock and it has the ability to recognize

play09:42

that that NFC tag can open the lock well

play09:48

you still can get into your house

play09:51

because it has the ability to do so so

play09:54

these are fairly important things to

play09:57

think about when you start building your

play10:00

ESP home device next is board

play10:04

configuration the short about the board

play10:07

configuration is we are going to give it

play10:10

a name and then we going to give it what

play10:13

microprocessor and on which

play10:16

board now it might not be something that

play10:19

you think a lot about a lot of people

play10:21

will just put the standard uh board in

play10:25

there I don't so first we're going to

play10:30

put in the basic board configuration

play10:34

which you've seen a great many time and

play10:37

that is the name and the friendly name

play10:41

now we haven't changed the name and the

play10:43

friendly name to what it's supposed to

play10:45

be so I'm going to quickly do this and

play10:48

I'll see you right afterwards a few

play10:51

moments

play10:52

later I've uh changed the name and a

play10:56

little note about um my changes here you

play11:00

will see that everything is prefixed

play11:02

with ESP home and you might think to

play11:04

yourself well that's pretty obvious you

play11:07

are in ESP home after all you know it's

play11:10

an ESP home device the problem that I

play11:13

face often is when I go and search for

play11:16

that specific device inside of the

play11:20

developer tools it's easier for me to

play11:23

know that it is an ESP home device

play11:25

because it goes and puts itself a bit

play11:28

everywhere so I can start looking for

play11:30

all ESP home devices and pick the one

play11:33

that I want we talked about the second

play11:35

part of the board configuration which is

play11:38

currently missing and this is why we've

play11:39

got these squiggly red lines there but

play11:42

before I do I want to just touch on a

play11:45

couple of things regarding

play11:47

espo espo has two Frameworks one of them

play11:51

is the Arduino framework they're

play11:54

actually the one that I started using

play11:56

originally when I was Ling around with

play11:59

these things just over a year

play12:02

ago and the second one is the ESP IDF

play12:06

which I recently started using for some

play12:09

little projects also there are only five

play12:13

platforms that we can use inside of ESP

play12:16

home currently the

play12:19

ESP

play12:21

8266

play12:23

thep 32 and all of its variants the rp2

play12:29

4 which is the Raspberry Pi Pico this is

play12:33

still in

play12:34

development so there are a lot of things

play12:36

there that I'm

play12:37

missing having said that I have a fully

play12:42

functional a fully functional device

play12:45

with um light sensors humidity sensor

play12:49

temperature sensor presence sensor and

play12:52

even a screen moving along there is the

play12:54

beckon from

play12:56

libertiny and there is the real Tech

play12:59

from Li Libra tiny I will not talk about

play13:03

those at this point in time I haven't

play13:05

had time to play around with them I

play13:08

think I may have one device that can

play13:11

actually take one of those two there is

play13:14

also the framework now the framework I

play13:17

would leave to recommend it except that

play13:19

in some cases for me I've had to push it

play13:23

above what recommended is now I don't

play13:26

know which one is recommended right now

play13:28

but I know that I had to push to

play13:31

2 I can't remember it was 2.9 or 09 or

play13:36

something like that and it had to do

play13:39

with the way that the screens

play13:42

work so leave it to recommend it if that

play13:46

works it works otherwise go and check

play13:49

what the latest one is and put that

play13:53

lastly I want to explain to you what

play13:57

this platform actually

play14:00

do it will

play14:03

Define the board and when I say it will

play14:07

Define the board it will Define the MCU

play14:09

type so for example in the SP 32s there

play14:13

are a few there is telica extension

play14:16

there is arm there is risk and there is

play14:19

risk

play14:21

five it will also Define how much SRAM

play14:25

or memory there is it can also in some

play14:29

cases even Define how much PS rank which

play14:33

is extra memory which is required to run

play14:37

a display in some

play14:39

cases which wi-fi type so is it WiFi 4

play14:43

WiFi 4.1 y55 or whatever the case might

play14:48

be the

play14:50

Bluetooth again same story is that

play14:52

Bluetooth 4 Bluetooth 5 whatever the

play14:56

story may be with that specific

play14:59

microprocessor also what built-in

play15:01

sensors there are for example there is a

play15:04

built-in sensor in the PCO that doesn't

play15:07

exist in the ASP

play15:09

32s in the ASP 32s temperature will

play15:13

actually give you the temperature of the

play15:15

ESP 32

play15:17

microcontroller there is an actual

play15:20

temperature sensor on the peod that you

play15:23

can

play15:25

access and that will give you

play15:27

Environmental

play15:29

temperature it will also give you how

play15:33

many spis to I no

play15:36

i2c

play15:38

i2s and art you have available to you it

play15:42

will also Define the GPI op pins which

play15:47

one you can use which one you can't use

play15:49

which ones are for SPI use which ones

play15:52

are i2c and so forth and that was just

play15:55

to mention a few things so I do

play16:00

generally try to get the right board and

play16:03

if you want me to expand on that please

play16:07

leave a comment below and I will show

play16:09

you where I find these things in a

play16:13

quickie okay so let's move on here it is

play16:16

esp32 the board is an esp32 Dev which is

play16:20

this and the framework is are Doo now

play16:25

there are a couple of things about IDF

play16:27

and R doino that I need to quickly cheat

play16:29

about and that has to do with certain

play16:32

things are not compatible with the other

play16:35

I know that for example the web server

play16:38

will work fine on the Arduino framework

play16:43

but not on the um ESP

play16:48

IDF so or I should say the IDF framework

play16:53

so you got

play16:55

to know these little quotes uh I I do

play16:58

believe that in the case of the web

play17:01

server it has been orted I think

play17:05

that nabasa is trying to get the two of

play17:09

them uh aligned funny enough the Arduino

play17:13

framework for

play17:15

esp32 is based on the IDF framework the

play17:20

next piece is logging now I'm not going

play17:22

to hop much around logging

play17:25

because well we're trying to limit our

play17:28

time here here and this is possibly

play17:30

going to be a long video loging and you

play17:34

will see there is a lot of

play17:36

options now I do not put this as a

play17:39

standard on my devices but I wanted to

play17:43

talk about it nevertheless there are

play17:45

different login levels that exist and

play17:48

you can go to the SP home documentation

play17:52

to find that info is in between so it's

play17:57

not verbos or varibles and it's not just

play18:02

you know sensor data if there is an

play18:05

error it will show it at

play18:07

N4 having said that you don't need all

play18:11

of

play18:12

that this is perfectly fine because that

play18:17

is the default for info the next one

play18:20

that we're going to tackle is the home

play18:22

assistant API and there I have a few

play18:24

things to say recently I had a question

play18:27

on my

play18:28

personal uh GitHub regarding this and

play18:32

the question was why can't I get any

play18:35

data on my ESP home from home assistant

play18:39

and this is why if this is not right if

play18:43

this is not

play18:45

correct if you do not have an NP an API

play18:48

key you will not talk to home home

play18:51

assistant so you will not be able to

play18:55

extract information out of home

play18:57

assistant you will not be able ble to

play18:58

synchronize the time from home assistant

play19:02

in fact yes it will see it but you won't

play19:06

be able to initialize it properly in

play19:08

home assistant I think I've covered that

play19:11

quite well and the code is very simple

play19:15

API reboot Time Out is 0 seconds so

play19:19

basically it will try to get as soon as

play19:23

possible a connection with home

play19:26

assistant the encryption Keys over there

play19:29

and we've talked about key exclamation

play19:33

mark secret API encryption key in the

play19:36

past it's in the secret in the secret

play19:39

file and as I've told you I do not use

play19:43

multiple keys I use a single key for all

play19:46

of my devices a single password for all

play19:49

of my

play19:50

devices and this is just because I can't

play19:55

be bothered

play19:56

remembering 30 devices

play20:00

passwords okay so don't worry about the

play20:03

squiggly lines they will disappear in

play20:05

time it has to do with the fact that

play20:07

there are other things that I'm missing

play20:09

like

play20:10

Wi-Fi so we'll move on and I'm going to

play20:14

talk a bit about over thee a updates

play20:18

they will disappear in good time this is

play20:21

possibly why I absolutely love ESP home

play20:25

over the air updates actually prevents

play20:28

small gray hair and as you can see I've

play20:31

got my share of those first of all we

play20:33

enforce safe mode what happens is that

play20:36

once it has acquired the update what it

play20:40

will do is that it will reboot into safe

play20:43

mode cancelling all connections

play20:46

canceling all unnecessary goodies and it

play20:50

will focus on updating itself once it's

play20:54

updated itself it will immediately

play20:56

reboot but in the event that that it

play20:58

doesn't we're going to put a reboot time

play21:00

out of 10

play21:02

minutes that will restore the old

play21:05

version reconnect and we can try to rep

play21:07

push

play21:09

again that's assuming nothing is

play21:11

corrupted in between the number of

play21:14

attempts would be five so it's going to

play21:16

try five times to do the updates before

play21:21

it gives

play21:23

up the password well I use the same

play21:26

password than my web server

play21:28

there you are now you know everything

play21:31

again all my devices use the same

play21:34

passwords there is a reason for that my

play21:37

brain is not meant to remember all those

play21:40

passwords and they are highly

play21:42

complicated trust me I use

play21:45

16 characters with special characters

play21:48

with numbers with whatever else you can

play21:51

think now comes the big one Wi-Fi and as

play21:56

I say in my notes what would be an iot

play21:59

device andet of

play22:01

things if it wasn't connected to a

play22:04

network well it would be pretty useless

play22:06

some of the examples of connectivity

play22:09

that we've got available to us on the

play22:13

esp32 and inside of ESP home are

play22:18

Wi-Fi Bluetooth ethernet Lura zigby RF I

play22:25

haven't used Laura zigby and RF inside

play22:27

of

play22:29

ESP home but I do believe it's possible

play22:32

I haven't used ethernet but it is part

play22:35

of the cor networking system of ESP so

play22:38

I'm not confir I'm not worried about

play22:40

that so let me show you the

play22:42

configuration first here it is before we

play22:45

even look at what's below here and the

play22:49

only part that you really need is this

play22:51

section so Wi-Fi network the SSID would

play22:55

be your Wi-Fi access point name a

play22:57

password obviously for that Wi-Fi AP so

play23:01

if you use it like this DHCP will then

play23:05

give it an IP address you will have to

play23:07

go to the logs to go and check that IP

play23:09

address now I keep all of my IP

play23:12

addresses in a spreadsheet and I know

play23:15

where every single one of my devices is

play23:18

and what it is that allows me to also

play23:21

troubleshoot my network should there be

play23:23

a problem this is why I use manual IP

play23:27

addresses

play23:29

because I know where the device is I

play23:31

know what it does and I can also know if

play23:34

something is trying to intrude in my

play23:36

network so here we are this is my

play23:39

Foundation configuration for Wi-Fi

play23:43

although I need to be honest with you

play23:46

because my devices do not go outside of

play23:49

my network I do not use DNS I seem to to

play23:53

have a problem device IP address is not

play23:57

recognized what have I done oh you see

play24:00

device IP address is

play24:02

incorrect I completely forgot to update

play24:05

it and I hope you are all screaming at

play24:07

me so it will be zero and for today

play24:09

we'll use

play24:11

160 and I'm going to go back over here

play24:14

and all the squiggly lines are gone

play24:17

because N is a network let's talk about

play24:20

the next block

play24:23

here which would be the AP

play24:26

block could it fail to connect to you a

play24:30

valid and known access

play24:33

point what it will do then it will

play24:36

become an access point that you can

play24:38

connect to and the SSID is in

play24:42

correct so I'm going to go and correct

play24:45

it give me a second a little longer than

play24:48

a few minutes

play24:50

later all fixed as you see I'm using one

play24:55

of those substitutions in this case

play24:57

which is the Wi-Fi name to come back to

play24:59

what I was trying to

play25:01

say in the

play25:03

event that it cannot access

play25:06

a access point a Wi-Fi access point it

play25:10

will then become an access point itself

play25:13

that you can connect to now there is a

play25:15

caveat here don't try to use this with a

play25:19

Pico it just doesn't work

play25:22

properly in fact with the picco the

play25:25

captive portal doesn't work either

play25:28

what the captive portal does is it

play25:30

allows you to

play25:32

set a access point so you could

play25:37

theoretically not have any Wi-Fi details

play25:40

whatsoever I've never tried I'll be

play25:43

honest but no Wi-fi detail whatsoever

play25:47

and just use the captive portal to set

play25:49

your Wi-Fi details and voila so that's

play25:52

for the Wi-Fi I think I've covered most

play25:55

of the things oh yes let me check my

play25:59

notes I have forgotten one thing if it

play26:02

goes into captive portal you'll have to

play26:05

connect to it using the Wi-Fi details

play26:08

that you have set

play26:10

here in the

play26:12

AP so the SS ID would be would become

play26:17

basically the name of the

play26:20

device and you would have to use that

play26:23

password to get onto the Wi-Fi and then

play26:28

you would have to go to

play26:30

http1

play26:56

192168491 picco and I have no idea if it

play27:00

works with the real teex but it works

play27:02

100% with the

play27:05

esp32 and the SP

play27:08

8266 a little thing about the web server

play27:11

number one the port is 80 which is a

play27:13

standard HTTP Port we're running version

play27:16

two we are

play27:18

including the internal

play27:21

variables now the internal variables are

play27:24

not reported back to home assistant but

play27:27

there are reported back to the web

play27:30

server so it's an extra little thing to

play27:33

allow you to diagnose your problem

play27:35

obviously there has to be authentication

play27:37

to get into it username and password and

play27:40

then okay local cre is it puts the

play27:43

JavaScript onto the device why would you

play27:47

want to do that my devices do not talk

play27:50

outside the network so I want it on that

play27:53

device next is a status LED it is the T

play27:57

if it's useful or not personally I use

play28:00

it to see if it connects to the network

play28:03

properly to the Wi-Fi properly then iul

play28:06

it this is how I do it I assigned the

play28:08

pin where that specific LED is and then

play28:13

I inverted

play28:15

because I don't want to see it now it's

play28:18

odd because sometimes you have to invert

play28:20

it and sometimes you don't it depends on

play28:24

the board you'll just have to play it by

play28:26

ear and check

play28:28

usually you'll see it blink a few times

play28:30

and then go quiet you know that that

play28:33

board is a false otherwise the light

play28:36

keeps on thereafter and that's a trueth

play28:39

I will want to move on to the time now

play28:42

there are various ways to get the time

play28:44

onto your iot device these are SN

play28:48

sntp which requires internet access or

play28:52

the IP of the sntp server I do not want

play28:57

my devices to talk to the internet

play28:59

therefore this is never used the next

play29:02

one is GPS if you've got a GPS sensor

play29:06

attached to your

play29:08

esp32 you can get the time from the GPS

play29:12

another one would be RTC in the case of

play29:15

RTC or realtime clock you will require

play29:19

RTC hardware and ideally a battery to

play29:22

keep that RTC clock from drifting number

play29:25

one and from disappearing number two now

play29:28

I don't use RTC and I do know for

play29:31

example that the Pico has a built-in RTC

play29:34

if memory serves me well and I don't use

play29:36

it I don't use it for a simple reason

play29:39

home assistant gives me all of that

play29:41

information and even if home assistant

play29:43

suddenly decides to disappear the

play29:46

internal clock will still carry on as

play29:49

long as it's got power it's when it

play29:52

doesn't have power anymore that it will

play29:54

reset the code for time with home

play29:58

assistant is really straightforward

play30:01

there it is time platform home assistant

play30:04

now I want you to remember for the

play30:06

future that platform home assistant

play30:09

because it's going to be very important

play30:11

in other things that we're going to do

play30:13

like getting other information from home

play30:16

assistant to us in such a way that we

play30:18

can actually use it within ESP home for

play30:22

displays this is extremely important I

play30:25

think we've got this one down

play30:28

and I am going to then talk about our

play30:33

first real sensor and the first real

play30:36

sensor that we're going to talk about is

play30:38

a binary sensor now a binary sensor in L

play30:42

manone is on or off true or false that's

play30:47

all it does it can be very useful though

play30:50

so this binary sensor gives us the

play30:54

status of the device it's not a required

play30:57

sens answer by any means however what it

play30:59

does in nor my assistant is that if it's

play31:03

not available it will tell you FSE and

play31:06

you could kick off an automation saying

play31:08

hey I got a problem here this iot device

play31:12

is no longer with me there are there is

play31:14

value in it at the end of the day we're

play31:17

going to move on to a whole bunch of

play31:19

other sensors inside of the

play31:24

esp32 that are pretty useful they are

play31:27

focused on diagnostics and they are

play31:30

focused on things that will give us the

play31:32

ability to troubleshoot the first one of

play31:35

these has got to do with Wi-Fi this is

play31:38

my sensor section and the first one is

play31:41

Wi-Fi signal how is that useful to us

play31:44

well if it's too far away the signal

play31:46

will not be strong enough and just to

play31:49

give you an idea I have a little list

play31:51

because I do not remember this off the

play31:54

top of my head but

play31:57

in short and maybe uh I will put

play32:01

it over there anything that is greater

play32:04

than minus 50 dbm is excellent anything

play32:08

that's in between minus 50 and - 60 dbm

play32:12

is good anything that is in between - 60

play32:16

and

play32:17

-70 is fair and anything that is below

play32:21

minus 70 is poor this was our first one

play32:25

the next one is a bit more complex at it

play32:28

first I'm going to give you the very

play32:30

basic of it up time now up time is I

play32:33

started 5 days ago and I'm still going

play32:36

strong this is what that sensor gives

play32:39

you but it gives it to you in seconds

play32:42

now I

play32:43

have some of my sensors that have been

play32:46

running non-stop for I don't know how

play32:49

many thousands and tens of thousands of

play32:51

seconds do you think that I know how

play32:53

many days that is yes I could go and

play32:56

punch it and calculate

play32:57

sure but to be honest with you there's

play33:00

code for that and let me give it to you

play33:02

now there we are it's failing let me

play33:05

tell you why it's trying to publish the

play33:08

state here to this sensor and this

play33:13

sensor over there doesn't exist yet so

play33:16

again just to tell you how far they've

play33:18

gone with the editor of ESP home again

play33:22

it shows us quickly n something is wrong

play33:25

we're not too worried about that right

play33:26

now

play33:28

this

play33:30

here is the state that is going to send

play33:33

back and you can see we're getting this

play33:37

the seconds translated to days the

play33:40

seconds translated to hours the seconds

play33:43

translated to minutes and with that it

play33:46

becomes far easier to read and I'll show

play33:50

you that a little later let's move on

play33:52

and let's talk about another type of

play33:55

sensor which is the text sensor now the

play33:58

text sensor gives you output text

play34:02

whereas the sensor can output

play34:06

integers cannot put dates which is

play34:09

technically an integer cannot put a few

play34:12

other things now text sensors are

play34:16

slightly different as I said they output

play34:20

text now what why would you want to add

play34:23

text well let's take the Wi-Fi

play34:26

information

play34:27

for example we would want to know which

play34:30

IP address we are

play34:32

on which access point we are connected

play34:37

to and even the MAC address now why

play34:40

would you want to know the MAC address

play34:43

well if you don't want to assign an IP

play34:46

address inside of espo itself you could

play34:50

go to DHCP server and assign the address

play34:53

then to be able to assign an address on

play34:56

the hcp server you need the MAC address

play35:00

so let me show you this

play35:03

code there is the code text

play35:08

sensor and as promised the first part of

play35:12

it is the Wi-Fi information including

play35:15

the IP address the connected SS ID and

play35:18

the MAC address the second part of the

play35:21

teex sensor here is the ESP home

play35:25

version not strictly

play35:27

needed but it's nice to know on which

play35:30

version you are I have some devices that

play35:34

are not up to date and uh

play35:38

yes espon will tell you so but you can

play35:41

also report it inside of Home assistant

play35:43

and say whoa I do not have that done I

play35:47

don't have an automation that does that

play35:49

but it does help me

play35:51

knowing where I am in the

play35:55

updates and lastly we've got another one

play35:58

that I was talking about earlier and

play36:01

that would be the uptime human reible

play36:03

sensor and where do have we heard from

play36:06

that

play36:07

before right here this is the one that

play36:11

we are using so now we've got that

play36:13

sensor as well and there is just a

play36:17

couple more and I'm hoping that this

play36:19

video will not be too long for the next

play36:21

one is our default switches which are

play36:25

switches that are part of the ESP 32 and

play36:29

this SW these switches are restart and

play36:32

restart into safe mode now restart can

play36:36

be useful in some conditions

play36:38

particularly if you want to be able to

play36:40

restart from home system restart in safe

play36:43

mode will help you troubleshoot

play36:47

things I've never hate to use it but I'd

play36:50

rather be save then sorry by the way if

play36:53

you ever wonder what anything is for

play36:55

there is a little T

play36:57

hover over it it will tell you as I say

play37:02

they've got an they've done an amazing

play37:05

job on the documentation but also

play37:07

they've done an amazing job with the

play37:11

editor the last piece is the

play37:14

intervals again strict not strictly

play37:17

needed I use it for the Wi-Fi so as

play37:20

you've seen earlier the Wi-Fi was set to

play37:23

false initially and what this does is

play37:26

that it checks the connection all the

play37:29

time so are we connected are we not

play37:32

connected are we connected are we not

play37:34

connected and it sets it accordingly

play37:37

that's all this does that's the entire

play37:40

usefulness of this and again this is

play37:44

useful when you've got a screen not so

play37:47

useful without it that concludes the

play37:49

configuration file now we need to

play37:52

compile it we need to see if the debug

play37:55

works then we need to add it to home

play37:57

assistant and see if it works in home

play37:59

assistant so let's compile

play38:06

it first things first let's make sure

play38:09

that the device is plugged in sorry it

play38:11

doesn't Focus let's hit

play38:15

install and like I showed you previously

play38:19

plugged into this computer and it will

play38:21

tell us that ESP home is not running in

play38:25

HTTPS but it will still compile it and

play38:30

it takes a minute I will Fast Forward a

play38:33

little longer than a few minutes

play38:36

later it has compiled we can download

play38:39

the

play38:40

project here we go it's now

play38:43

downloaded we can open ESP home and you

play38:47

will see this is https web ESP home.io

play38:51

so it's https therefore it should work

play38:55

we are going to to

play38:57

connect again you can see it's the USB 2

play39:02

serial we're in and we're going to say

play39:07

install we're going to click

play39:10

on the uh Bin file the firmware drag it

play39:15

and drop it and we're going to say

play39:19

install again this might take a

play39:22

second but I love about this is

play39:24

obviously that it's erasing it first

play39:26

I'll fast forward through this a few

play39:29

moments

play39:31

later well it is finished installing

play39:34

we're going to close this and we are

play39:38

going to close espb home and we're going

play39:40

to close this and we're going to close

play39:43

this and we are going to wait for a

play39:45

second and we are now online first thing

play39:48

that we do is we check out the logs so

play39:51

we are online everything is working and

play39:53

there is the First Data sent it will

play39:55

send it at the regular interval now I'm

play39:58

going to visit and make sure that the

play39:59

web server is

play40:02

working as I've said they all have the

play40:04

same password but it is a complex

play40:09

password you can see relatively

play40:12

long and like last time we've actually

play40:15

got data now we know that we are logged

play40:18

on to an AP called v9- iot we know that

play40:24

we've got ESP home version

play40:27

23129 we know that we are running on IP

play40:29

address

play40:32

192.168.0.1 16 I'm not going to read the

play40:35

MAC address but we have two switches one

play40:39

of them is called restart and the other

play40:41

one is safe mode up time is 1 minute 49

play40:45

seconds and you can see the uptime

play40:47

sensor is at 109 seconds lastly we've

play40:52

got the Wi-Fi signal sensor which is

play40:54

sitting at 51

play40:56

dbm now if I check my list 51

play41:02

dbm is good and then we can also send a

play41:07

file for update and over here we've got

play41:10

our logs being sent we will then close

play41:15

this and we'll go to device and services

play41:18

it hasn't picked it up so what do we do

play41:21

in a case like

play41:23

that well let me show you we go go to

play41:26

ESP

play41:30

home and it's going to ask what host and

play41:34

our host here is 1

play41:39

192.168.0.1 and we said

play41:42

60 this is where the magic happens the

play41:45

encryption key without that encryption

play41:49

key home assistant will not talk to the

play41:51

ESP home device will not take talk to

play41:53

the home assistant device so I'm going

play41:55

to have to go and get that offline I'll

play41:59

see you once I've got it a few moments

play42:03

later I entered my API key and I clicked

play42:07

save and here we are what area are we in

play42:11

now this is a foundation device this was

play42:13

a demonstration so I'm not going to put

play42:15

an area to it I will talk about areas in

play42:18

a future tutorial I'm going to say

play42:23

finish and now we are going to have an

play42:27

ESP home

play42:29

device inserted over here and we can see

play42:34

there is one device with one entity now

play42:36

if you ever end end up in this situation

play42:39

where there is one device with one

play42:41

entity there is only one thing that I

play42:44

can recommend to you is to wait for a

play42:47

minute and once you've waited for that

play42:49

minute go

play42:50

back and

play42:53

refresh and voila we now have it inside

play42:59

of Home

play43:05

assistant let us recap what we've

play43:07

learned today we've learned what we

play43:09

should be putting on every ESP home

play43:12

device it's not a complete and

play43:14

exhaustive list however it's a good

play43:17

start we've compiled it we've checked

play43:19

the web server and we add it to home

play43:23

assistant I think that wraps off

play43:26

today's video but before I do a few

play43:29

things more I'll explain the issues with

play43:34

the web server and hi it clashes with

play43:37

other sensors in my next long form

play43:40

tutorial this starting configuration has

play43:43

never let me

play43:44

down so use it don't use it that's your

play43:48

choice I wrap it off here to make sure

play43:51

that you don't miss any of my tutorial

play43:54

will you

play43:55

please click the like button to let me

play43:57

know that you like what I do

play44:01

subscribe and if you really want to know

play44:04

when the when the next one is out hit

play44:08

the notification Bell this is Pascal

play44:11

signing off see you in the next

play44:14

[Music]

play44:19

one

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
ESP HomeIoT DevicesConfiguration GuideTroubleshootingMinimalismESP32WiFi SetupHome AssistantOTA UpdatesCoding Tutorial