mirror of
https://github.com/esphome/esphome.git
synced 2024-11-14 02:58:11 +01:00
commit
b37d3a66cc
3 changed files with 15 additions and 7 deletions
|
@ -67,7 +67,7 @@ async def to_code(config):
|
||||||
var.set_service_uuid32(esp32_ble_tracker.as_hex(config[CONF_SERVICE_UUID]))
|
var.set_service_uuid32(esp32_ble_tracker.as_hex(config[CONF_SERVICE_UUID]))
|
||||||
)
|
)
|
||||||
elif len(config[CONF_SERVICE_UUID]) == len(esp32_ble_tracker.bt_uuid128_format):
|
elif len(config[CONF_SERVICE_UUID]) == len(esp32_ble_tracker.bt_uuid128_format):
|
||||||
uuid128 = esp32_ble_tracker.as_hex_array(config[CONF_SERVICE_UUID])
|
uuid128 = esp32_ble_tracker.as_reversed_hex_array(config[CONF_SERVICE_UUID])
|
||||||
cg.add(var.set_service_uuid128(uuid128))
|
cg.add(var.set_service_uuid128(uuid128))
|
||||||
|
|
||||||
if len(config[CONF_CHARACTERISTIC_UUID]) == len(esp32_ble_tracker.bt_uuid16_format):
|
if len(config[CONF_CHARACTERISTIC_UUID]) == len(esp32_ble_tracker.bt_uuid16_format):
|
||||||
|
@ -87,7 +87,9 @@ async def to_code(config):
|
||||||
elif len(config[CONF_CHARACTERISTIC_UUID]) == len(
|
elif len(config[CONF_CHARACTERISTIC_UUID]) == len(
|
||||||
esp32_ble_tracker.bt_uuid128_format
|
esp32_ble_tracker.bt_uuid128_format
|
||||||
):
|
):
|
||||||
uuid128 = esp32_ble_tracker.as_hex_array(config[CONF_CHARACTERISTIC_UUID])
|
uuid128 = esp32_ble_tracker.as_reversed_hex_array(
|
||||||
|
config[CONF_CHARACTERISTIC_UUID]
|
||||||
|
)
|
||||||
cg.add(var.set_char_uuid128(uuid128))
|
cg.add(var.set_char_uuid128(uuid128))
|
||||||
|
|
||||||
if CONF_DESCRIPTOR_UUID in config:
|
if CONF_DESCRIPTOR_UUID in config:
|
||||||
|
@ -108,7 +110,9 @@ async def to_code(config):
|
||||||
elif len(config[CONF_DESCRIPTOR_UUID]) == len(
|
elif len(config[CONF_DESCRIPTOR_UUID]) == len(
|
||||||
esp32_ble_tracker.bt_uuid128_format
|
esp32_ble_tracker.bt_uuid128_format
|
||||||
):
|
):
|
||||||
uuid128 = esp32_ble_tracker.as_hex_array(config[CONF_DESCRIPTOR_UUID])
|
uuid128 = esp32_ble_tracker.as_reversed_hex_array(
|
||||||
|
config[CONF_DESCRIPTOR_UUID]
|
||||||
|
)
|
||||||
cg.add(var.set_descr_uuid128(uuid128))
|
cg.add(var.set_descr_uuid128(uuid128))
|
||||||
|
|
||||||
if CONF_LAMBDA in config:
|
if CONF_LAMBDA in config:
|
||||||
|
|
|
@ -141,12 +141,16 @@ void SenseAirComponent::abc_get_period() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SenseAirComponent::senseair_write_command_(const uint8_t *command, uint8_t *response, uint8_t response_length) {
|
bool SenseAirComponent::senseair_write_command_(const uint8_t *command, uint8_t *response, uint8_t response_length) {
|
||||||
|
// Verify we have somewhere to store the response
|
||||||
|
if (response == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Write wake up byte required by some S8 sensor models
|
||||||
|
this->write_byte(0);
|
||||||
this->flush();
|
this->flush();
|
||||||
|
delay(5);
|
||||||
this->write_array(command, SENSEAIR_REQUEST_LENGTH);
|
this->write_array(command, SENSEAIR_REQUEST_LENGTH);
|
||||||
|
|
||||||
if (response == nullptr)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
bool ret = this->read_array(response, response_length);
|
bool ret = this->read_array(response, response_length);
|
||||||
this->flush();
|
this->flush();
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Constants used by esphome."""
|
"""Constants used by esphome."""
|
||||||
|
|
||||||
__version__ = "2021.11.0b8"
|
__version__ = "2021.11.0b9"
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue