Fix entry setup for Broadlink SP4 sensors (#53765)

pull/53865/head
Felipe Martins Diel 2021-08-02 09:59:23 -03:00 committed by GitHub
parent 4f8c799610
commit e8aee5ecf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -69,7 +69,13 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
sensors = [
BroadlinkSensor(device, monitored_condition)
for monitored_condition in sensor_data
if sensor_data[monitored_condition] != 0 or device.api.type == "A1"
if monitored_condition in SENSOR_TYPES
and (
# These devices have optional sensors.
# We don't create entities if the value is 0.
sensor_data[monitored_condition] != 0
or device.api.type not in {"RM4PRO", "RM4MINI"}
)
]
async_add_entities(sensors)