esphome 2024.8.2__py3-none-any.whl → 2024.9.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/__main__.py +6 -2
- esphome/components/api/api_connection.cpp +53 -0
- esphome/components/api/api_connection.h +4 -0
- esphome/components/api/api_pb2.cpp +280 -0
- esphome/components/api/api_pb2.h +91 -0
- esphome/components/api/api_pb2_service.cpp +85 -0
- esphome/components/api/api_pb2_service.h +28 -0
- esphome/components/async_tcp/__init__.py +3 -3
- esphome/components/atm90e26/sensor.py +10 -10
- esphome/components/atm90e32/sensor.py +1 -1
- esphome/components/bl0906/__init__.py +1 -0
- esphome/components/bl0906/bl0906.cpp +238 -0
- esphome/components/bl0906/bl0906.h +96 -0
- esphome/components/bl0906/const.py +4 -0
- esphome/components/bl0906/constants.h +122 -0
- esphome/components/bl0906/sensor.py +184 -0
- esphome/components/bl0942/__init__.py +1 -1
- esphome/components/bl0942/bl0942.cpp +127 -34
- esphome/components/bl0942/bl0942.h +87 -3
- esphome/components/bl0942/sensor.py +46 -8
- esphome/components/ble_client/__init__.py +1 -3
- esphome/components/ble_presence/binary_sensor.py +2 -2
- esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +5 -0
- esphome/components/bmp280/sensor.py +2 -93
- esphome/components/bmp280_base/__init__.py +88 -0
- esphome/components/{bmp280/bmp280.cpp → bmp280_base/bmp280_base.cpp} +11 -4
- esphome/components/{bmp280/bmp280.h → bmp280_base/bmp280_base.h} +9 -5
- esphome/components/bmp280_i2c/__init__.py +0 -0
- esphome/components/bmp280_i2c/bmp280_i2c.cpp +27 -0
- esphome/components/bmp280_i2c/bmp280_i2c.h +22 -0
- esphome/components/bmp280_i2c/sensor.py +22 -0
- esphome/components/bmp280_spi/__init__.py +0 -0
- esphome/components/bmp280_spi/bmp280_spi.cpp +65 -0
- esphome/components/bmp280_spi/bmp280_spi.h +20 -0
- esphome/components/bmp280_spi/sensor.py +22 -0
- esphome/components/captive_portal/captive_portal.cpp +2 -0
- esphome/components/captive_portal/captive_portal.h +3 -1
- esphome/components/ch422g/__init__.py +67 -0
- esphome/components/ch422g/ch422g.cpp +122 -0
- esphome/components/ch422g/ch422g.h +70 -0
- esphome/components/debug/debug_esp32.cpp +3 -1
- esphome/components/display/__init__.py +5 -4
- esphome/components/dsmr/dsmr.cpp +6 -0
- esphome/components/dsmr/dsmr.h +6 -0
- esphome/components/dsmr/text_sensor.py +7 -2
- esphome/components/e131/e131.cpp +2 -0
- esphome/components/e131/e131.h +3 -1
- esphome/components/e131/e131_addressable_light_effect.cpp +2 -0
- esphome/components/e131/e131_addressable_light_effect.h +2 -1
- esphome/components/e131/e131_packet.cpp +2 -0
- esphome/components/esp32_ble/ble_uuid.cpp +7 -0
- esphome/components/esp32_ble/ble_uuid.h +1 -0
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +11 -9
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +3 -3
- esphome/components/esp32_camera/__init__.py +4 -0
- esphome/components/esp32_camera/esp32_camera.cpp +9 -1
- esphome/components/esp32_camera/esp32_camera.h +3 -0
- esphome/components/esp32_can/canbus.py +18 -7
- esphome/components/esp32_can/esp32_can.cpp +8 -0
- esphome/components/esp32_can/esp32_can.h +4 -0
- esphome/components/esp32_rmt_led_strip/led_strip.cpp +14 -2
- esphome/components/esp32_rmt_led_strip/led_strip.h +3 -2
- esphome/components/esp32_rmt_led_strip/light.py +21 -4
- esphome/components/esphome/ota/ota_esphome.cpp +2 -1
- esphome/components/esphome/ota/ota_esphome.h +2 -0
- esphome/components/font/__init__.py +11 -22
- esphome/components/font/font.cpp +3 -2
- esphome/components/font/font.h +12 -3
- esphome/components/gree/climate.py +2 -1
- esphome/components/gree/gree.cpp +54 -3
- esphome/components/gree/gree.h +10 -2
- esphome/components/gt911/touchscreen/__init__.py +6 -4
- esphome/components/gt911/touchscreen/gt911_touchscreen.cpp +17 -0
- esphome/components/gt911/touchscreen/gt911_touchscreen.h +2 -0
- esphome/components/hmac_md5/__init__.py +2 -0
- esphome/components/hmac_md5/hmac_md5.cpp +56 -0
- esphome/components/hmac_md5/hmac_md5.h +48 -0
- esphome/components/homeassistant/__init__.py +13 -0
- esphome/components/homeassistant/switch/__init__.py +15 -2
- esphome/components/homeassistant/switch/homeassistant_switch.cpp +2 -2
- esphome/components/i2s_audio/__init__.py +88 -9
- esphome/components/i2s_audio/i2s_audio.h +20 -2
- esphome/components/i2s_audio/media_player/__init__.py +8 -4
- esphome/components/i2s_audio/media_player/i2s_audio_media_player.h +1 -1
- esphome/components/i2s_audio/microphone/__init__.py +19 -51
- esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp +18 -15
- esphome/components/i2s_audio/microphone/i2s_audio_microphone.h +0 -12
- esphome/components/i2s_audio/speaker/__init__.py +39 -27
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +49 -37
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +3 -4
- esphome/components/ili9xxx/display.py +16 -17
- esphome/components/ili9xxx/ili9xxx_display.cpp +1 -1
- esphome/components/ili9xxx/ili9xxx_display.h +18 -18
- esphome/components/ili9xxx/ili9xxx_init.h +0 -3
- esphome/components/improv_serial/improv_serial_component.cpp +2 -1
- esphome/components/improv_serial/improv_serial_component.h +2 -1
- esphome/components/ledc/ledc_output.cpp +11 -7
- esphome/components/libretiny/__init__.py +8 -13
- esphome/components/ltr501/__init__.py +1 -0
- esphome/components/ltr501/ltr501.cpp +542 -0
- esphome/components/ltr501/ltr501.h +184 -0
- esphome/components/ltr501/ltr_definitions_501.h +260 -0
- esphome/components/ltr501/sensor.py +274 -0
- esphome/components/ltr_als_ps/sensor.py +2 -2
- esphome/components/lvgl/__init__.py +19 -16
- esphome/components/lvgl/automation.py +90 -9
- esphome/components/lvgl/defines.py +29 -2
- esphome/components/lvgl/gradient.py +61 -0
- esphome/components/lvgl/lv_validation.py +45 -27
- esphome/components/lvgl/lvcode.py +8 -3
- esphome/components/lvgl/lvgl_esphome.cpp +54 -0
- esphome/components/lvgl/lvgl_esphome.h +9 -3
- esphome/components/lvgl/number/__init__.py +1 -0
- esphome/components/lvgl/number/lvgl_number.h +3 -1
- esphome/components/lvgl/schemas.py +16 -11
- esphome/components/lvgl/select/__init__.py +1 -0
- esphome/components/lvgl/select/lvgl_select.h +3 -1
- esphome/components/lvgl/switch/__init__.py +2 -1
- esphome/components/lvgl/switch/lvgl_switch.h +3 -1
- esphome/components/lvgl/text/__init__.py +1 -0
- esphome/components/lvgl/text/lvgl_text.h +3 -1
- esphome/components/lvgl/trigger.py +3 -2
- esphome/components/lvgl/types.py +2 -1
- esphome/components/lvgl/widgets/__init__.py +23 -8
- esphome/components/lvgl/widgets/arc.py +5 -1
- esphome/components/lvgl/widgets/buttonmatrix.py +5 -1
- esphome/components/lvgl/widgets/checkbox.py +8 -3
- esphome/components/lvgl/widgets/meter.py +8 -1
- esphome/components/lvgl/widgets/msgbox.py +26 -15
- esphome/components/lvgl/widgets/page.py +51 -7
- esphome/components/lvgl/widgets/tileview.py +2 -8
- esphome/components/max31856/max31856.cpp +12 -1
- esphome/components/max31856/max31856.h +5 -2
- esphome/components/max31856/sensor.py +20 -0
- esphome/components/mcp9600/sensor.py +2 -2
- esphome/components/mdns/__init__.py +6 -6
- esphome/components/media_player/media_player.h +16 -0
- esphome/components/micro_wake_word/__init__.py +2 -25
- esphome/components/microphone/microphone.h +1 -1
- esphome/components/mics_4514/mics_4514.cpp +26 -36
- esphome/components/modbus_controller/__init__.py +6 -0
- esphome/components/modbus_controller/const.py +2 -0
- esphome/components/modbus_controller/modbus_controller.cpp +30 -27
- esphome/components/modbus_controller/modbus_controller.h +22 -4
- esphome/components/network/__init__.py +11 -8
- esphome/components/pipsolar/pipsolar.cpp +3 -0
- esphome/components/pipsolar/pipsolar.h +1 -0
- esphome/components/pipsolar/switch/__init__.py +2 -0
- esphome/components/prometheus/prometheus_handler.cpp +2 -0
- esphome/components/prometheus/prometheus_handler.h +3 -1
- esphome/components/rp2040/__init__.py +7 -8
- esphome/components/rpi_dpi_rgb/display.py +20 -17
- esphome/components/rpi_dpi_rgb/rpi_dpi_rgb.cpp +36 -6
- esphome/components/rpi_dpi_rgb/rpi_dpi_rgb.h +4 -0
- esphome/components/socket/socket.cpp +2 -0
- esphome/components/socket/socket.h +2 -0
- esphome/components/speaker/speaker.h +1 -1
- esphome/components/st7701s/display.py +35 -37
- esphome/components/st7701s/st7701s.cpp +11 -6
- esphome/components/st7701s/st7701s.h +1 -0
- esphome/components/statsd/__init__.py +65 -0
- esphome/components/statsd/statsd.cpp +156 -0
- esphome/components/statsd/statsd.h +86 -0
- esphome/components/tuya/__init__.py +1 -0
- esphome/components/tuya/number/__init__.py +39 -2
- esphome/components/tuya/number/tuya_number.cpp +58 -2
- esphome/components/tuya/number/tuya_number.h +12 -3
- esphome/components/udp/__init__.py +158 -0
- esphome/components/udp/binary_sensor.py +27 -0
- esphome/components/udp/sensor.py +27 -0
- esphome/components/udp/udp_component.cpp +616 -0
- esphome/components/udp/udp_component.h +158 -0
- esphome/components/uponor_smatrix/uponor_smatrix.cpp +4 -6
- esphome/components/uponor_smatrix/uponor_smatrix.h +0 -1
- esphome/components/veml7700/sensor.py +2 -2
- esphome/components/voice_assistant/__init__.py +6 -0
- esphome/components/voice_assistant/voice_assistant.cpp +24 -2
- esphome/components/voice_assistant/voice_assistant.h +20 -0
- esphome/components/web_server/__init__.py +11 -11
- esphome/components/web_server/list_entities.cpp +2 -0
- esphome/components/web_server/list_entities.h +3 -1
- esphome/components/web_server/web_server.cpp +2 -1
- esphome/components/web_server/web_server.h +2 -0
- esphome/components/web_server_base/web_server_base.cpp +2 -0
- esphome/components/web_server_base/web_server_base.h +3 -1
- esphome/components/wifi/wifi_component_libretiny.cpp +15 -1
- esphome/components/wireguard/__init__.py +9 -6
- esphome/components/wireguard/wireguard.cpp +2 -1
- esphome/components/wireguard/wireguard.h +3 -1
- esphome/config_validation.py +8 -0
- esphome/const.py +8 -1
- esphome/core/bytebuffer.cpp +117 -84
- esphome/core/bytebuffer.h +69 -21
- esphome/core/config.py +0 -3
- esphome/core/defines.h +2 -0
- esphome/core/ring_buffer.cpp +13 -2
- esphome/core/ring_buffer.h +56 -0
- esphome/external_files.py +5 -3
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/METADATA +1 -1
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/RECORD +204 -169
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/LICENSE +0 -0
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/WHEEL +0 -0
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/entry_points.txt +0 -0
- {esphome-2024.8.2.dist-info → esphome-2024.9.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,158 @@
|
|
1
|
+
import hashlib
|
2
|
+
|
3
|
+
import esphome.codegen as cg
|
4
|
+
from esphome.components.api import CONF_ENCRYPTION
|
5
|
+
from esphome.components.binary_sensor import BinarySensor
|
6
|
+
from esphome.components.sensor import Sensor
|
7
|
+
import esphome.config_validation as cv
|
8
|
+
from esphome.const import (
|
9
|
+
CONF_BINARY_SENSORS,
|
10
|
+
CONF_ID,
|
11
|
+
CONF_INTERNAL,
|
12
|
+
CONF_KEY,
|
13
|
+
CONF_NAME,
|
14
|
+
CONF_PORT,
|
15
|
+
CONF_SENSORS,
|
16
|
+
)
|
17
|
+
from esphome.cpp_generator import MockObjClass
|
18
|
+
|
19
|
+
CODEOWNERS = ["@clydebarrow"]
|
20
|
+
DEPENDENCIES = ["network"]
|
21
|
+
AUTO_LOAD = ["socket"]
|
22
|
+
MULTI_CONF = True
|
23
|
+
|
24
|
+
udp_ns = cg.esphome_ns.namespace("udp")
|
25
|
+
UDPComponent = udp_ns.class_("UDPComponent", cg.PollingComponent)
|
26
|
+
|
27
|
+
CONF_BROADCAST = "broadcast"
|
28
|
+
CONF_BROADCAST_ID = "broadcast_id"
|
29
|
+
CONF_ADDRESSES = "addresses"
|
30
|
+
CONF_PROVIDER = "provider"
|
31
|
+
CONF_PROVIDERS = "providers"
|
32
|
+
CONF_REMOTE_ID = "remote_id"
|
33
|
+
CONF_UDP_ID = "udp_id"
|
34
|
+
CONF_PING_PONG_ENABLE = "ping_pong_enable"
|
35
|
+
CONF_PING_PONG_RECYCLE_TIME = "ping_pong_recycle_time"
|
36
|
+
CONF_ROLLING_CODE_ENABLE = "rolling_code_enable"
|
37
|
+
|
38
|
+
|
39
|
+
def sensor_validation(cls: MockObjClass):
|
40
|
+
return cv.maybe_simple_value(
|
41
|
+
cv.Schema(
|
42
|
+
{
|
43
|
+
cv.Required(CONF_ID): cv.use_id(cls),
|
44
|
+
cv.Optional(CONF_BROADCAST_ID): cv.validate_id_name,
|
45
|
+
}
|
46
|
+
),
|
47
|
+
key=CONF_ID,
|
48
|
+
)
|
49
|
+
|
50
|
+
|
51
|
+
ENCRYPTION_SCHEMA = {
|
52
|
+
cv.Optional(CONF_ENCRYPTION): cv.maybe_simple_value(
|
53
|
+
cv.Schema(
|
54
|
+
{
|
55
|
+
cv.Required(CONF_KEY): cv.string,
|
56
|
+
}
|
57
|
+
),
|
58
|
+
key=CONF_KEY,
|
59
|
+
)
|
60
|
+
}
|
61
|
+
|
62
|
+
PROVIDER_SCHEMA = cv.Schema(
|
63
|
+
{
|
64
|
+
cv.Required(CONF_NAME): cv.valid_name,
|
65
|
+
}
|
66
|
+
).extend(ENCRYPTION_SCHEMA)
|
67
|
+
|
68
|
+
|
69
|
+
def validate_(config):
|
70
|
+
if CONF_ENCRYPTION in config:
|
71
|
+
if CONF_SENSORS not in config and CONF_BINARY_SENSORS not in config:
|
72
|
+
raise cv.Invalid("No sensors or binary sensors to encrypt")
|
73
|
+
elif config[CONF_ROLLING_CODE_ENABLE]:
|
74
|
+
raise cv.Invalid("Rolling code requires an encryption key")
|
75
|
+
if config[CONF_PING_PONG_ENABLE]:
|
76
|
+
if not any(CONF_ENCRYPTION in p for p in config.get(CONF_PROVIDERS) or ()):
|
77
|
+
raise cv.Invalid("Ping-pong requires at least one encrypted provider")
|
78
|
+
return config
|
79
|
+
|
80
|
+
|
81
|
+
CONFIG_SCHEMA = cv.All(
|
82
|
+
cv.polling_component_schema("15s")
|
83
|
+
.extend(
|
84
|
+
{
|
85
|
+
cv.GenerateID(): cv.declare_id(UDPComponent),
|
86
|
+
cv.Optional(CONF_PORT, default=18511): cv.port,
|
87
|
+
cv.Optional(CONF_ADDRESSES, default=["255.255.255.255"]): cv.ensure_list(
|
88
|
+
cv.ipv4
|
89
|
+
),
|
90
|
+
cv.Optional(CONF_ROLLING_CODE_ENABLE, default=False): cv.boolean,
|
91
|
+
cv.Optional(CONF_PING_PONG_ENABLE, default=False): cv.boolean,
|
92
|
+
cv.Optional(
|
93
|
+
CONF_PING_PONG_RECYCLE_TIME, default="600s"
|
94
|
+
): cv.positive_time_period_seconds,
|
95
|
+
cv.Optional(CONF_SENSORS): cv.ensure_list(sensor_validation(Sensor)),
|
96
|
+
cv.Optional(CONF_BINARY_SENSORS): cv.ensure_list(
|
97
|
+
sensor_validation(BinarySensor)
|
98
|
+
),
|
99
|
+
cv.Optional(CONF_PROVIDERS): cv.ensure_list(PROVIDER_SCHEMA),
|
100
|
+
},
|
101
|
+
)
|
102
|
+
.extend(ENCRYPTION_SCHEMA),
|
103
|
+
validate_,
|
104
|
+
)
|
105
|
+
|
106
|
+
SENSOR_SCHEMA = cv.Schema(
|
107
|
+
{
|
108
|
+
cv.Optional(CONF_REMOTE_ID): cv.string_strict,
|
109
|
+
cv.Required(CONF_PROVIDER): cv.valid_name,
|
110
|
+
cv.GenerateID(CONF_UDP_ID): cv.use_id(UDPComponent),
|
111
|
+
}
|
112
|
+
)
|
113
|
+
|
114
|
+
|
115
|
+
def require_internal_with_name(config):
|
116
|
+
if CONF_NAME in config and CONF_INTERNAL not in config:
|
117
|
+
raise cv.Invalid("Must provide internal: config when using name:")
|
118
|
+
return config
|
119
|
+
|
120
|
+
|
121
|
+
def hash_encryption_key(config: dict):
|
122
|
+
return list(hashlib.sha256(config[CONF_KEY].encode()).digest())
|
123
|
+
|
124
|
+
|
125
|
+
async def to_code(config):
|
126
|
+
cg.add_define("USE_UDP")
|
127
|
+
cg.add_global(udp_ns.using)
|
128
|
+
var = cg.new_Pvariable(config[CONF_ID])
|
129
|
+
await cg.register_component(var, config)
|
130
|
+
cg.add(var.set_port(config[CONF_PORT]))
|
131
|
+
cg.add(var.set_rolling_code_enable(config[CONF_ROLLING_CODE_ENABLE]))
|
132
|
+
cg.add(var.set_ping_pong_enable(config[CONF_PING_PONG_ENABLE]))
|
133
|
+
cg.add(
|
134
|
+
var.set_ping_pong_recycle_time(
|
135
|
+
config[CONF_PING_PONG_RECYCLE_TIME].total_seconds
|
136
|
+
)
|
137
|
+
)
|
138
|
+
for sens_conf in config.get(CONF_SENSORS, ()):
|
139
|
+
sens_id = sens_conf[CONF_ID]
|
140
|
+
sensor = await cg.get_variable(sens_id)
|
141
|
+
bcst_id = sens_conf.get(CONF_BROADCAST_ID, sens_id.id)
|
142
|
+
cg.add(var.add_sensor(bcst_id, sensor))
|
143
|
+
for sens_conf in config.get(CONF_BINARY_SENSORS, ()):
|
144
|
+
sens_id = sens_conf[CONF_ID]
|
145
|
+
sensor = await cg.get_variable(sens_id)
|
146
|
+
bcst_id = sens_conf.get(CONF_BROADCAST_ID, sens_id.id)
|
147
|
+
cg.add(var.add_binary_sensor(bcst_id, sensor))
|
148
|
+
for address in config[CONF_ADDRESSES]:
|
149
|
+
cg.add(var.add_address(str(address)))
|
150
|
+
|
151
|
+
if encryption := config.get(CONF_ENCRYPTION):
|
152
|
+
cg.add(var.set_encryption_key(hash_encryption_key(encryption)))
|
153
|
+
|
154
|
+
for provider in config.get(CONF_PROVIDERS, ()):
|
155
|
+
name = provider[CONF_NAME]
|
156
|
+
cg.add(var.add_provider(name))
|
157
|
+
if encryption := provider.get(CONF_ENCRYPTION):
|
158
|
+
cg.add(var.set_provider_encryption(name, hash_encryption_key(encryption)))
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import esphome.codegen as cg
|
2
|
+
from esphome.components import binary_sensor
|
3
|
+
from esphome.config_validation import All, has_at_least_one_key
|
4
|
+
from esphome.const import CONF_ID
|
5
|
+
|
6
|
+
from . import (
|
7
|
+
CONF_PROVIDER,
|
8
|
+
CONF_REMOTE_ID,
|
9
|
+
CONF_UDP_ID,
|
10
|
+
SENSOR_SCHEMA,
|
11
|
+
require_internal_with_name,
|
12
|
+
)
|
13
|
+
|
14
|
+
DEPENDENCIES = ["udp"]
|
15
|
+
|
16
|
+
CONFIG_SCHEMA = All(
|
17
|
+
binary_sensor.binary_sensor_schema().extend(SENSOR_SCHEMA),
|
18
|
+
has_at_least_one_key(CONF_ID, CONF_REMOTE_ID),
|
19
|
+
require_internal_with_name,
|
20
|
+
)
|
21
|
+
|
22
|
+
|
23
|
+
async def to_code(config):
|
24
|
+
var = await binary_sensor.new_binary_sensor(config)
|
25
|
+
comp = await cg.get_variable(config[CONF_UDP_ID])
|
26
|
+
remote_id = str(config.get(CONF_REMOTE_ID) or config.get(CONF_ID))
|
27
|
+
cg.add(comp.add_remote_binary_sensor(config[CONF_PROVIDER], remote_id, var))
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import esphome.codegen as cg
|
2
|
+
from esphome.components.sensor import new_sensor, sensor_schema
|
3
|
+
from esphome.config_validation import All, has_at_least_one_key
|
4
|
+
from esphome.const import CONF_ID
|
5
|
+
|
6
|
+
from . import (
|
7
|
+
CONF_PROVIDER,
|
8
|
+
CONF_REMOTE_ID,
|
9
|
+
CONF_UDP_ID,
|
10
|
+
SENSOR_SCHEMA,
|
11
|
+
require_internal_with_name,
|
12
|
+
)
|
13
|
+
|
14
|
+
DEPENDENCIES = ["udp"]
|
15
|
+
|
16
|
+
CONFIG_SCHEMA = All(
|
17
|
+
sensor_schema().extend(SENSOR_SCHEMA),
|
18
|
+
has_at_least_one_key(CONF_ID, CONF_REMOTE_ID),
|
19
|
+
require_internal_with_name,
|
20
|
+
)
|
21
|
+
|
22
|
+
|
23
|
+
async def to_code(config):
|
24
|
+
var = await new_sensor(config)
|
25
|
+
comp = await cg.get_variable(config[CONF_UDP_ID])
|
26
|
+
remote_id = str(config.get(CONF_REMOTE_ID) or config.get(CONF_ID))
|
27
|
+
cg.add(comp.add_remote_sensor(config[CONF_PROVIDER], remote_id, var))
|