esphome 2024.9.1__py3-none-any.whl → 2024.10.0__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/components/aic3204/__init__.py +0 -0
- esphome/components/aic3204/aic3204.cpp +173 -0
- esphome/components/aic3204/aic3204.h +88 -0
- esphome/components/aic3204/audio_dac.py +52 -0
- esphome/components/aic3204/automation.h +23 -0
- esphome/components/alarm_control_panel/__init__.py +3 -4
- esphome/components/animation/__init__.py +16 -12
- esphome/components/api/api_connection.cpp +2 -0
- esphome/components/api/api_connection.h +3 -1
- esphome/components/api/api_frame_helper.cpp +2 -1
- esphome/components/api/api_frame_helper.h +2 -1
- esphome/components/api/api_server.cpp +2 -0
- esphome/components/api/api_server.h +3 -1
- esphome/components/api/custom_api_device.h +3 -2
- esphome/components/api/homeassistant_service.h +4 -3
- esphome/components/api/list_entities.cpp +2 -0
- esphome/components/api/list_entities.h +3 -2
- esphome/components/api/subscribe_state.cpp +2 -0
- esphome/components/api/subscribe_state.h +3 -2
- esphome/components/audio_dac/__init__.py +57 -0
- esphome/components/audio_dac/audio_dac.h +23 -0
- esphome/components/audio_dac/automation.h +43 -0
- esphome/components/bang_bang/bang_bang_climate.cpp +5 -2
- esphome/components/bedjet/bedjet_codec.cpp +4 -2
- esphome/components/binary_sensor/__init__.py +3 -4
- esphome/components/bl0906/sensor.py +3 -2
- esphome/components/button/__init__.py +3 -4
- esphome/components/ch422g/__init__.py +26 -17
- esphome/components/ch422g/ch422g.cpp +66 -49
- esphome/components/ch422g/ch422g.h +17 -19
- esphome/components/climate/__init__.py +3 -4
- esphome/components/cover/__init__.py +4 -5
- esphome/components/cse7766/cse7766.cpp +12 -1
- esphome/components/cse7766/cse7766.h +4 -0
- esphome/components/cse7766/sensor.py +13 -1
- esphome/components/cst816/touchscreen/__init__.py +7 -4
- esphome/components/cst816/touchscreen/cst816_touchscreen.cpp +20 -19
- esphome/components/cst816/touchscreen/cst816_touchscreen.h +2 -0
- esphome/components/datetime/__init__.py +21 -14
- esphome/components/datetime/datetime_base.h +8 -1
- esphome/components/datetime/datetime_entity.cpp +2 -0
- esphome/components/datetime/datetime_entity.h +2 -0
- esphome/components/datetime/time_entity.cpp +2 -0
- esphome/components/datetime/time_entity.h +2 -0
- esphome/components/esp32/__init__.py +20 -4
- esphome/components/esp32_improv/__init__.py +82 -1
- esphome/components/esp32_improv/automation.h +72 -0
- esphome/components/esp32_improv/esp32_improv_component.cpp +13 -5
- esphome/components/esp32_improv/esp32_improv_component.h +15 -0
- esphome/components/ethernet/__init__.py +5 -0
- esphome/components/ethernet/ethernet_component.cpp +13 -0
- esphome/components/ethernet/ethernet_component.h +1 -0
- esphome/components/event/__init__.py +20 -12
- esphome/components/fan/__init__.py +3 -4
- esphome/components/gp2y1010au0f/__init__.py +0 -0
- esphome/components/gp2y1010au0f/gp2y1010au0f.cpp +67 -0
- esphome/components/gp2y1010au0f/gp2y1010au0f.h +52 -0
- esphome/components/gp2y1010au0f/sensor.py +61 -0
- esphome/components/gpio_expander/__init__.py +0 -0
- esphome/components/gpio_expander/cached_gpio.h +38 -0
- esphome/components/grove_gas_mc_v2/__init__.py +0 -0
- esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.cpp +88 -0
- esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.h +39 -0
- esphome/components/grove_gas_mc_v2/sensor.py +77 -0
- esphome/components/haier/climate.py +4 -3
- esphome/components/haier/haier_base.cpp +63 -8
- esphome/components/haier/haier_base.h +29 -3
- esphome/components/haier/hon_climate.cpp +122 -65
- esphome/components/haier/hon_climate.h +18 -2
- esphome/components/haier/smartair2_climate.cpp +21 -21
- esphome/components/haier/switch/__init__.py +91 -0
- esphome/components/haier/switch/beeper.cpp +14 -0
- esphome/components/haier/switch/beeper.h +18 -0
- esphome/components/haier/switch/display.cpp +14 -0
- esphome/components/haier/switch/display.h +18 -0
- esphome/components/haier/switch/health_mode.cpp +14 -0
- esphome/components/haier/switch/health_mode.h +18 -0
- esphome/components/haier/switch/quiet_mode.cpp +14 -0
- esphome/components/haier/switch/quiet_mode.h +18 -0
- esphome/components/hmac_md5/hmac_md5.cpp +2 -0
- esphome/components/hmac_md5/hmac_md5.h +2 -1
- esphome/components/i2s_audio/speaker/__init__.py +19 -0
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +1 -1
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +2 -0
- esphome/components/ili9xxx/ili9xxx_display.h +1 -0
- esphome/components/image/__init__.py +12 -12
- esphome/components/image/image.cpp +44 -0
- esphome/components/image/image.h +17 -2
- esphome/components/inkplate6/display.py +2 -0
- esphome/components/inkplate6/inkplate.h +30 -2
- esphome/components/light/__init__.py +3 -4
- esphome/components/lock/__init__.py +3 -4
- esphome/components/lvgl/__init__.py +16 -5
- esphome/components/lvgl/defines.py +1 -0
- esphome/components/lvgl/hello_world.py +64 -0
- esphome/components/lvgl/lv_validation.py +159 -3
- esphome/components/lvgl/lvgl_esphome.cpp +0 -43
- esphome/components/lvgl/lvgl_esphome.h +0 -4
- esphome/components/lvgl/styles.py +3 -2
- esphome/components/lvgl/text/__init__.py +3 -3
- esphome/components/lvgl/widgets/__init__.py +2 -0
- esphome/components/lvgl/widgets/animimg.py +3 -4
- esphome/components/lvgl/widgets/dropdown.py +5 -1
- esphome/components/lvgl/widgets/meter.py +16 -11
- esphome/components/md5/__init__.py +6 -0
- esphome/components/md5/md5.cpp +2 -0
- esphome/components/md5/md5.h +2 -0
- esphome/components/micro_wake_word/__init__.py +7 -0
- esphome/components/mics_4514/sensor.py +11 -26
- esphome/components/modbus_controller/__init__.py +7 -5
- esphome/components/modbus_controller/binary_sensor/__init__.py +6 -6
- esphome/components/modbus_controller/number/__init__.py +5 -6
- esphome/components/modbus_controller/output/__init__.py +10 -14
- esphome/components/modbus_controller/select/__init__.py +1 -1
- esphome/components/modbus_controller/sensor/__init__.py +7 -7
- esphome/components/modbus_controller/switch/__init__.py +6 -7
- esphome/components/modbus_controller/text_sensor/__init__.py +8 -9
- esphome/components/mqtt/__init__.py +3 -0
- esphome/components/mqtt/mqtt_client.cpp +2 -0
- esphome/components/mqtt/mqtt_client.h +2 -0
- esphome/components/nau7802/__init__.py +0 -0
- esphome/components/nau7802/nau7802.cpp +323 -0
- esphome/components/nau7802/nau7802.h +121 -0
- esphome/components/nau7802/sensor.py +134 -0
- esphome/components/nextion/base_component.py +1 -0
- esphome/components/nextion/display.py +4 -0
- esphome/components/nextion/nextion.cpp +19 -4
- esphome/components/nextion/nextion.h +16 -0
- esphome/components/npi19/__init__.py +0 -0
- esphome/components/npi19/npi19.cpp +111 -0
- esphome/components/npi19/npi19.h +30 -0
- esphome/components/npi19/sensor.py +52 -0
- esphome/components/number/__init__.py +3 -5
- esphome/components/online_image/__init__.py +1 -1
- esphome/components/online_image/online_image.h +1 -2
- esphome/components/opentherm/__init__.py +57 -0
- esphome/components/opentherm/hub.cpp +277 -0
- esphome/components/opentherm/hub.h +110 -0
- esphome/components/opentherm/opentherm.cpp +568 -0
- esphome/components/opentherm/opentherm.h +347 -0
- esphome/components/pulse_counter/pulse_counter_sensor.cpp +8 -1
- esphome/components/pulse_counter/pulse_counter_sensor.h +1 -0
- esphome/components/radon_eye_ble/radon_eye_listener.cpp +10 -3
- esphome/components/remote_transmitter/__init__.py +18 -2
- esphome/components/remote_transmitter/remote_transmitter.h +6 -0
- esphome/components/remote_transmitter/remote_transmitter_esp32.cpp +2 -0
- esphome/components/remote_transmitter/remote_transmitter_esp8266.cpp +2 -0
- esphome/components/remote_transmitter/remote_transmitter_libretiny.cpp +2 -0
- esphome/components/rp2040/__init__.py +13 -14
- esphome/components/select/__init__.py +3 -4
- esphome/components/sensor/__init__.py +3 -4
- esphome/components/shelly_dimmer/shelly_dimmer.cpp +32 -32
- esphome/components/shelly_dimmer/shelly_dimmer.h +2 -0
- esphome/components/st7701s/st7701s.cpp +21 -8
- esphome/components/st7701s/st7701s.h +2 -0
- esphome/components/switch/__init__.py +3 -4
- esphome/components/tca9555/__init__.py +72 -0
- esphome/components/tca9555/tca9555.cpp +140 -0
- esphome/components/tca9555/tca9555.h +64 -0
- esphome/components/tcs34725/tcs34725.cpp +62 -64
- esphome/components/tem3200/__init__.py +0 -0
- esphome/components/tem3200/sensor.py +55 -0
- esphome/components/tem3200/tem3200.cpp +151 -0
- esphome/components/tem3200/tem3200.h +30 -0
- esphome/components/template/binary_sensor/__init__.py +19 -6
- esphome/components/text/__init__.py +3 -4
- esphome/components/text_sensor/__init__.py +3 -4
- esphome/components/thermostat/climate.py +11 -9
- esphome/components/thermostat/thermostat_climate.cpp +21 -15
- esphome/components/tm1638/binary_sensor/__init__.py +3 -2
- esphome/components/tm1638/display.py +5 -5
- esphome/components/tm1638/output/__init__.py +3 -2
- esphome/components/tm1638/switch/__init__.py +3 -2
- esphome/components/touchscreen/touchscreen.cpp +2 -2
- esphome/components/update/__init__.py +3 -4
- esphome/components/valve/__init__.py +3 -4
- esphome/components/web_server/__init__.py +78 -22
- esphome/components/web_server/server_index_v3.h +3989 -3979
- esphome/components/web_server/web_server.cpp +219 -34
- esphome/components/web_server/web_server.h +10 -1
- esphome/components/wifi/wifi_component_esp_idf.cpp +4 -5
- esphome/config_validation.py +1 -0
- esphome/const.py +12 -2
- esphome/core/defines.h +4 -2
- esphome/core/helpers.cpp +46 -10
- esphome/core/helpers.h +8 -0
- esphome/core/ring_buffer.cpp +12 -2
- esphome/core/ring_buffer.h +3 -0
- esphome/voluptuous_schema.py +3 -1
- esphome/wizard.py +0 -3
- {esphome-2024.9.1.dist-info → esphome-2024.10.0.dist-info}/METADATA +5 -3
- {esphome-2024.9.1.dist-info → esphome-2024.10.0.dist-info}/RECORD +196 -147
- {esphome-2024.9.1.dist-info → esphome-2024.10.0.dist-info}/LICENSE +0 -0
- {esphome-2024.9.1.dist-info → esphome-2024.10.0.dist-info}/WHEEL +0 -0
- {esphome-2024.9.1.dist-info → esphome-2024.10.0.dist-info}/entry_points.txt +0 -0
- {esphome-2024.9.1.dist-info → esphome-2024.10.0.dist-info}/top_level.txt +0 -0
@@ -22,9 +22,10 @@ from esphome.helpers import write_file_if_changed
|
|
22
22
|
|
23
23
|
from . import defines as df, helpers, lv_validation as lvalid
|
24
24
|
from .automation import disp_update, focused_widgets, update_to_code
|
25
|
-
from .defines import add_define
|
25
|
+
from .defines import CONF_WIDGETS, add_define
|
26
26
|
from .encoders import ENCODERS_CONFIG, encoders_to_code, initial_focus_to_code
|
27
27
|
from .gradient import GRADIENT_SCHEMA, gradients_to_code
|
28
|
+
from .hello_world import get_hello_world
|
28
29
|
from .lv_validation import lv_bool, lv_images_used
|
29
30
|
from .lvcode import LvContext, LvglComponent
|
30
31
|
from .schemas import (
|
@@ -32,7 +33,7 @@ from .schemas import (
|
|
32
33
|
FLEX_OBJ_SCHEMA,
|
33
34
|
GRID_CELL_SCHEMA,
|
34
35
|
LAYOUT_SCHEMAS,
|
35
|
-
|
36
|
+
STATE_SCHEMA,
|
36
37
|
WIDGET_TYPES,
|
37
38
|
any_widget_schema,
|
38
39
|
container_schema,
|
@@ -52,7 +53,7 @@ from .types import (
|
|
52
53
|
lv_style_t,
|
53
54
|
lvgl_ns,
|
54
55
|
)
|
55
|
-
from .widgets import Widget, add_widgets, lv_scr_act, set_obj_properties
|
56
|
+
from .widgets import Widget, add_widgets, lv_scr_act, set_obj_properties, styles_used
|
56
57
|
from .widgets.animimg import animimg_spec
|
57
58
|
from .widgets.arc import arc_spec
|
58
59
|
from .widgets.button import button_spec
|
@@ -279,6 +280,8 @@ async def to_code(config):
|
|
279
280
|
|
280
281
|
for comp in helpers.lvgl_components_required:
|
281
282
|
CORE.add_define(f"USE_LVGL_{comp.upper()}")
|
283
|
+
if "transform_angle" in styles_used:
|
284
|
+
add_define("LV_COLOR_SCREEN_TRANSP", "1")
|
282
285
|
for use in helpers.lv_uses:
|
283
286
|
add_define(f"LV_USE_{use.upper()}")
|
284
287
|
lv_conf_h_file = CORE.relative_src_path(LV_CONF_FILENAME)
|
@@ -292,6 +295,13 @@ def display_schema(config):
|
|
292
295
|
return value or [cv.use_id(Display)(config)]
|
293
296
|
|
294
297
|
|
298
|
+
def add_hello_world(config):
|
299
|
+
if CONF_WIDGETS not in config and CONF_PAGES not in config:
|
300
|
+
LOGGER.info("No pages or widgets configured, creating default hello_world page")
|
301
|
+
config[CONF_WIDGETS] = cv.ensure_list(WIDGET_SCHEMA)(get_hello_world())
|
302
|
+
return config
|
303
|
+
|
304
|
+
|
295
305
|
FINAL_VALIDATE_SCHEMA = final_validation
|
296
306
|
|
297
307
|
CONFIG_SCHEMA = (
|
@@ -313,7 +323,7 @@ CONFIG_SCHEMA = (
|
|
313
323
|
),
|
314
324
|
cv.Optional(df.CONF_STYLE_DEFINITIONS): cv.ensure_list(
|
315
325
|
cv.Schema({cv.Required(CONF_ID): cv.declare_id(lv_style_t)})
|
316
|
-
.extend(
|
326
|
+
.extend(STATE_SCHEMA)
|
317
327
|
.extend(
|
318
328
|
{
|
319
329
|
cv.Optional(df.CONF_GRID_CELL_X_ALIGN): grid_alignments,
|
@@ -349,4 +359,5 @@ CONFIG_SCHEMA = (
|
|
349
359
|
}
|
350
360
|
)
|
351
361
|
.extend(DISP_BG_SCHEMA)
|
352
|
-
|
362
|
+
.add_extra(add_hello_world)
|
363
|
+
)
|
@@ -0,0 +1,64 @@
|
|
1
|
+
from io import StringIO
|
2
|
+
|
3
|
+
from esphome.yaml_util import parse_yaml
|
4
|
+
|
5
|
+
CONFIG = """
|
6
|
+
- obj:
|
7
|
+
radius: 0
|
8
|
+
pad_all: 12
|
9
|
+
bg_color: 0xFFFFFF
|
10
|
+
height: 100%
|
11
|
+
width: 100%
|
12
|
+
widgets:
|
13
|
+
- spinner:
|
14
|
+
id: hello_world_spinner_
|
15
|
+
align: center
|
16
|
+
indicator:
|
17
|
+
arc_color: tomato
|
18
|
+
height: 100
|
19
|
+
width: 100
|
20
|
+
spin_time: 2s
|
21
|
+
arc_length: 60deg
|
22
|
+
- label:
|
23
|
+
id: hello_world_label_
|
24
|
+
text: "Hello World!"
|
25
|
+
align: center
|
26
|
+
on_click:
|
27
|
+
lvgl.spinner.update:
|
28
|
+
id: hello_world_spinner_
|
29
|
+
arc_color: springgreen
|
30
|
+
- checkbox:
|
31
|
+
pad_all: 8
|
32
|
+
text: Checkbox
|
33
|
+
align: top_right
|
34
|
+
on_click:
|
35
|
+
lvgl.label.update:
|
36
|
+
id: hello_world_label_
|
37
|
+
text: "Checked!"
|
38
|
+
- button:
|
39
|
+
pad_all: 8
|
40
|
+
checkable: true
|
41
|
+
align: top_left
|
42
|
+
text_font: montserrat_20
|
43
|
+
on_click:
|
44
|
+
lvgl.label.update:
|
45
|
+
id: hello_world_label_
|
46
|
+
text: "Clicked!"
|
47
|
+
widgets:
|
48
|
+
- label:
|
49
|
+
text: "Button"
|
50
|
+
- slider:
|
51
|
+
width: 80%
|
52
|
+
align: bottom_mid
|
53
|
+
on_value:
|
54
|
+
lvgl.label.update:
|
55
|
+
id: hello_world_label_
|
56
|
+
text:
|
57
|
+
format: "%.0f%%"
|
58
|
+
args: [x]
|
59
|
+
"""
|
60
|
+
|
61
|
+
|
62
|
+
def get_hello_world():
|
63
|
+
with StringIO(CONFIG) as fp:
|
64
|
+
return parse_yaml("hello_world", fp)
|
@@ -31,7 +31,6 @@ from .defines import (
|
|
31
31
|
literal,
|
32
32
|
)
|
33
33
|
from .helpers import esphome_fonts_used, lv_fonts_used, requires_component
|
34
|
-
from .lvcode import lv_expr
|
35
34
|
from .types import lv_font_t, lv_gradient_t, lv_img_t
|
36
35
|
|
37
36
|
opacity_consts = LvConstant("LV_OPA_", "TRANSP", "COVER")
|
@@ -49,17 +48,172 @@ def opacity_validator(value):
|
|
49
48
|
|
50
49
|
opacity = LValidator(opacity_validator, uint32, retmapper=literal)
|
51
50
|
|
51
|
+
COLOR_NAMES = {
|
52
|
+
"aliceblue": 0xF0F8FF,
|
53
|
+
"antiquewhite": 0xFAEBD7,
|
54
|
+
"aqua": 0x00FFFF,
|
55
|
+
"aquamarine": 0x7FFFD4,
|
56
|
+
"azure": 0xF0FFFF,
|
57
|
+
"beige": 0xF5F5DC,
|
58
|
+
"bisque": 0xFFE4C4,
|
59
|
+
"black": 0x000000,
|
60
|
+
"blanchedalmond": 0xFFEBCD,
|
61
|
+
"blue": 0x0000FF,
|
62
|
+
"blueviolet": 0x8A2BE2,
|
63
|
+
"brown": 0xA52A2A,
|
64
|
+
"burlywood": 0xDEB887,
|
65
|
+
"cadetblue": 0x5F9EA0,
|
66
|
+
"chartreuse": 0x7FFF00,
|
67
|
+
"chocolate": 0xD2691E,
|
68
|
+
"coral": 0xFF7F50,
|
69
|
+
"cornflowerblue": 0x6495ED,
|
70
|
+
"cornsilk": 0xFFF8DC,
|
71
|
+
"crimson": 0xDC143C,
|
72
|
+
"cyan": 0x00FFFF,
|
73
|
+
"darkblue": 0x00008B,
|
74
|
+
"darkcyan": 0x008B8B,
|
75
|
+
"darkgoldenrod": 0xB8860B,
|
76
|
+
"darkgray": 0xA9A9A9,
|
77
|
+
"darkgreen": 0x006400,
|
78
|
+
"darkgrey": 0xA9A9A9,
|
79
|
+
"darkkhaki": 0xBDB76B,
|
80
|
+
"darkmagenta": 0x8B008B,
|
81
|
+
"darkolivegreen": 0x556B2F,
|
82
|
+
"darkorange": 0xFF8C00,
|
83
|
+
"darkorchid": 0x9932CC,
|
84
|
+
"darkred": 0x8B0000,
|
85
|
+
"darksalmon": 0xE9967A,
|
86
|
+
"darkseagreen": 0x8FBC8F,
|
87
|
+
"darkslateblue": 0x483D8B,
|
88
|
+
"darkslategray": 0x2F4F4F,
|
89
|
+
"darkslategrey": 0x2F4F4F,
|
90
|
+
"darkturquoise": 0x00CED1,
|
91
|
+
"darkviolet": 0x9400D3,
|
92
|
+
"deeppink": 0xFF1493,
|
93
|
+
"deepskyblue": 0x00BFFF,
|
94
|
+
"dimgray": 0x696969,
|
95
|
+
"dimgrey": 0x696969,
|
96
|
+
"dodgerblue": 0x1E90FF,
|
97
|
+
"firebrick": 0xB22222,
|
98
|
+
"floralwhite": 0xFFFAF0,
|
99
|
+
"forestgreen": 0x228B22,
|
100
|
+
"fuchsia": 0xFF00FF,
|
101
|
+
"gainsboro": 0xDCDCDC,
|
102
|
+
"ghostwhite": 0xF8F8FF,
|
103
|
+
"goldenrod": 0xDAA520,
|
104
|
+
"gold": 0xFFD700,
|
105
|
+
"gray": 0x808080,
|
106
|
+
"green": 0x008000,
|
107
|
+
"greenyellow": 0xADFF2F,
|
108
|
+
"grey": 0x808080,
|
109
|
+
"honeydew": 0xF0FFF0,
|
110
|
+
"hotpink": 0xFF69B4,
|
111
|
+
"indianred": 0xCD5C5C,
|
112
|
+
"indigo": 0x4B0082,
|
113
|
+
"ivory": 0xFFFFF0,
|
114
|
+
"khaki": 0xF0E68C,
|
115
|
+
"lavenderblush": 0xFFF0F5,
|
116
|
+
"lavender": 0xE6E6FA,
|
117
|
+
"lawngreen": 0x7CFC00,
|
118
|
+
"lemonchiffon": 0xFFFACD,
|
119
|
+
"lightblue": 0xADD8E6,
|
120
|
+
"lightcoral": 0xF08080,
|
121
|
+
"lightcyan": 0xE0FFFF,
|
122
|
+
"lightgoldenrodyellow": 0xFAFAD2,
|
123
|
+
"lightgray": 0xD3D3D3,
|
124
|
+
"lightgreen": 0x90EE90,
|
125
|
+
"lightgrey": 0xD3D3D3,
|
126
|
+
"lightpink": 0xFFB6C1,
|
127
|
+
"lightsalmon": 0xFFA07A,
|
128
|
+
"lightseagreen": 0x20B2AA,
|
129
|
+
"lightskyblue": 0x87CEFA,
|
130
|
+
"lightslategray": 0x778899,
|
131
|
+
"lightslategrey": 0x778899,
|
132
|
+
"lightsteelblue": 0xB0C4DE,
|
133
|
+
"lightyellow": 0xFFFFE0,
|
134
|
+
"lime": 0x00FF00,
|
135
|
+
"limegreen": 0x32CD32,
|
136
|
+
"linen": 0xFAF0E6,
|
137
|
+
"magenta": 0xFF00FF,
|
138
|
+
"maroon": 0x800000,
|
139
|
+
"mediumaquamarine": 0x66CDAA,
|
140
|
+
"mediumblue": 0x0000CD,
|
141
|
+
"mediumorchid": 0xBA55D3,
|
142
|
+
"mediumpurple": 0x9370DB,
|
143
|
+
"mediumseagreen": 0x3CB371,
|
144
|
+
"mediumslateblue": 0x7B68EE,
|
145
|
+
"mediumspringgreen": 0x00FA9A,
|
146
|
+
"mediumturquoise": 0x48D1CC,
|
147
|
+
"mediumvioletred": 0xC71585,
|
148
|
+
"midnightblue": 0x191970,
|
149
|
+
"mintcream": 0xF5FFFA,
|
150
|
+
"mistyrose": 0xFFE4E1,
|
151
|
+
"moccasin": 0xFFE4B5,
|
152
|
+
"navajowhite": 0xFFDEAD,
|
153
|
+
"navy": 0x000080,
|
154
|
+
"oldlace": 0xFDF5E6,
|
155
|
+
"olive": 0x808000,
|
156
|
+
"olivedrab": 0x6B8E23,
|
157
|
+
"orange": 0xFFA500,
|
158
|
+
"orangered": 0xFF4500,
|
159
|
+
"orchid": 0xDA70D6,
|
160
|
+
"palegoldenrod": 0xEEE8AA,
|
161
|
+
"palegreen": 0x98FB98,
|
162
|
+
"paleturquoise": 0xAFEEEE,
|
163
|
+
"palevioletred": 0xDB7093,
|
164
|
+
"papayawhip": 0xFFEFD5,
|
165
|
+
"peachpuff": 0xFFDAB9,
|
166
|
+
"peru": 0xCD853F,
|
167
|
+
"pink": 0xFFC0CB,
|
168
|
+
"plum": 0xDDA0DD,
|
169
|
+
"powderblue": 0xB0E0E6,
|
170
|
+
"purple": 0x800080,
|
171
|
+
"rebeccapurple": 0x663399,
|
172
|
+
"red": 0xFF0000,
|
173
|
+
"rosybrown": 0xBC8F8F,
|
174
|
+
"royalblue": 0x4169E1,
|
175
|
+
"saddlebrown": 0x8B4513,
|
176
|
+
"salmon": 0xFA8072,
|
177
|
+
"sandybrown": 0xF4A460,
|
178
|
+
"seagreen": 0x2E8B57,
|
179
|
+
"seashell": 0xFFF5EE,
|
180
|
+
"sienna": 0xA0522D,
|
181
|
+
"silver": 0xC0C0C0,
|
182
|
+
"skyblue": 0x87CEEB,
|
183
|
+
"slateblue": 0x6A5ACD,
|
184
|
+
"slategray": 0x708090,
|
185
|
+
"slategrey": 0x708090,
|
186
|
+
"snow": 0xFFFAFA,
|
187
|
+
"springgreen": 0x00FF7F,
|
188
|
+
"steelblue": 0x4682B4,
|
189
|
+
"tan": 0xD2B48C,
|
190
|
+
"teal": 0x008080,
|
191
|
+
"thistle": 0xD8BFD8,
|
192
|
+
"tomato": 0xFF6347,
|
193
|
+
"turquoise": 0x40E0D0,
|
194
|
+
"violet": 0xEE82EE,
|
195
|
+
"wheat": 0xF5DEB3,
|
196
|
+
"white": 0xFFFFFF,
|
197
|
+
"whitesmoke": 0xF5F5F5,
|
198
|
+
"yellow": 0xFFFF00,
|
199
|
+
"yellowgreen": 0x9ACD32,
|
200
|
+
}
|
201
|
+
|
52
202
|
|
53
203
|
@schema_extractor("one_of")
|
54
204
|
def color(value):
|
55
205
|
if value == SCHEMA_EXTRACT:
|
56
206
|
return ["hex color value", "color ID"]
|
57
|
-
return cv.Any(cv.int_, cv.use_id(ColorStruct))(
|
207
|
+
return cv.Any(cv.int_, cv.one_of(*COLOR_NAMES, lower=True), cv.use_id(ColorStruct))(
|
208
|
+
value
|
209
|
+
)
|
58
210
|
|
59
211
|
|
60
212
|
def color_retmapper(value):
|
61
213
|
if isinstance(value, cv.Lambda):
|
62
214
|
return cv.returning_lambda(value)
|
215
|
+
if isinstance(value, str) and value in COLOR_NAMES:
|
216
|
+
value = COLOR_NAMES[value]
|
63
217
|
if isinstance(value, int):
|
64
218
|
return literal(
|
65
219
|
f"lv_color_make({(value >> 16) & 0xFF}, {(value >> 8) & 0xFF}, {value & 0xFF})"
|
@@ -88,6 +242,8 @@ def pixels_or_percent_validator(value):
|
|
88
242
|
"""A length in one axis - either a number (pixels) or a percentage"""
|
89
243
|
if value == SCHEMA_EXTRACT:
|
90
244
|
return ["pixels", "..%"]
|
245
|
+
if isinstance(value, str) and value.lower().endswith("px"):
|
246
|
+
value = cv.int_(value[:-2])
|
91
247
|
value = cv.Any(cv.int_, cv.percentage)(value)
|
92
248
|
if isinstance(value, int):
|
93
249
|
return value
|
@@ -175,7 +331,7 @@ def image_validator(value):
|
|
175
331
|
lv_image = LValidator(
|
176
332
|
image_validator,
|
177
333
|
lv_img_t,
|
178
|
-
retmapper=lambda x:
|
334
|
+
retmapper=lambda x: MockObj(x, "->").get_lv_img_dsc(),
|
179
335
|
requires="image",
|
180
336
|
)
|
181
337
|
lv_bool = LValidator(cv.boolean, cg.bool_, retmapper=literal)
|
@@ -356,49 +356,6 @@ bool lv_is_pre_initialise() {
|
|
356
356
|
return false;
|
357
357
|
}
|
358
358
|
|
359
|
-
#ifdef USE_LVGL_IMAGE
|
360
|
-
lv_img_dsc_t *lv_img_from(image::Image *src, lv_img_dsc_t *img_dsc) {
|
361
|
-
if (img_dsc == nullptr)
|
362
|
-
img_dsc = new lv_img_dsc_t(); // NOLINT
|
363
|
-
img_dsc->header.always_zero = 0;
|
364
|
-
img_dsc->header.reserved = 0;
|
365
|
-
img_dsc->header.w = src->get_width();
|
366
|
-
img_dsc->header.h = src->get_height();
|
367
|
-
img_dsc->data = src->get_data_start();
|
368
|
-
img_dsc->data_size = image_type_to_width_stride(img_dsc->header.w * img_dsc->header.h, src->get_type());
|
369
|
-
switch (src->get_type()) {
|
370
|
-
case image::IMAGE_TYPE_BINARY:
|
371
|
-
img_dsc->header.cf = LV_IMG_CF_ALPHA_1BIT;
|
372
|
-
break;
|
373
|
-
|
374
|
-
case image::IMAGE_TYPE_GRAYSCALE:
|
375
|
-
img_dsc->header.cf = LV_IMG_CF_ALPHA_8BIT;
|
376
|
-
break;
|
377
|
-
|
378
|
-
case image::IMAGE_TYPE_RGB24:
|
379
|
-
img_dsc->header.cf = LV_IMG_CF_RGB888;
|
380
|
-
break;
|
381
|
-
|
382
|
-
case image::IMAGE_TYPE_RGB565:
|
383
|
-
#if LV_COLOR_DEPTH == 16
|
384
|
-
img_dsc->header.cf = src->has_transparency() ? LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED : LV_IMG_CF_TRUE_COLOR;
|
385
|
-
#else
|
386
|
-
img_dsc->header.cf = LV_IMG_CF_RGB565;
|
387
|
-
#endif
|
388
|
-
break;
|
389
|
-
|
390
|
-
case image::IMAGE_TYPE_RGBA:
|
391
|
-
#if LV_COLOR_DEPTH == 32
|
392
|
-
img_dsc->header.cf = LV_IMG_CF_TRUE_COLOR;
|
393
|
-
#else
|
394
|
-
img_dsc->header.cf = LV_IMG_CF_RGBA8888;
|
395
|
-
#endif
|
396
|
-
break;
|
397
|
-
}
|
398
|
-
return img_dsc;
|
399
|
-
}
|
400
|
-
#endif // USE_LVGL_IMAGE
|
401
|
-
|
402
359
|
#ifdef USE_LVGL_ANIMIMG
|
403
360
|
void lv_animimg_stop(lv_obj_t *obj) {
|
404
361
|
auto *animg = (lv_animimg_t *) obj;
|
@@ -102,10 +102,6 @@ class FontEngine {
|
|
102
102
|
lv_font_t lv_font_{};
|
103
103
|
};
|
104
104
|
#endif // USE_LVGL_FONT
|
105
|
-
#ifdef USE_LVGL_IMAGE
|
106
|
-
lv_img_dsc_t *lv_img_from(image::Image *src, lv_img_dsc_t *img_dsc = nullptr);
|
107
|
-
#endif // USE_LVGL_IMAGE
|
108
|
-
|
109
105
|
#ifdef USE_LVGL_ANIMIMG
|
110
106
|
void lv_animimg_stop(lv_obj_t *obj);
|
111
107
|
#endif // USE_LVGL_ANIMIMG
|
@@ -12,7 +12,7 @@ from .defines import (
|
|
12
12
|
)
|
13
13
|
from .helpers import add_lv_use
|
14
14
|
from .lvcode import LambdaContext, LocalVariable, lv, lv_assign, lv_variable
|
15
|
-
from .schemas import ALL_STYLES
|
15
|
+
from .schemas import ALL_STYLES, STYLE_REMAP
|
16
16
|
from .types import lv_lambda_t, lv_obj_t, lv_obj_t_ptr
|
17
17
|
from .widgets import Widget, add_widgets, set_obj_properties, theme_widget_map
|
18
18
|
from .widgets.obj import obj_spec
|
@@ -31,7 +31,8 @@ async def styles_to_code(config):
|
|
31
31
|
value = await validator.process(value)
|
32
32
|
if isinstance(value, list):
|
33
33
|
value = "|".join(value)
|
34
|
-
|
34
|
+
remapped_prop = STYLE_REMAP.get(prop, prop)
|
35
|
+
lv.call(f"style_set_{remapped_prop}", svar, literal(value))
|
35
36
|
|
36
37
|
|
37
38
|
async def theme_to_code(config):
|
@@ -34,13 +34,13 @@ async def to_code(config):
|
|
34
34
|
widget = widget[0]
|
35
35
|
await wait_for_widgets()
|
36
36
|
async with LambdaContext([(cg.std_string, "text_value")]) as control:
|
37
|
-
await widget.set_property("text", "text_value.c_str()
|
38
|
-
lv.event_send(widget.obj, API_EVENT,
|
37
|
+
await widget.set_property("text", "text_value.c_str()")
|
38
|
+
lv.event_send(widget.obj, API_EVENT, cg.nullptr)
|
39
39
|
control.add(textvar.publish_state(widget.get_value()))
|
40
40
|
async with LambdaContext(EVENT_ARG) as lamb:
|
41
41
|
lv_add(textvar.publish_state(widget.get_value()))
|
42
42
|
async with LvContext(paren):
|
43
|
-
|
43
|
+
lv_add(textvar.set_control_lambda(await control.get_lambda()))
|
44
44
|
lv_add(
|
45
45
|
paren.add_event_cb(
|
46
46
|
widget.obj,
|
@@ -52,6 +52,7 @@ from ..types import LV_STATE, LvType, WidgetType, lv_coord_t, lv_obj_t, lv_obj_t
|
|
52
52
|
EVENT_LAMB = "event_lamb__"
|
53
53
|
|
54
54
|
theme_widget_map = {}
|
55
|
+
styles_used = set()
|
55
56
|
|
56
57
|
|
57
58
|
class LvScrActType(WidgetType):
|
@@ -158,6 +159,7 @@ class Widget:
|
|
158
159
|
def set_style(self, prop, value, state):
|
159
160
|
if value is None:
|
160
161
|
return
|
162
|
+
styles_used.add(prop)
|
161
163
|
lv.call(f"obj_set_style_{prop}", self.obj, value, state)
|
162
164
|
|
163
165
|
def __type_base(self):
|
@@ -2,13 +2,12 @@ from esphome import automation
|
|
2
2
|
import esphome.codegen as cg
|
3
3
|
import esphome.config_validation as cv
|
4
4
|
from esphome.const import CONF_DURATION, CONF_ID
|
5
|
-
from esphome.cpp_generator import MockObj
|
6
5
|
|
7
6
|
from ..automation import action_to_code
|
8
7
|
from ..defines import CONF_AUTO_START, CONF_MAIN, CONF_REPEAT_COUNT, CONF_SRC
|
9
8
|
from ..helpers import lvgl_components_required
|
10
9
|
from ..lv_validation import lv_image, lv_milliseconds
|
11
|
-
from ..lvcode import lv
|
10
|
+
from ..lvcode import lv
|
12
11
|
from ..types import LvType, ObjUpdateAction, void_ptr
|
13
12
|
from . import Widget, WidgetType, get_widgets
|
14
13
|
from .img import CONF_IMAGE
|
@@ -63,7 +62,7 @@ class AnimimgType(WidgetType):
|
|
63
62
|
if CONF_SRC in config:
|
64
63
|
for x in config[CONF_SRC]:
|
65
64
|
await cg.get_variable(x)
|
66
|
-
srcs = [
|
65
|
+
srcs = [await lv_image.process(x) for x in config[CONF_SRC]]
|
67
66
|
src_id = cg.static_const_array(config[CONF_SRC_LIST_ID], srcs)
|
68
67
|
count = len(config[CONF_SRC])
|
69
68
|
lv.animimg_set_src(w.obj, src_id, count)
|
@@ -73,7 +72,7 @@ class AnimimgType(WidgetType):
|
|
73
72
|
lv.animimg_start(w.obj)
|
74
73
|
|
75
74
|
def get_uses(self):
|
76
|
-
return CONF_IMAGE, CONF_LABEL
|
75
|
+
return "img", CONF_IMAGE, CONF_LABEL
|
77
76
|
|
78
77
|
|
79
78
|
animimg_spec = AnimimgType()
|
@@ -6,6 +6,8 @@ from ..defines import (
|
|
6
6
|
CONF_DIR,
|
7
7
|
CONF_INDICATOR,
|
8
8
|
CONF_MAIN,
|
9
|
+
CONF_SCROLLBAR,
|
10
|
+
CONF_SELECTED,
|
9
11
|
CONF_SELECTED_INDEX,
|
10
12
|
CONF_SYMBOL,
|
11
13
|
DIRECTIONS,
|
@@ -23,7 +25,9 @@ CONF_DROPDOWN_LIST = "dropdown_list"
|
|
23
25
|
|
24
26
|
lv_dropdown_t = LvSelect("lv_dropdown_t")
|
25
27
|
lv_dropdown_list_t = LvType("lv_dropdown_list_t")
|
26
|
-
dropdown_list_spec = WidgetType(
|
28
|
+
dropdown_list_spec = WidgetType(
|
29
|
+
CONF_DROPDOWN_LIST, lv_dropdown_list_t, (CONF_MAIN, CONF_SELECTED, CONF_SCROLLBAR)
|
30
|
+
)
|
27
31
|
|
28
32
|
DROPDOWN_BASE_SCHEMA = cv.Schema(
|
29
33
|
{
|
@@ -20,6 +20,7 @@ from ..defines import (
|
|
20
20
|
CONF_END_VALUE,
|
21
21
|
CONF_INDICATOR,
|
22
22
|
CONF_MAIN,
|
23
|
+
CONF_OPA,
|
23
24
|
CONF_PIVOT_X,
|
24
25
|
CONF_PIVOT_Y,
|
25
26
|
CONF_SRC,
|
@@ -35,10 +36,11 @@ from ..lv_validation import (
|
|
35
36
|
lv_color,
|
36
37
|
lv_float,
|
37
38
|
lv_image,
|
39
|
+
opacity,
|
38
40
|
requires_component,
|
39
41
|
size,
|
40
42
|
)
|
41
|
-
from ..lvcode import LocalVariable, lv, lv_assign, lv_expr
|
43
|
+
from ..lvcode import LocalVariable, lv, lv_assign, lv_expr, lv_obj
|
42
44
|
from ..types import LvType, ObjUpdateAction
|
43
45
|
from . import Widget, WidgetType, get_widgets
|
44
46
|
from .arc import CONF_ARC
|
@@ -76,6 +78,7 @@ INDICATOR_LINE_SCHEMA = cv.Schema(
|
|
76
78
|
cv.Optional(CONF_COLOR, default=0): lv_color,
|
77
79
|
cv.Optional(CONF_R_MOD, default=0): size,
|
78
80
|
cv.Optional(CONF_VALUE): lv_float,
|
81
|
+
cv.Optional(CONF_OPA): opacity,
|
79
82
|
}
|
80
83
|
)
|
81
84
|
INDICATOR_IMG_SCHEMA = cv.Schema(
|
@@ -84,6 +87,7 @@ INDICATOR_IMG_SCHEMA = cv.Schema(
|
|
84
87
|
cv.Required(CONF_PIVOT_X): pixels,
|
85
88
|
cv.Required(CONF_PIVOT_Y): pixels,
|
86
89
|
cv.Optional(CONF_VALUE): lv_float,
|
90
|
+
cv.Optional(CONF_OPA): opacity,
|
87
91
|
}
|
88
92
|
)
|
89
93
|
INDICATOR_ARC_SCHEMA = cv.Schema(
|
@@ -94,6 +98,7 @@ INDICATOR_ARC_SCHEMA = cv.Schema(
|
|
94
98
|
cv.Exclusive(CONF_VALUE, CONF_VALUE): lv_float,
|
95
99
|
cv.Exclusive(CONF_START_VALUE, CONF_VALUE): lv_float,
|
96
100
|
cv.Optional(CONF_END_VALUE): lv_float,
|
101
|
+
cv.Optional(CONF_OPA): opacity,
|
97
102
|
}
|
98
103
|
)
|
99
104
|
INDICATOR_TICKS_SCHEMA = cv.Schema(
|
@@ -218,9 +223,7 @@ class MeterType(WidgetType):
|
|
218
223
|
for indicator in scale_conf.get(CONF_INDICATORS, ()):
|
219
224
|
(t, v) = next(iter(indicator.items()))
|
220
225
|
iid = v[CONF_ID]
|
221
|
-
ivar = cg.
|
222
|
-
iid, cg.nullptr, type_=lv_meter_indicator_t_ptr
|
223
|
-
)
|
226
|
+
ivar = cg.Pvariable(iid, cg.nullptr, type_=lv_meter_indicator_t)
|
224
227
|
# Enable getting the meter to which this belongs.
|
225
228
|
wid = Widget.create(iid, var, obj_spec, v)
|
226
229
|
wid.obj = ivar
|
@@ -268,9 +271,7 @@ class MeterType(WidgetType):
|
|
268
271
|
v[CONF_PIVOT_Y],
|
269
272
|
),
|
270
273
|
)
|
271
|
-
|
272
|
-
end_value = await get_end_value(v)
|
273
|
-
set_indicator_values(var, ivar, start_value, end_value)
|
274
|
+
await set_indicator_values(var, ivar, v)
|
274
275
|
|
275
276
|
|
276
277
|
meter_spec = MeterType()
|
@@ -285,21 +286,22 @@ meter_spec = MeterType()
|
|
285
286
|
cv.Exclusive(CONF_VALUE, CONF_VALUE): lv_float,
|
286
287
|
cv.Exclusive(CONF_START_VALUE, CONF_VALUE): lv_float,
|
287
288
|
cv.Optional(CONF_END_VALUE): lv_float,
|
289
|
+
cv.Optional(CONF_OPA): opacity,
|
288
290
|
}
|
289
291
|
),
|
290
292
|
)
|
291
293
|
async def indicator_update_to_code(config, action_id, template_arg, args):
|
292
294
|
widget = await get_widgets(config)
|
293
|
-
start_value = await get_start_value(config)
|
294
|
-
end_value = await get_end_value(config)
|
295
295
|
|
296
296
|
async def set_value(w: Widget):
|
297
|
-
set_indicator_values(w.var, w.obj,
|
297
|
+
await set_indicator_values(w.var, w.obj, config)
|
298
298
|
|
299
299
|
return await action_to_code(widget, set_value, action_id, template_arg, args)
|
300
300
|
|
301
301
|
|
302
|
-
def set_indicator_values(meter, indicator,
|
302
|
+
async def set_indicator_values(meter, indicator, config):
|
303
|
+
start_value = await get_start_value(config)
|
304
|
+
end_value = await get_end_value(config)
|
303
305
|
if start_value is not None:
|
304
306
|
if end_value is None:
|
305
307
|
lv.meter_set_indicator_value(meter, indicator, start_value)
|
@@ -307,3 +309,6 @@ def set_indicator_values(meter, indicator, start_value, end_value):
|
|
307
309
|
lv.meter_set_indicator_start_value(meter, indicator, start_value)
|
308
310
|
if end_value is not None:
|
309
311
|
lv.meter_set_indicator_end_value(meter, indicator, end_value)
|
312
|
+
if (opa := config.get(CONF_OPA)) is not None:
|
313
|
+
lv_assign(indicator.opa, await opacity.process(opa))
|
314
|
+
lv_obj.invalidate(meter)
|
esphome/components/md5/md5.cpp
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#include <cstdio>
|
2
2
|
#include <cstring>
|
3
3
|
#include "md5.h"
|
4
|
+
#ifdef USE_MD5
|
4
5
|
#include "esphome/core/helpers.h"
|
5
6
|
|
6
7
|
namespace esphome {
|
@@ -65,3 +66,4 @@ bool MD5Digest::equals_hex(const char *expected) {
|
|
65
66
|
|
66
67
|
} // namespace md5
|
67
68
|
} // namespace esphome
|
69
|
+
#endif
|
esphome/components/md5/md5.h
CHANGED
@@ -419,6 +419,13 @@ async def to_code(config):
|
|
419
419
|
repo="https://github.com/espressif/esp-tflite-micro",
|
420
420
|
ref="v1.3.1",
|
421
421
|
)
|
422
|
+
# add esp-nn dependency for tflite-micro to work around https://github.com/espressif/esp-nn/issues/17
|
423
|
+
# ...remove after switching to IDF 5.1.4+
|
424
|
+
esp32.add_idf_component(
|
425
|
+
name="esp-nn",
|
426
|
+
repo="https://github.com/espressif/esp-nn",
|
427
|
+
ref="v1.1.0",
|
428
|
+
)
|
422
429
|
|
423
430
|
cg.add_build_flag("-DTF_LITE_STATIC_MEMORY")
|
424
431
|
cg.add_build_flag("-DTF_LITE_DISABLE_X86_NEON")
|