mirror of
https://github.com/esphome/esphome.git
synced 2025-11-01 15:41:52 +00:00
Compare commits
13 Commits
2021.11.0b
...
2021.11.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6226dae05c | ||
|
|
9c6a475a6e | ||
|
|
8294d10d5b | ||
|
|
67558bec47 | ||
|
|
84873d4074 | ||
|
|
58a0b28a39 | ||
|
|
b37d3a66cc | ||
|
|
7e495a5e27 | ||
|
|
c41547fd4a | ||
|
|
0d47d41c85 | ||
|
|
41a3a17456 | ||
|
|
cbbafbcca2 | ||
|
|
c75566b374 |
@@ -49,6 +49,7 @@ from esphome.const import (
|
||||
DEVICE_CLASS_SMOKE,
|
||||
DEVICE_CLASS_SOUND,
|
||||
DEVICE_CLASS_TAMPER,
|
||||
DEVICE_CLASS_UPDATE,
|
||||
DEVICE_CLASS_VIBRATION,
|
||||
DEVICE_CLASS_WINDOW,
|
||||
)
|
||||
@@ -82,6 +83,7 @@ DEVICE_CLASSES = [
|
||||
DEVICE_CLASS_SMOKE,
|
||||
DEVICE_CLASS_SOUND,
|
||||
DEVICE_CLASS_TAMPER,
|
||||
DEVICE_CLASS_UPDATE,
|
||||
DEVICE_CLASS_VIBRATION,
|
||||
DEVICE_CLASS_WINDOW,
|
||||
]
|
||||
|
||||
@@ -67,7 +67,7 @@ async def to_code(config):
|
||||
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):
|
||||
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))
|
||||
|
||||
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(
|
||||
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))
|
||||
|
||||
if CONF_DESCRIPTOR_UUID in config:
|
||||
@@ -108,7 +110,9 @@ async def to_code(config):
|
||||
elif len(config[CONF_DESCRIPTOR_UUID]) == len(
|
||||
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))
|
||||
|
||||
if CONF_LAMBDA in config:
|
||||
|
||||
@@ -33,7 +33,7 @@ class AQICalculator : public AbstractAQICalculator {
|
||||
int conc_lo = array[grid_index][0];
|
||||
int conc_hi = array[grid_index][1];
|
||||
|
||||
return ((aqi_hi - aqi_lo) / (conc_hi - conc_lo)) * (value - conc_lo) + aqi_lo;
|
||||
return (value - conc_lo) * (aqi_hi - aqi_lo) / (conc_hi - conc_lo) + aqi_lo;
|
||||
}
|
||||
|
||||
int get_grid_index_(uint16_t value, int array[AMOUNT_OF_LEVELS][2]) {
|
||||
|
||||
@@ -37,9 +37,7 @@ class CAQICalculator : public AbstractAQICalculator {
|
||||
int conc_lo = array[grid_index][0];
|
||||
int conc_hi = array[grid_index][1];
|
||||
|
||||
int aqi = ((aqi_hi - aqi_lo) / (conc_hi - conc_lo)) * (value - conc_lo) + aqi_lo;
|
||||
|
||||
return aqi;
|
||||
return (value - conc_lo) * (aqi_hi - aqi_lo) / (conc_hi - conc_lo) + aqi_lo;
|
||||
}
|
||||
|
||||
int get_grid_index_(uint16_t value, int array[AMOUNT_OF_LEVELS][2]) {
|
||||
|
||||
@@ -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) {
|
||||
// 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();
|
||||
delay(5);
|
||||
this->write_array(command, SENSEAIR_REQUEST_LENGTH);
|
||||
|
||||
if (response == nullptr)
|
||||
return true;
|
||||
|
||||
bool ret = this->read_array(response, response_length);
|
||||
this->flush();
|
||||
return ret;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Constants used by esphome."""
|
||||
|
||||
__version__ = "2021.11.0b7"
|
||||
__version__ = "2021.11.1"
|
||||
|
||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||
|
||||
@@ -883,6 +883,7 @@ DEVICE_CLASS_SAFETY = "safety"
|
||||
DEVICE_CLASS_SMOKE = "smoke"
|
||||
DEVICE_CLASS_SOUND = "sound"
|
||||
DEVICE_CLASS_TAMPER = "tamper"
|
||||
DEVICE_CLASS_UPDATE = "update"
|
||||
DEVICE_CLASS_VIBRATION = "vibration"
|
||||
DEVICE_CLASS_WINDOW = "window"
|
||||
# device classes of both binary_sensor and sensor component
|
||||
|
||||
@@ -13,8 +13,9 @@ from zeroconf import (
|
||||
RecordUpdateListener,
|
||||
Zeroconf,
|
||||
ServiceBrowser,
|
||||
ServiceStateChange,
|
||||
current_time_millis,
|
||||
)
|
||||
from zeroconf._services import ServiceStateChange
|
||||
|
||||
_CLASS_IN = 1
|
||||
_FLAGS_QR_QUERY = 0x0000 # query
|
||||
@@ -88,7 +89,7 @@ class DashboardStatus(threading.Thread):
|
||||
entries = self.zc.cache.entries_with_name(key)
|
||||
if not entries:
|
||||
return False
|
||||
now = time.time() * 1000
|
||||
now = current_time_millis()
|
||||
|
||||
return any(
|
||||
(entry.created + DashboardStatus.OFFLINE_AFTER) >= now for entry in entries
|
||||
@@ -99,7 +100,7 @@ class DashboardStatus(threading.Thread):
|
||||
self.on_update(
|
||||
{key: self.host_status(host) for key, host in self.key_to_host.items()}
|
||||
)
|
||||
now = time.time() * 1000
|
||||
now = current_time_millis()
|
||||
for host in self.query_hosts:
|
||||
entries = self.zc.cache.entries_with_name(host)
|
||||
if not entries or all(
|
||||
|
||||
Reference in New Issue
Block a user