Merge pull request #2319 from esphome/bump-2021.9.0b5

2021.9.0b5
This commit is contained in:
Jesse Hills 2021-09-15 19:51:55 +12:00 committed by GitHub
commit aa8eb2c92a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 112 additions and 32 deletions

View File

@ -15,7 +15,7 @@ _LOGGER = logging.getLogger(__name__)
async def async_run_logs(config, address):
conf = config["api"]
port: int = conf[CONF_PORT]
port: int = int(conf[CONF_PORT])
password: str = conf[CONF_PASSWORD]
noise_psk: Optional[str] = None
if CONF_ENCRYPTION in conf:

View File

@ -13,9 +13,13 @@ from esphome.const import (
STATE_CLASS_NONE,
STATE_CLASS_TOTAL_INCREASING,
UNIT_AMPERE,
UNIT_CUBIC_METER,
UNIT_EMPTY,
UNIT_KILOWATT,
UNIT_KILOWATT_HOURS,
UNIT_KILOVOLT_AMPS_REACTIVE_HOURS,
UNIT_KILOVOLT_AMPS_REACTIVE,
UNIT_VOLT,
UNIT_WATT,
)
from . import Dsmr, CONF_DSMR_ID
@ -26,40 +30,80 @@ CONFIG_SCHEMA = cv.Schema(
{
cv.GenerateID(CONF_DSMR_ID): cv.use_id(Dsmr),
cv.Optional("energy_delivered_lux"): sensor.sensor_schema(
"kWh", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_TOTAL_INCREASING
UNIT_KILOWATT_HOURS,
ICON_EMPTY,
3,
DEVICE_CLASS_ENERGY,
STATE_CLASS_TOTAL_INCREASING,
),
cv.Optional("energy_delivered_tariff1"): sensor.sensor_schema(
"kWh", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_TOTAL_INCREASING
UNIT_KILOWATT_HOURS,
ICON_EMPTY,
3,
DEVICE_CLASS_ENERGY,
STATE_CLASS_TOTAL_INCREASING,
),
cv.Optional("energy_delivered_tariff2"): sensor.sensor_schema(
"kWh", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_TOTAL_INCREASING
UNIT_KILOWATT_HOURS,
ICON_EMPTY,
3,
DEVICE_CLASS_ENERGY,
STATE_CLASS_TOTAL_INCREASING,
),
cv.Optional("energy_returned_lux"): sensor.sensor_schema(
"kWh", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_TOTAL_INCREASING
UNIT_KILOWATT_HOURS,
ICON_EMPTY,
3,
DEVICE_CLASS_ENERGY,
STATE_CLASS_TOTAL_INCREASING,
),
cv.Optional("energy_returned_tariff1"): sensor.sensor_schema(
"kWh", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_TOTAL_INCREASING
UNIT_KILOWATT_HOURS,
ICON_EMPTY,
3,
DEVICE_CLASS_ENERGY,
STATE_CLASS_TOTAL_INCREASING,
),
cv.Optional("energy_returned_tariff2"): sensor.sensor_schema(
"kWh", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_TOTAL_INCREASING
UNIT_KILOWATT_HOURS,
ICON_EMPTY,
3,
DEVICE_CLASS_ENERGY,
STATE_CLASS_TOTAL_INCREASING,
),
cv.Optional("total_imported_energy"): sensor.sensor_schema(
"kvarh", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_NONE
UNIT_KILOVOLT_AMPS_REACTIVE_HOURS,
ICON_EMPTY,
3,
DEVICE_CLASS_ENERGY,
STATE_CLASS_NONE,
),
cv.Optional("total_exported_energy"): sensor.sensor_schema(
"kvarh", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_NONE
UNIT_KILOVOLT_AMPS_REACTIVE_HOURS,
ICON_EMPTY,
3,
DEVICE_CLASS_ENERGY,
STATE_CLASS_NONE,
),
cv.Optional("power_delivered"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOWATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
),
cv.Optional("power_returned"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOWATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
),
cv.Optional("reactive_power_delivered"): sensor.sensor_schema(
"kvar", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_NONE
UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY,
3,
DEVICE_CLASS_POWER,
STATE_CLASS_MEASUREMENT,
),
cv.Optional("reactive_power_returned"): sensor.sensor_schema(
"kvar", ICON_EMPTY, 3, DEVICE_CLASS_ENERGY, STATE_CLASS_MEASUREMENT
UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY,
3,
DEVICE_CLASS_POWER,
STATE_CLASS_MEASUREMENT,
),
cv.Optional("electricity_threshold"): sensor.sensor_schema(
UNIT_EMPTY, ICON_EMPTY, 3, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE
@ -77,13 +121,13 @@ CONFIG_SCHEMA = cv.Schema(
UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE
),
cv.Optional("electricity_sags_l2"): sensor.sensor_schema(
UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_MEASUREMENT
UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE
),
cv.Optional("electricity_sags_l3"): sensor.sensor_schema(
UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE
),
cv.Optional("electricity_swells_l1"): sensor.sensor_schema(
UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_MEASUREMENT
UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE
),
cv.Optional("electricity_swells_l2"): sensor.sensor_schema(
UNIT_EMPTY, ICON_EMPTY, 0, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE
@ -101,40 +145,64 @@ CONFIG_SCHEMA = cv.Schema(
UNIT_AMPERE, ICON_EMPTY, 1, DEVICE_CLASS_CURRENT, STATE_CLASS_MEASUREMENT
),
cv.Optional("power_delivered_l1"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOWATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
),
cv.Optional("power_delivered_l2"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOWATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
),
cv.Optional("power_delivered_l3"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOWATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
),
cv.Optional("power_returned_l1"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOWATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
),
cv.Optional("power_returned_l2"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOWATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
),
cv.Optional("power_returned_l3"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOWATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
),
cv.Optional("reactive_power_delivered_l1"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY,
3,
DEVICE_CLASS_POWER,
STATE_CLASS_MEASUREMENT,
),
cv.Optional("reactive_power_delivered_l2"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY,
3,
DEVICE_CLASS_POWER,
STATE_CLASS_MEASUREMENT,
),
cv.Optional("reactive_power_delivered_l3"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY,
3,
DEVICE_CLASS_POWER,
STATE_CLASS_MEASUREMENT,
),
cv.Optional("reactive_power_returned_l1"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY,
3,
DEVICE_CLASS_POWER,
STATE_CLASS_MEASUREMENT,
),
cv.Optional("reactive_power_returned_l2"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY,
3,
DEVICE_CLASS_POWER,
STATE_CLASS_MEASUREMENT,
),
cv.Optional("reactive_power_returned_l3"): sensor.sensor_schema(
UNIT_WATT, ICON_EMPTY, 3, DEVICE_CLASS_POWER, STATE_CLASS_MEASUREMENT
UNIT_KILOVOLT_AMPS_REACTIVE,
ICON_EMPTY,
3,
DEVICE_CLASS_POWER,
STATE_CLASS_MEASUREMENT,
),
cv.Optional("voltage_l1"): sensor.sensor_schema(
UNIT_VOLT, ICON_EMPTY, 1, DEVICE_CLASS_VOLTAGE, STATE_CLASS_NONE
@ -146,10 +214,18 @@ CONFIG_SCHEMA = cv.Schema(
UNIT_VOLT, ICON_EMPTY, 1, DEVICE_CLASS_VOLTAGE, STATE_CLASS_NONE
),
cv.Optional("gas_delivered"): sensor.sensor_schema(
"", ICON_EMPTY, 3, DEVICE_CLASS_GAS, STATE_CLASS_TOTAL_INCREASING
UNIT_CUBIC_METER,
ICON_EMPTY,
3,
DEVICE_CLASS_GAS,
STATE_CLASS_TOTAL_INCREASING,
),
cv.Optional("gas_delivered_be"): sensor.sensor_schema(
"", ICON_EMPTY, 3, DEVICE_CLASS_GAS, STATE_CLASS_TOTAL_INCREASING
UNIT_CUBIC_METER,
ICON_EMPTY,
3,
DEVICE_CLASS_GAS,
STATE_CLASS_TOTAL_INCREASING,
),
}
).extend(cv.COMPONENT_SCHEMA)

View File

@ -244,6 +244,8 @@ void WiFiComponent::save_wifi_sta(const std::string &ssid, const std::string &pa
sta.set_ssid(ssid);
sta.set_password(password);
this->set_sta(sta);
this->start_scanning();
}
void WiFiComponent::start_connecting(const WiFiAP &ap, bool two) {

View File

@ -1,6 +1,6 @@
"""Constants used by esphome."""
__version__ = "2021.9.0b4"
__version__ = "2021.9.0b5"
ESP_PLATFORM_ESP32 = "ESP32"
ESP_PLATFORM_ESP8266 = "ESP8266"
@ -786,7 +786,9 @@ UNIT_KELVIN = "K"
UNIT_KILOGRAM = "kg"
UNIT_KILOMETER = "km"
UNIT_KILOMETER_PER_HOUR = "km/h"
UNIT_KILOVOLT_AMPS_REACTIVE = "kVAr"
UNIT_KILOVOLT_AMPS_REACTIVE_HOURS = "kVArh"
UNIT_KILOWATT = "kW"
UNIT_KILOWATT_HOURS = "kWh"
UNIT_LUX = "lx"
UNIT_METER = "m"

View File

@ -49,7 +49,7 @@ class HostResolver(RecordUpdateListener):
next_ = now + delay
delay *= 2
zc.wait(min(next_, last) - now)
time.sleep(min(next_, last) - now)
now = time.time()
finally:
zc.remove_listener(self)