ESPHome
2026.11.0-dev
Loading...
Searching...
No Matches
esphome
components
dfrobot_sen0609
button
dfrobot_sen0609_button.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/components/button/button.h
"
4
#include "
../dfrobot_sen0609.h
"
5
6
namespace
esphome::dfrobot_sen0609
{
7
8
class
DFRobotSEN0609Button
final :
public
button::Button
,
public
Parented
<DFRobotSEN0609Component> {
9
public
:
10
explicit
DFRobotSEN0609Button
(
ButtonAction
action) :
action_
(action) {}
11
12
protected
:
13
void
press_action
()
override
{
14
switch
(this->
action_
) {
15
case
BUTTON_RESTART
:
16
this->
parent_
->restart();
17
break
;
18
case
BUTTON_FACTORY_RESET
:
19
this->
parent_
->factory_reset();
20
break
;
21
case
BUTTON_QUERY_PARAMS
:
22
this->
parent_
->query_params();
23
break
;
24
}
25
}
26
27
ButtonAction
action_
;
28
};
29
30
}
// namespace esphome::dfrobot_sen0609
button.h
esphome::Parented
Helper class to easily give an object a parent of type T.
Definition
helpers.h:1997
esphome::Parented< DFRobotSEN0609Component >::parent_
DFRobotSEN0609Component * parent_
Definition
helpers.h:2008
esphome::button::Button
Base class for all buttons.
Definition
button.h:25
esphome::dfrobot_sen0609::DFRobotSEN0609Button
Definition
dfrobot_sen0609_button.h:8
esphome::dfrobot_sen0609::DFRobotSEN0609Button::action_
ButtonAction action_
Definition
dfrobot_sen0609_button.h:27
esphome::dfrobot_sen0609::DFRobotSEN0609Button::DFRobotSEN0609Button
DFRobotSEN0609Button(ButtonAction action)
Definition
dfrobot_sen0609_button.h:10
esphome::dfrobot_sen0609::DFRobotSEN0609Button::press_action
void press_action() override
Definition
dfrobot_sen0609_button.h:13
dfrobot_sen0609.h
esphome::dfrobot_sen0609
Definition
dfrobot_sen0609_button.h:6
esphome::dfrobot_sen0609::ButtonAction
ButtonAction
Definition
dfrobot_sen0609.h:64
esphome::dfrobot_sen0609::BUTTON_QUERY_PARAMS
@ BUTTON_QUERY_PARAMS
Definition
dfrobot_sen0609.h:67
esphome::dfrobot_sen0609::BUTTON_RESTART
@ BUTTON_RESTART
Definition
dfrobot_sen0609.h:65
esphome::dfrobot_sen0609::BUTTON_FACTORY_RESET
@ BUTTON_FACTORY_RESET
Definition
dfrobot_sen0609.h:66
Generated by
1.12.0