Add binary sensor, correct interval input

### Feature
*Base station on added as binary sensor

### Fix
* Bumping pyowletapi to 2024.3.2
* UI config now allows you to set interval to 5 seconds, previously the minimum was 10
This commit is contained in:
RyanClark123
2024-03-27 15:51:12 +00:00
parent faefd0b18b
commit 50c55dcfd3
6 changed files with 18 additions and 5 deletions
+5 -1
View File
@@ -83,6 +83,11 @@ SENSORS: tuple[OwletBinarySensorEntityDescription, ...] = (
translation_key="awake", translation_key="awake",
icon="mdi:sleep", icon="mdi:sleep",
), ),
OwletBinarySensorEntityDescription(
key="base_station_on",
translation_key="base_on",
device_class=BinarySensorDeviceClass.POWER,
),
) )
@@ -97,7 +102,6 @@ async def async_setup_entry(
sensors = [] sensors = []
for coordinator in coordinators: for coordinator in coordinators:
print(coordinator.sock.properties)
for sensor in SENSORS: for sensor in SENSORS:
if sensor.key in coordinator.sock.properties: if sensor.key in coordinator.sock.properties:
sensors.append(OwletBinarySensor(coordinator, sensor)) sensors.append(OwletBinarySensor(coordinator, sensor))
+1 -1
View File
@@ -165,7 +165,7 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
vol.Required( vol.Required(
CONF_SCAN_INTERVAL, CONF_SCAN_INTERVAL,
default=self.config_entry.options.get(CONF_SCAN_INTERVAL), default=self.config_entry.options.get(CONF_SCAN_INTERVAL),
): vol.All(vol.Coerce(int), vol.Range(min=10)), ): vol.All(vol.Coerce(int), vol.Range(min=5)),
} }
) )
+2 -2
View File
@@ -9,7 +9,7 @@
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"issue_tracker": "https://github.com/ryanbdclark/owlet/issues", "issue_tracker": "https://github.com/ryanbdclark/owlet/issues",
"requirements": [ "requirements": [
"pyowletapi==2023.11.4" "pyowletapi==2024.3.2"
], ],
"version": "2023.11.2" "version": "2024.3.1"
} }
+3
View File
@@ -74,6 +74,9 @@
}, },
"awake": { "awake": {
"name": "Awake" "name": "Awake"
},
"base_on": {
"name": "Base station on"
} }
}, },
"sensor": { "sensor": {
+4 -1
View File
@@ -74,7 +74,10 @@
}, },
"awake": { "awake": {
"name": "Awake" "name": "Awake"
} },
"base_on": {
"name": "Base station on"
}
}, },
"sensor": { "sensor": {
"batterypercent": { "batterypercent": {
@@ -74,6 +74,9 @@
}, },
"awake": { "awake": {
"name": "Awake" "name": "Awake"
},
"base_on": {
"name": "Base station on"
} }
}, },
"sensor": { "sensor": {