ESPHome
2025.2.2
Main Page
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
y
+
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
d
e
f
i
j
l
m
n
p
q
r
s
t
u
v
+
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
+
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
c
d
o
p
s
t
v
w
+
Enumerations
b
c
e
f
i
m
n
p
r
s
t
v
+
Enumerator
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Related Functions
+
Files
File List
+
Globals
+
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Functions
_
a
l
m
o
s
t
u
+
Variables
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
Typedefs
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Modules
Pages
esphome
esphome
components
jsn_sr04t
jsn_sr04t.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <vector>
4
5
#include "
esphome/core/component.h
"
6
#include "
esphome/components/sensor/sensor.h
"
7
#include "
esphome/components/uart/uart.h
"
8
9
namespace
esphome
{
10
namespace
jsn_sr04t {
11
12
enum
Model
{
13
JSN_SR04T
,
14
AJ_SR04M
,
15
};
16
17
class
Jsnsr04tComponent
:
public
sensor::Sensor
,
public
PollingComponent
,
public
uart::UARTDevice
{
18
public
:
19
void
set_model
(
Model
model) { this->
model_
= model; }
20
21
// ========== INTERNAL METHODS ==========
22
void
update
()
override
;
23
void
loop
()
override
;
24
void
dump_config
()
override
;
25
26
protected
:
27
void
check_buffer_
();
28
Model
model_
;
29
30
std::vector<uint8_t>
buffer_
;
31
};
32
33
}
// namespace jsn_sr04t
34
}
// namespace esphome
uart.h
esphome::jsn_sr04t::JSN_SR04T
Definition:
jsn_sr04t.h:13
esphome::PollingComponent
This class simplifies creating components that periodically check a state.
Definition:
component.h:283
esphome::jsn_sr04t::Jsnsr04tComponent::loop
void loop() override
Definition:
jsn_sr04t.cpp:17
sensor.h
esphome::jsn_sr04t::Jsnsr04tComponent::dump_config
void dump_config() override
Definition:
jsn_sr04t.cpp:59
esphome::jsn_sr04t::Jsnsr04tComponent::buffer_
std::vector< uint8_t > buffer_
Definition:
jsn_sr04t.h:30
esphome::jsn_sr04t::Model
Model
Definition:
jsn_sr04t.h:12
esphome::jsn_sr04t::Jsnsr04tComponent::model_
Model model_
Definition:
jsn_sr04t.h:28
esphome::jsn_sr04t::Jsnsr04tComponent::check_buffer_
void check_buffer_()
Definition:
jsn_sr04t.cpp:33
esphome::uart::UARTDevice
Definition:
uart.h:12
esphome::jsn_sr04t::Jsnsr04tComponent
Definition:
jsn_sr04t.h:17
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
component.h
esphome::jsn_sr04t::Jsnsr04tComponent::set_model
void set_model(Model model)
Definition:
jsn_sr04t.h:19
esphome::sensor::Sensor
Base-class for all sensors.
Definition:
sensor.h:57
esphome::jsn_sr04t::Jsnsr04tComponent::update
void update() override
Definition:
jsn_sr04t.cpp:12
esphome::jsn_sr04t::AJ_SR04M
Definition:
jsn_sr04t.h:14
Generated by
1.8.13