ESPHome
2024.11.0
esphome
esphome
components
demo
demo_number.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/component.h
"
4
#include "
esphome/components/number/number.h
"
5
6
namespace
esphome
{
7
namespace
demo {
8
9
enum class
DemoNumberType
{
10
TYPE_1
,
11
TYPE_2
,
12
TYPE_3
,
13
};
14
15
class
DemoNumber
:
public
number::Number
,
public
Component
{
16
public
:
17
void
set_type
(
DemoNumberType
type
) { type_ =
type
; }
18
void
setup
()
override
{
19
switch
(type_) {
20
case
DemoNumberType::TYPE_1
:
21
this->publish_state(50);
22
break
;
23
case
DemoNumberType::TYPE_2
:
24
this->publish_state(-10);
25
break
;
26
case
DemoNumberType::TYPE_3
:
27
this->publish_state(42);
28
break
;
29
}
30
}
31
32
protected
:
33
void
control
(
float
value)
override
{ this->publish_state(value); }
34
35
DemoNumberType
type_
;
36
};
37
38
}
// namespace demo
39
}
// namespace esphome
esphome::demo::DemoNumber::control
void control(float value) override
Definition:
demo_number.h:33
esphome::Component
Definition:
component.h:68
esphome::demo::DemoClimateType::TYPE_1
esphome::demo::DemoClimateType::TYPE_2
number.h
esphome::demo::DemoClimateType::TYPE_3
esphome::demo::DemoNumber::type_
DemoNumberType type_
Definition:
demo_number.h:35
esphome::demo::DemoNumber::setup
void setup() override
Definition:
demo_number.h:18
esphome::number::Number
Base-class for all numbers.
Definition:
number.h:39
type
uint8_t type
Definition:
e131_packet.cpp:135
esphome::demo::DemoNumberType
DemoNumberType
Definition:
demo_number.h:9
esphome::demo::DemoNumber
Definition:
demo_number.h:15
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
component.h
esphome::demo::DemoNumber::set_type
void set_type(DemoNumberType type)
Definition:
demo_number.h:17
Generated by
1.8.13