esphome 2024.10.3__py3-none-any.whl → 2024.11.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- esphome/__main__.py +22 -4
- esphome/automation.py +29 -2
- esphome/components/animation/__init__.py +5 -8
- esphome/components/animation/animation.cpp +1 -1
- esphome/components/audio/__init__.py +9 -0
- esphome/components/audio/audio.h +21 -0
- esphome/components/axs15231/__init__.py +6 -0
- esphome/components/axs15231/touchscreen/__init__.py +36 -0
- esphome/components/axs15231/touchscreen/axs15231_touchscreen.cpp +64 -0
- esphome/components/axs15231/touchscreen/axs15231_touchscreen.h +27 -0
- esphome/components/bme68x_bsec2/__init__.py +1 -1
- esphome/components/bytebuffer/__init__.py +5 -0
- esphome/components/bytebuffer/bytebuffer.h +421 -0
- esphome/components/climate/__init__.py +14 -13
- esphome/components/datetime/__init__.py +3 -3
- esphome/components/debug/debug_esp32.cpp +16 -8
- esphome/components/dfplayer/dfplayer.cpp +132 -6
- esphome/components/dfplayer/dfplayer.h +19 -53
- esphome/components/display/display.cpp +142 -0
- esphome/components/display/display.h +7 -0
- esphome/components/es8311/__init__.py +0 -0
- esphome/components/es8311/audio_dac.py +70 -0
- esphome/components/es8311/es8311.cpp +227 -0
- esphome/components/es8311/es8311.h +135 -0
- esphome/components/es8311/es8311_const.h +195 -0
- esphome/components/esp32/boards.py +199 -1
- esphome/components/esp32/gpio.py +3 -1
- esphome/components/esp32_ble/const_esp32c6.h +7 -0
- esphome/components/esp32_ble_client/ble_client_base.h +1 -1
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +2 -1
- esphome/components/esp32_rmt_led_strip/led_strip.cpp +2 -2
- esphome/components/esp32_rmt_led_strip/led_strip.h +2 -0
- esphome/components/esp32_rmt_led_strip/light.py +3 -1
- esphome/components/esp8266/gpio.py +7 -5
- esphome/components/ethernet/__init__.py +55 -1
- esphome/components/ethernet/ethernet_component.cpp +14 -1
- esphome/components/ethernet/ethernet_component.h +7 -1
- esphome/components/font/__init__.py +213 -108
- esphome/components/gp8403/output/__init__.py +1 -1
- esphome/components/host/gpio.py +6 -4
- esphome/components/http_request/__init__.py +12 -0
- esphome/components/http_request/http_request.h +65 -3
- esphome/components/http_request/http_request_arduino.cpp +2 -3
- esphome/components/http_request/http_request_idf.cpp +6 -14
- esphome/components/http_request/ota/ota_http_request.cpp +1 -1
- esphome/components/http_request/update/http_request_update.cpp +1 -1
- esphome/components/i2c_device/__init__.py +26 -0
- esphome/components/i2c_device/i2c_device.cpp +17 -0
- esphome/components/i2c_device/i2c_device.h +18 -0
- esphome/components/i2s_audio/__init__.py +1 -3
- esphome/components/i2s_audio/speaker/__init__.py +12 -4
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +432 -197
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +91 -32
- esphome/components/ili9xxx/display.py +5 -1
- esphome/components/image/__init__.py +5 -8
- esphome/components/image/image.cpp +14 -14
- esphome/components/image/image.h +20 -24
- esphome/components/internal_temperature/internal_temperature.cpp +51 -2
- esphome/components/internal_temperature/internal_temperature.h +1 -0
- esphome/components/libretiny/gpio.py +4 -2
- esphome/components/light/__init__.py +32 -1
- esphome/components/light/automation.py +39 -32
- esphome/components/light/effects.py +36 -36
- esphome/components/light/light_state.cpp +6 -16
- esphome/components/light/light_state.h +34 -0
- esphome/components/light/types.py +3 -1
- esphome/components/logger/logger_esp32.cpp +15 -0
- esphome/components/lvgl/__init__.py +202 -95
- esphome/components/lvgl/automation.py +42 -40
- esphome/components/lvgl/binary_sensor/__init__.py +8 -15
- esphome/components/lvgl/defines.py +14 -8
- esphome/components/lvgl/encoders.py +11 -8
- esphome/components/lvgl/keypads.py +77 -0
- esphome/components/lvgl/light/__init__.py +6 -8
- esphome/components/lvgl/lv_validation.py +2 -4
- esphome/components/lvgl/lvcode.py +3 -9
- esphome/components/lvgl/lvgl_esphome.cpp +210 -89
- esphome/components/lvgl/lvgl_esphome.h +113 -30
- esphome/components/lvgl/lvgl_proxy.h +17 -0
- esphome/components/lvgl/number/__init__.py +10 -15
- esphome/components/lvgl/schemas.py +4 -2
- esphome/components/lvgl/select/__init__.py +12 -37
- esphome/components/lvgl/select/lvgl_select.h +27 -33
- esphome/components/lvgl/sensor/__init__.py +8 -14
- esphome/components/lvgl/styles.py +3 -4
- esphome/components/lvgl/switch/__init__.py +8 -13
- esphome/components/lvgl/text/__init__.py +5 -6
- esphome/components/lvgl/text_sensor/__init__.py +15 -15
- esphome/components/lvgl/touchscreens.py +2 -3
- esphome/components/lvgl/trigger.py +7 -9
- esphome/components/lvgl/types.py +9 -3
- esphome/components/lvgl/widgets/__init__.py +32 -21
- esphome/components/lvgl/widgets/dropdown.py +22 -10
- esphome/components/lvgl/widgets/msgbox.py +6 -5
- esphome/components/lvgl/widgets/obj.py +4 -2
- esphome/components/lvgl/widgets/page.py +3 -2
- esphome/components/lvgl/widgets/qrcode.py +54 -0
- esphome/components/lvgl/widgets/roller.py +21 -14
- esphome/components/lvgl/widgets/tileview.py +2 -1
- esphome/components/max17043/__init__.py +1 -0
- esphome/components/max17043/automation.h +20 -0
- esphome/components/max17043/max17043.cpp +98 -0
- esphome/components/max17043/max17043.h +29 -0
- esphome/components/max17043/sensor.py +77 -0
- esphome/components/media_player/__init__.py +11 -0
- esphome/components/media_player/automation.h +10 -0
- esphome/components/media_player/media_player.cpp +4 -0
- esphome/components/midea/air_conditioner.cpp +17 -1
- esphome/components/mlx90393/sensor.py +1 -1
- esphome/components/modbus_controller/__init__.py +31 -1
- esphome/components/modbus_controller/automation.h +16 -0
- esphome/components/modbus_controller/const.py +2 -0
- esphome/components/modbus_controller/modbus_controller.cpp +14 -2
- esphome/components/modbus_controller/modbus_controller.h +9 -0
- esphome/components/mopeka_pro_check/mopeka_pro_check.cpp +40 -21
- esphome/components/mopeka_pro_check/mopeka_pro_check.h +9 -2
- esphome/components/mopeka_pro_check/sensor.py +41 -0
- esphome/components/mqtt/__init__.py +36 -0
- esphome/components/mqtt/mqtt_client.cpp +27 -3
- esphome/components/mqtt/mqtt_client.h +27 -2
- esphome/components/mqtt/mqtt_climate.cpp +4 -2
- esphome/components/mqtt/mqtt_component.cpp +6 -0
- esphome/components/mqtt/mqtt_component.h +4 -0
- esphome/components/mqtt/mqtt_const.h +6 -0
- esphome/components/online_image/online_image.cpp +2 -8
- esphome/components/online_image/online_image.h +2 -6
- esphome/components/opentherm/__init__.py +35 -9
- esphome/components/opentherm/binary_sensor/__init__.py +33 -0
- esphome/components/opentherm/const.py +11 -0
- esphome/components/opentherm/generate.py +142 -0
- esphome/components/opentherm/hub.cpp +130 -24
- esphome/components/opentherm/hub.h +62 -9
- esphome/components/opentherm/input.h +18 -0
- esphome/components/opentherm/input.py +51 -0
- esphome/components/opentherm/number/__init__.py +74 -0
- esphome/components/opentherm/number/number.cpp +40 -0
- esphome/components/opentherm/number/number.h +31 -0
- esphome/components/opentherm/opentherm.cpp +30 -0
- esphome/components/opentherm/opentherm.h +34 -2
- esphome/components/opentherm/opentherm_macros.h +151 -0
- esphome/components/opentherm/output/__init__.py +47 -0
- esphome/components/opentherm/output/output.cpp +18 -0
- esphome/components/opentherm/output/output.h +33 -0
- esphome/components/opentherm/schema.py +814 -0
- esphome/components/opentherm/sensor/__init__.py +51 -0
- esphome/components/opentherm/switch/__init__.py +43 -0
- esphome/components/opentherm/switch/switch.cpp +28 -0
- esphome/components/opentherm/switch/switch.h +20 -0
- esphome/components/opentherm/validate.py +31 -0
- esphome/components/pcd8544/display.py +8 -4
- esphome/components/prometheus/prometheus_handler.cpp +176 -14
- esphome/components/prometheus/prometheus_handler.h +25 -7
- esphome/components/qspi_amoled/display.py +1 -141
- esphome/components/qspi_dbi/display.py +185 -0
- esphome/components/qspi_dbi/models.py +64 -0
- esphome/components/{qspi_amoled/qspi_amoled.cpp → qspi_dbi/qspi_dbi.cpp} +95 -46
- esphome/components/{qspi_amoled/qspi_amoled.h → qspi_dbi/qspi_dbi.h} +26 -15
- esphome/components/rp2040/__init__.py +6 -3
- esphome/components/rp2040/gpio.py +5 -3
- esphome/components/rtttl/rtttl.cpp +4 -1
- esphome/components/rtttl/rtttl.h +1 -0
- esphome/components/sdl/sdl_esphome.cpp +22 -5
- esphome/components/sdl/sdl_esphome.h +1 -0
- esphome/components/sensor/__init__.py +18 -8
- esphome/components/sensor/filter.cpp +19 -18
- esphome/components/sensor/filter.h +9 -10
- esphome/components/sgp4x/sgp4x.cpp +40 -74
- esphome/components/sgp4x/sgp4x.h +5 -3
- esphome/components/speaker/__init__.py +51 -5
- esphome/components/speaker/automation.h +25 -0
- esphome/components/speaker/speaker.h +72 -1
- esphome/components/spi/__init__.py +15 -14
- esphome/components/spi_device/__init__.py +4 -15
- esphome/components/ssd1306_spi/display.py +6 -2
- esphome/components/ssd1322_spi/display.py +6 -2
- esphome/components/ssd1325_spi/display.py +6 -2
- esphome/components/ssd1327_spi/display.py +6 -2
- esphome/components/ssd1331_spi/display.py +6 -2
- esphome/components/ssd1351_spi/display.py +6 -2
- esphome/components/st7567_spi/display.py +6 -2
- esphome/components/st7701s/display.py +5 -1
- esphome/components/st7735/display.py +10 -5
- esphome/components/st7789v/display.py +12 -7
- esphome/components/statsd/statsd.cpp +2 -0
- esphome/components/statsd/statsd.h +2 -0
- esphome/components/sun/sun.h +3 -0
- esphome/components/tc74/__init__.py +1 -0
- esphome/components/tc74/sensor.py +32 -0
- esphome/components/tc74/tc74.cpp +68 -0
- esphome/components/tc74/tc74.h +28 -0
- esphome/components/touchscreen/__init__.py +41 -50
- esphome/components/touchscreen/touchscreen.h +4 -8
- esphome/components/udp/udp_component.cpp +6 -3
- esphome/components/udp/udp_component.h +4 -2
- esphome/components/waveshare_epaper/display.py +6 -2
- esphome/components/web_server/web_server.cpp +22 -0
- esphome/components/web_server/web_server.h +3 -0
- esphome/components/weikai/weikai.h +2 -2
- esphome/components/wifi/wifi_component.cpp +2 -2
- esphome/components/wifi/wifi_component_esp32_arduino.cpp +4 -4
- esphome/components/wifi/wifi_component_esp8266.cpp +4 -4
- esphome/components/wifi/wifi_component_esp_idf.cpp +2 -2
- esphome/components/xpt2046/touchscreen/__init__.py +7 -32
- esphome/config_validation.py +3 -1
- esphome/const.py +8 -1
- esphome/core/defines.h +8 -2
- esphome/core/helpers.cpp +32 -17
- esphome/core/helpers.h +32 -16
- esphome/core/ring_buffer.cpp +2 -2
- esphome/core/ring_buffer.h +2 -2
- esphome/dashboard/core.py +25 -0
- esphome/dashboard/status/mdns.py +3 -4
- esphome/dashboard/web_server.py +54 -19
- esphome/espota2.py +36 -35
- esphome/helpers.py +68 -16
- esphome/mqtt.py +9 -2
- esphome/storage_json.py +4 -0
- esphome/writer.py +7 -18
- esphome/zeroconf.py +8 -6
- {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/METADATA +7 -5
- {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/RECORD +226 -180
- esphome/core/bytebuffer.cpp +0 -167
- esphome/core/bytebuffer.h +0 -144
- /esphome/components/{qspi_amoled → qspi_dbi}/__init__.py +0 -0
- {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/LICENSE +0 -0
- {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/WHEEL +0 -0
- {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/entry_points.txt +0 -0
- {esphome-2024.10.3.dist-info → esphome-2024.11.0b1.dist-info}/top_level.txt +0 -0
@@ -60,54 +60,72 @@ class PrometheusHandler : public AsyncWebHandler, public Component {
|
|
60
60
|
protected:
|
61
61
|
std::string relabel_id_(EntityBase *obj);
|
62
62
|
std::string relabel_name_(EntityBase *obj);
|
63
|
+
void add_area_label_(AsyncResponseStream *stream, std::string &area);
|
64
|
+
void add_node_label_(AsyncResponseStream *stream, std::string &node);
|
65
|
+
void add_friendly_name_label_(AsyncResponseStream *stream, std::string &friendly_name);
|
63
66
|
|
64
67
|
#ifdef USE_SENSOR
|
65
68
|
/// Return the type for prometheus
|
66
69
|
void sensor_type_(AsyncResponseStream *stream);
|
67
70
|
/// Return the sensor state as prometheus data point
|
68
|
-
void sensor_row_(AsyncResponseStream *stream, sensor::Sensor *obj
|
71
|
+
void sensor_row_(AsyncResponseStream *stream, sensor::Sensor *obj, std::string &area, std::string &node,
|
72
|
+
std::string &friendly_name);
|
69
73
|
#endif
|
70
74
|
|
71
75
|
#ifdef USE_BINARY_SENSOR
|
72
76
|
/// Return the type for prometheus
|
73
77
|
void binary_sensor_type_(AsyncResponseStream *stream);
|
74
78
|
/// Return the sensor state as prometheus data point
|
75
|
-
void binary_sensor_row_(AsyncResponseStream *stream, binary_sensor::BinarySensor *obj
|
79
|
+
void binary_sensor_row_(AsyncResponseStream *stream, binary_sensor::BinarySensor *obj, std::string &area,
|
80
|
+
std::string &node, std::string &friendly_name);
|
76
81
|
#endif
|
77
82
|
|
78
83
|
#ifdef USE_FAN
|
79
84
|
/// Return the type for prometheus
|
80
85
|
void fan_type_(AsyncResponseStream *stream);
|
81
86
|
/// Return the sensor state as prometheus data point
|
82
|
-
void fan_row_(AsyncResponseStream *stream, fan::Fan *obj
|
87
|
+
void fan_row_(AsyncResponseStream *stream, fan::Fan *obj, std::string &area, std::string &node,
|
88
|
+
std::string &friendly_name);
|
83
89
|
#endif
|
84
90
|
|
85
91
|
#ifdef USE_LIGHT
|
86
92
|
/// Return the type for prometheus
|
87
93
|
void light_type_(AsyncResponseStream *stream);
|
88
94
|
/// Return the Light Values state as prometheus data point
|
89
|
-
void light_row_(AsyncResponseStream *stream, light::LightState *obj
|
95
|
+
void light_row_(AsyncResponseStream *stream, light::LightState *obj, std::string &area, std::string &node,
|
96
|
+
std::string &friendly_name);
|
90
97
|
#endif
|
91
98
|
|
92
99
|
#ifdef USE_COVER
|
93
100
|
/// Return the type for prometheus
|
94
101
|
void cover_type_(AsyncResponseStream *stream);
|
95
102
|
/// Return the switch Values state as prometheus data point
|
96
|
-
void cover_row_(AsyncResponseStream *stream, cover::Cover *obj
|
103
|
+
void cover_row_(AsyncResponseStream *stream, cover::Cover *obj, std::string &area, std::string &node,
|
104
|
+
std::string &friendly_name);
|
97
105
|
#endif
|
98
106
|
|
99
107
|
#ifdef USE_SWITCH
|
100
108
|
/// Return the type for prometheus
|
101
109
|
void switch_type_(AsyncResponseStream *stream);
|
102
110
|
/// Return the switch Values state as prometheus data point
|
103
|
-
void switch_row_(AsyncResponseStream *stream, switch_::Switch *obj
|
111
|
+
void switch_row_(AsyncResponseStream *stream, switch_::Switch *obj, std::string &area, std::string &node,
|
112
|
+
std::string &friendly_name);
|
104
113
|
#endif
|
105
114
|
|
106
115
|
#ifdef USE_LOCK
|
107
116
|
/// Return the type for prometheus
|
108
117
|
void lock_type_(AsyncResponseStream *stream);
|
109
118
|
/// Return the lock Values state as prometheus data point
|
110
|
-
void lock_row_(AsyncResponseStream *stream, lock::Lock *obj
|
119
|
+
void lock_row_(AsyncResponseStream *stream, lock::Lock *obj, std::string &area, std::string &node,
|
120
|
+
std::string &friendly_name);
|
121
|
+
#endif
|
122
|
+
|
123
|
+
#ifdef USE_TEXT_SENSOR
|
124
|
+
/// Return the type for prometheus
|
125
|
+
void text_sensor_type_(AsyncResponseStream *stream);
|
126
|
+
/// Return the lock Values state as prometheus data point
|
127
|
+
void text_sensor_row_(AsyncResponseStream *stream, text_sensor::TextSensor *obj, std::string &area, std::string &node,
|
128
|
+
std::string &friendly_name);
|
111
129
|
#endif
|
112
130
|
|
113
131
|
web_server_base::WebServerBase *base_;
|
@@ -1,143 +1,3 @@
|
|
1
|
-
import esphome.codegen as cg
|
2
1
|
import esphome.config_validation as cv
|
3
|
-
from esphome import pins
|
4
|
-
from esphome.components import (
|
5
|
-
spi,
|
6
|
-
display,
|
7
|
-
)
|
8
|
-
from esphome.const import (
|
9
|
-
CONF_RESET_PIN,
|
10
|
-
CONF_ID,
|
11
|
-
CONF_DIMENSIONS,
|
12
|
-
CONF_WIDTH,
|
13
|
-
CONF_HEIGHT,
|
14
|
-
CONF_LAMBDA,
|
15
|
-
CONF_BRIGHTNESS,
|
16
|
-
CONF_ENABLE_PIN,
|
17
|
-
CONF_MODEL,
|
18
|
-
CONF_OFFSET_HEIGHT,
|
19
|
-
CONF_OFFSET_WIDTH,
|
20
|
-
CONF_INVERT_COLORS,
|
21
|
-
CONF_MIRROR_X,
|
22
|
-
CONF_MIRROR_Y,
|
23
|
-
CONF_SWAP_XY,
|
24
|
-
CONF_COLOR_ORDER,
|
25
|
-
CONF_TRANSFORM,
|
26
|
-
)
|
27
2
|
|
28
|
-
|
29
|
-
|
30
|
-
qspi_amoled_ns = cg.esphome_ns.namespace("qspi_amoled")
|
31
|
-
QSPI_AMOLED = qspi_amoled_ns.class_(
|
32
|
-
"QspiAmoLed", display.Display, display.DisplayBuffer, cg.Component, spi.SPIDevice
|
33
|
-
)
|
34
|
-
ColorOrder = display.display_ns.enum("ColorMode")
|
35
|
-
Model = qspi_amoled_ns.enum("Model")
|
36
|
-
|
37
|
-
MODELS = {"RM690B0": Model.RM690B0, "RM67162": Model.RM67162}
|
38
|
-
|
39
|
-
COLOR_ORDERS = {
|
40
|
-
"RGB": ColorOrder.COLOR_ORDER_RGB,
|
41
|
-
"BGR": ColorOrder.COLOR_ORDER_BGR,
|
42
|
-
}
|
43
|
-
DATA_PIN_SCHEMA = pins.internal_gpio_output_pin_schema
|
44
|
-
|
45
|
-
|
46
|
-
def validate_dimension(value):
|
47
|
-
value = cv.positive_int(value)
|
48
|
-
if value % 2 != 0:
|
49
|
-
raise cv.Invalid("Width/height/offset must be divisible by 2")
|
50
|
-
return value
|
51
|
-
|
52
|
-
|
53
|
-
CONFIG_SCHEMA = cv.All(
|
54
|
-
display.FULL_DISPLAY_SCHEMA.extend(
|
55
|
-
cv.Schema(
|
56
|
-
{
|
57
|
-
cv.GenerateID(): cv.declare_id(QSPI_AMOLED),
|
58
|
-
cv.Required(CONF_MODEL): cv.enum(MODELS, upper=True),
|
59
|
-
cv.Required(CONF_DIMENSIONS): cv.Any(
|
60
|
-
cv.dimensions,
|
61
|
-
cv.Schema(
|
62
|
-
{
|
63
|
-
cv.Required(CONF_WIDTH): validate_dimension,
|
64
|
-
cv.Required(CONF_HEIGHT): validate_dimension,
|
65
|
-
cv.Optional(
|
66
|
-
CONF_OFFSET_HEIGHT, default=0
|
67
|
-
): validate_dimension,
|
68
|
-
cv.Optional(
|
69
|
-
CONF_OFFSET_WIDTH, default=0
|
70
|
-
): validate_dimension,
|
71
|
-
}
|
72
|
-
),
|
73
|
-
),
|
74
|
-
cv.Optional(CONF_TRANSFORM): cv.Schema(
|
75
|
-
{
|
76
|
-
cv.Optional(CONF_MIRROR_X, default=False): cv.boolean,
|
77
|
-
cv.Optional(CONF_MIRROR_Y, default=False): cv.boolean,
|
78
|
-
cv.Optional(CONF_SWAP_XY, default=False): cv.boolean,
|
79
|
-
}
|
80
|
-
),
|
81
|
-
cv.Optional(CONF_COLOR_ORDER, default="RGB"): cv.enum(
|
82
|
-
COLOR_ORDERS, upper=True
|
83
|
-
),
|
84
|
-
cv.Optional(CONF_INVERT_COLORS, default=False): cv.boolean,
|
85
|
-
cv.Optional(CONF_RESET_PIN): pins.gpio_output_pin_schema,
|
86
|
-
cv.Optional(CONF_ENABLE_PIN): pins.gpio_output_pin_schema,
|
87
|
-
cv.Optional(CONF_BRIGHTNESS, default=0xD0): cv.int_range(
|
88
|
-
0, 0xFF, min_included=True, max_included=True
|
89
|
-
),
|
90
|
-
}
|
91
|
-
).extend(
|
92
|
-
spi.spi_device_schema(
|
93
|
-
cs_pin_required=False,
|
94
|
-
default_mode="MODE0",
|
95
|
-
default_data_rate=10e6,
|
96
|
-
quad=True,
|
97
|
-
)
|
98
|
-
)
|
99
|
-
),
|
100
|
-
cv.only_with_esp_idf,
|
101
|
-
)
|
102
|
-
|
103
|
-
|
104
|
-
async def to_code(config):
|
105
|
-
var = cg.new_Pvariable(config[CONF_ID])
|
106
|
-
await display.register_display(var, config)
|
107
|
-
await spi.register_spi_device(var, config)
|
108
|
-
|
109
|
-
cg.add(var.set_color_mode(config[CONF_COLOR_ORDER]))
|
110
|
-
cg.add(var.set_invert_colors(config[CONF_INVERT_COLORS]))
|
111
|
-
cg.add(var.set_brightness(config[CONF_BRIGHTNESS]))
|
112
|
-
cg.add(var.set_model(config[CONF_MODEL]))
|
113
|
-
if enable_pin := config.get(CONF_ENABLE_PIN):
|
114
|
-
enable = await cg.gpio_pin_expression(enable_pin)
|
115
|
-
cg.add(var.set_enable_pin(enable))
|
116
|
-
|
117
|
-
if reset_pin := config.get(CONF_RESET_PIN):
|
118
|
-
reset = await cg.gpio_pin_expression(reset_pin)
|
119
|
-
cg.add(var.set_reset_pin(reset))
|
120
|
-
|
121
|
-
if transform := config.get(CONF_TRANSFORM):
|
122
|
-
cg.add(var.set_mirror_x(transform[CONF_MIRROR_X]))
|
123
|
-
cg.add(var.set_mirror_y(transform[CONF_MIRROR_Y]))
|
124
|
-
cg.add(var.set_swap_xy(transform[CONF_SWAP_XY]))
|
125
|
-
|
126
|
-
if CONF_DIMENSIONS in config:
|
127
|
-
dimensions = config[CONF_DIMENSIONS]
|
128
|
-
if isinstance(dimensions, dict):
|
129
|
-
cg.add(var.set_dimensions(dimensions[CONF_WIDTH], dimensions[CONF_HEIGHT]))
|
130
|
-
cg.add(
|
131
|
-
var.set_offsets(
|
132
|
-
dimensions[CONF_OFFSET_WIDTH], dimensions[CONF_OFFSET_HEIGHT]
|
133
|
-
)
|
134
|
-
)
|
135
|
-
else:
|
136
|
-
(width, height) = dimensions
|
137
|
-
cg.add(var.set_dimensions(width, height))
|
138
|
-
|
139
|
-
if lamb := config.get(CONF_LAMBDA):
|
140
|
-
lambda_ = await cg.process_lambda(
|
141
|
-
lamb, [(display.DisplayRef, "it")], return_type=cg.void
|
142
|
-
)
|
143
|
-
cg.add(var.set_writer(lambda_))
|
3
|
+
CONFIG_SCHEMA = cv.invalid("The qspi_amoled component has been renamed to qspi_dbi")
|
@@ -0,0 +1,185 @@
|
|
1
|
+
from esphome import pins
|
2
|
+
import esphome.codegen as cg
|
3
|
+
from esphome.components import display, spi
|
4
|
+
import esphome.config_validation as cv
|
5
|
+
from esphome.const import (
|
6
|
+
CONF_BRIGHTNESS,
|
7
|
+
CONF_COLOR_ORDER,
|
8
|
+
CONF_DIMENSIONS,
|
9
|
+
CONF_ENABLE_PIN,
|
10
|
+
CONF_HEIGHT,
|
11
|
+
CONF_ID,
|
12
|
+
CONF_INIT_SEQUENCE,
|
13
|
+
CONF_INVERT_COLORS,
|
14
|
+
CONF_LAMBDA,
|
15
|
+
CONF_MIRROR_X,
|
16
|
+
CONF_MIRROR_Y,
|
17
|
+
CONF_MODEL,
|
18
|
+
CONF_OFFSET_HEIGHT,
|
19
|
+
CONF_OFFSET_WIDTH,
|
20
|
+
CONF_RESET_PIN,
|
21
|
+
CONF_SWAP_XY,
|
22
|
+
CONF_TRANSFORM,
|
23
|
+
CONF_WIDTH,
|
24
|
+
)
|
25
|
+
from esphome.core import TimePeriod
|
26
|
+
|
27
|
+
from .models import DriverChip
|
28
|
+
|
29
|
+
DEPENDENCIES = ["spi"]
|
30
|
+
|
31
|
+
qspi_dbi_ns = cg.esphome_ns.namespace("qspi_dbi")
|
32
|
+
QSPI_DBI = qspi_dbi_ns.class_(
|
33
|
+
"QspiDbi", display.Display, display.DisplayBuffer, cg.Component, spi.SPIDevice
|
34
|
+
)
|
35
|
+
ColorOrder = display.display_ns.enum("ColorMode")
|
36
|
+
Model = qspi_dbi_ns.enum("Model")
|
37
|
+
|
38
|
+
COLOR_ORDERS = {
|
39
|
+
"RGB": ColorOrder.COLOR_ORDER_RGB,
|
40
|
+
"BGR": ColorOrder.COLOR_ORDER_BGR,
|
41
|
+
}
|
42
|
+
DATA_PIN_SCHEMA = pins.internal_gpio_output_pin_schema
|
43
|
+
|
44
|
+
CONF_DRAW_FROM_ORIGIN = "draw_from_origin"
|
45
|
+
DELAY_FLAG = 0xFF
|
46
|
+
|
47
|
+
|
48
|
+
def validate_dimension(value):
|
49
|
+
value = cv.positive_int(value)
|
50
|
+
if value % 2 != 0:
|
51
|
+
raise cv.Invalid("Width/height/offset must be divisible by 2")
|
52
|
+
return value
|
53
|
+
|
54
|
+
|
55
|
+
def map_sequence(value):
|
56
|
+
"""
|
57
|
+
The format is a repeated sequence of [CMD, <data>] where <data> is s a sequence of bytes. The length is inferred
|
58
|
+
from the length of the sequence and should not be explicit.
|
59
|
+
A delay can be inserted by specifying "- delay N" where N is in ms
|
60
|
+
"""
|
61
|
+
if isinstance(value, str) and value.lower().startswith("delay "):
|
62
|
+
value = value.lower()[6:]
|
63
|
+
delay = cv.All(
|
64
|
+
cv.positive_time_period_milliseconds,
|
65
|
+
cv.Range(TimePeriod(milliseconds=1), TimePeriod(milliseconds=255)),
|
66
|
+
)(value)
|
67
|
+
return [delay, DELAY_FLAG]
|
68
|
+
value = cv.Length(min=1, max=254)(value)
|
69
|
+
params = value[1:]
|
70
|
+
return [value[0], len(params)] + list(params)
|
71
|
+
|
72
|
+
|
73
|
+
def _validate(config):
|
74
|
+
chip = DriverChip.chips[config[CONF_MODEL]]
|
75
|
+
if not chip.initsequence:
|
76
|
+
if CONF_INIT_SEQUENCE not in config:
|
77
|
+
raise cv.Invalid(f"{chip.name} model requires init_sequence")
|
78
|
+
return config
|
79
|
+
|
80
|
+
|
81
|
+
CONFIG_SCHEMA = cv.All(
|
82
|
+
display.FULL_DISPLAY_SCHEMA.extend(
|
83
|
+
cv.Schema(
|
84
|
+
{
|
85
|
+
cv.GenerateID(): cv.declare_id(QSPI_DBI),
|
86
|
+
cv.Required(CONF_MODEL): cv.one_of(
|
87
|
+
*DriverChip.chips.keys(), upper=True
|
88
|
+
),
|
89
|
+
cv.Optional(CONF_INIT_SEQUENCE): cv.ensure_list(map_sequence),
|
90
|
+
cv.Required(CONF_DIMENSIONS): cv.Any(
|
91
|
+
cv.dimensions,
|
92
|
+
cv.Schema(
|
93
|
+
{
|
94
|
+
cv.Required(CONF_WIDTH): validate_dimension,
|
95
|
+
cv.Required(CONF_HEIGHT): validate_dimension,
|
96
|
+
cv.Optional(
|
97
|
+
CONF_OFFSET_HEIGHT, default=0
|
98
|
+
): validate_dimension,
|
99
|
+
cv.Optional(
|
100
|
+
CONF_OFFSET_WIDTH, default=0
|
101
|
+
): validate_dimension,
|
102
|
+
}
|
103
|
+
),
|
104
|
+
),
|
105
|
+
cv.Optional(CONF_TRANSFORM): cv.Schema(
|
106
|
+
{
|
107
|
+
cv.Optional(CONF_MIRROR_X, default=False): cv.boolean,
|
108
|
+
cv.Optional(CONF_MIRROR_Y, default=False): cv.boolean,
|
109
|
+
cv.Optional(CONF_SWAP_XY, default=False): cv.boolean,
|
110
|
+
}
|
111
|
+
),
|
112
|
+
cv.Optional(CONF_COLOR_ORDER, default="RGB"): cv.enum(
|
113
|
+
COLOR_ORDERS, upper=True
|
114
|
+
),
|
115
|
+
cv.Optional(CONF_INVERT_COLORS, default=False): cv.boolean,
|
116
|
+
cv.Optional(CONF_RESET_PIN): pins.gpio_output_pin_schema,
|
117
|
+
cv.Optional(CONF_ENABLE_PIN): pins.gpio_output_pin_schema,
|
118
|
+
cv.Optional(CONF_BRIGHTNESS, default=0xD0): cv.int_range(
|
119
|
+
0, 0xFF, min_included=True, max_included=True
|
120
|
+
),
|
121
|
+
cv.Optional(CONF_DRAW_FROM_ORIGIN, default=False): cv.boolean,
|
122
|
+
}
|
123
|
+
).extend(
|
124
|
+
spi.spi_device_schema(
|
125
|
+
cs_pin_required=False,
|
126
|
+
default_mode="MODE0",
|
127
|
+
default_data_rate=10e6,
|
128
|
+
quad=True,
|
129
|
+
)
|
130
|
+
)
|
131
|
+
),
|
132
|
+
cv.only_with_esp_idf,
|
133
|
+
)
|
134
|
+
|
135
|
+
|
136
|
+
async def to_code(config):
|
137
|
+
var = cg.new_Pvariable(config[CONF_ID])
|
138
|
+
await display.register_display(var, config)
|
139
|
+
await spi.register_spi_device(var, config)
|
140
|
+
|
141
|
+
chip = DriverChip.chips[config[CONF_MODEL]]
|
142
|
+
if chip.initsequence:
|
143
|
+
cg.add(var.add_init_sequence(chip.initsequence))
|
144
|
+
if init_sequences := config.get(CONF_INIT_SEQUENCE):
|
145
|
+
sequence = []
|
146
|
+
for seq in init_sequences:
|
147
|
+
sequence.extend(seq)
|
148
|
+
cg.add(var.add_init_sequence(sequence))
|
149
|
+
|
150
|
+
cg.add(var.set_color_mode(config[CONF_COLOR_ORDER]))
|
151
|
+
cg.add(var.set_invert_colors(config[CONF_INVERT_COLORS]))
|
152
|
+
cg.add(var.set_brightness(config[CONF_BRIGHTNESS]))
|
153
|
+
cg.add(var.set_model(config[CONF_MODEL]))
|
154
|
+
cg.add(var.set_draw_from_origin(config[CONF_DRAW_FROM_ORIGIN]))
|
155
|
+
if enable_pin := config.get(CONF_ENABLE_PIN):
|
156
|
+
enable = await cg.gpio_pin_expression(enable_pin)
|
157
|
+
cg.add(var.set_enable_pin(enable))
|
158
|
+
|
159
|
+
if reset_pin := config.get(CONF_RESET_PIN):
|
160
|
+
reset = await cg.gpio_pin_expression(reset_pin)
|
161
|
+
cg.add(var.set_reset_pin(reset))
|
162
|
+
|
163
|
+
if transform := config.get(CONF_TRANSFORM):
|
164
|
+
cg.add(var.set_mirror_x(transform[CONF_MIRROR_X]))
|
165
|
+
cg.add(var.set_mirror_y(transform[CONF_MIRROR_Y]))
|
166
|
+
cg.add(var.set_swap_xy(transform[CONF_SWAP_XY]))
|
167
|
+
|
168
|
+
if CONF_DIMENSIONS in config:
|
169
|
+
dimensions = config[CONF_DIMENSIONS]
|
170
|
+
if isinstance(dimensions, dict):
|
171
|
+
cg.add(var.set_dimensions(dimensions[CONF_WIDTH], dimensions[CONF_HEIGHT]))
|
172
|
+
cg.add(
|
173
|
+
var.set_offsets(
|
174
|
+
dimensions[CONF_OFFSET_WIDTH], dimensions[CONF_OFFSET_HEIGHT]
|
175
|
+
)
|
176
|
+
)
|
177
|
+
else:
|
178
|
+
(width, height) = dimensions
|
179
|
+
cg.add(var.set_dimensions(width, height))
|
180
|
+
|
181
|
+
if lamb := config.get(CONF_LAMBDA):
|
182
|
+
lambda_ = await cg.process_lambda(
|
183
|
+
lamb, [(display.DisplayRef, "it")], return_type=cg.void
|
184
|
+
)
|
185
|
+
cg.add(var.set_writer(lambda_))
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Commands
|
2
|
+
SW_RESET_CMD = 0x01
|
3
|
+
SLEEP_OUT = 0x11
|
4
|
+
INVERT_OFF = 0x20
|
5
|
+
INVERT_ON = 0x21
|
6
|
+
ALL_ON = 0x23
|
7
|
+
WRAM = 0x24
|
8
|
+
MIPI = 0x26
|
9
|
+
DISPLAY_OFF = 0x28
|
10
|
+
DISPLAY_ON = 0x29
|
11
|
+
RASET = 0x2B
|
12
|
+
CASET = 0x2A
|
13
|
+
WDATA = 0x2C
|
14
|
+
TEON = 0x35
|
15
|
+
MADCTL_CMD = 0x36
|
16
|
+
PIXFMT = 0x3A
|
17
|
+
BRIGHTNESS = 0x51
|
18
|
+
SWIRE1 = 0x5A
|
19
|
+
SWIRE2 = 0x5B
|
20
|
+
PAGESEL = 0xFE
|
21
|
+
|
22
|
+
|
23
|
+
class DriverChip:
|
24
|
+
chips = {}
|
25
|
+
|
26
|
+
def __init__(self, name: str):
|
27
|
+
name = name.upper()
|
28
|
+
self.name = name
|
29
|
+
self.chips[name] = self
|
30
|
+
self.initsequence = []
|
31
|
+
|
32
|
+
def cmd(self, c, *args):
|
33
|
+
"""
|
34
|
+
Add a command sequence to the init sequence
|
35
|
+
:param c: The command (8 bit)
|
36
|
+
:param args: zero or more arguments (8 bit values)
|
37
|
+
"""
|
38
|
+
self.initsequence.extend([c, len(args)] + list(args))
|
39
|
+
|
40
|
+
def delay(self, ms):
|
41
|
+
self.initsequence.extend([ms, 0xFF])
|
42
|
+
|
43
|
+
|
44
|
+
chip = DriverChip("RM67162")
|
45
|
+
chip.cmd(PIXFMT, 0x55)
|
46
|
+
chip.cmd(BRIGHTNESS, 0)
|
47
|
+
|
48
|
+
chip = DriverChip("RM690B0")
|
49
|
+
chip.cmd(PAGESEL, 0x20)
|
50
|
+
chip.cmd(MIPI, 0x0A)
|
51
|
+
chip.cmd(WRAM, 0x80)
|
52
|
+
chip.cmd(SWIRE1, 0x51)
|
53
|
+
chip.cmd(SWIRE2, 0x2E)
|
54
|
+
chip.cmd(PAGESEL, 0x00)
|
55
|
+
chip.cmd(0xC2, 0x00)
|
56
|
+
chip.delay(10)
|
57
|
+
chip.cmd(TEON, 0x00)
|
58
|
+
|
59
|
+
chip = DriverChip("AXS15231")
|
60
|
+
chip.cmd(0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5A, 0xA5)
|
61
|
+
chip.cmd(0xC1, 0x33)
|
62
|
+
chip.cmd(0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
|
63
|
+
|
64
|
+
DriverChip("Custom")
|