Skip to content

Commit

Permalink
Add binary sensor, correct interval input
Browse files Browse the repository at this point in the history
### 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
  • Loading branch information
ryanbdclark committed Mar 27, 2024
1 parent faefd0b commit 50c55dc
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
6 changes: 5 additions & 1 deletion custom_components/owlet/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ class OwletBinarySensorEntityDescription(BinarySensorEntityDescription):
translation_key="awake",
icon="mdi:sleep",
),
OwletBinarySensorEntityDescription(
key="base_station_on",
translation_key="base_on",
device_class=BinarySensorDeviceClass.POWER,
),
)


Expand All @@ -97,7 +102,6 @@ async def async_setup_entry(

sensors = []
for coordinator in coordinators:
print(coordinator.sock.properties)
for sensor in SENSORS:
if sensor.key in coordinator.sock.properties:
sensors.append(OwletBinarySensor(coordinator, sensor))
Expand Down
2 changes: 1 addition & 1 deletion custom_components/owlet/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ async def async_step_init(
vol.Required(
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)),
}
)

Expand Down
4 changes: 2 additions & 2 deletions custom_components/owlet/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/ryanbdclark/owlet/issues",
"requirements": [
"pyowletapi==2023.11.4"
"pyowletapi==2024.3.2"
],
"version": "2023.11.2"
"version": "2024.3.1"
}
3 changes: 3 additions & 0 deletions custom_components/owlet/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
},
"awake": {
"name": "Awake"
},
"base_on": {
"name": "Base station on"
}
},
"sensor": {
Expand Down
5 changes: 4 additions & 1 deletion custom_components/owlet/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@
},
"awake": {
"name": "Awake"
}
},
"base_on": {
"name": "Base station on"
}
},
"sensor": {
"batterypercent": {
Expand Down
3 changes: 3 additions & 0 deletions custom_components/owlet/translations/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
},
"awake": {
"name": "Awake"
},
"base_on": {
"name": "Base station on"
}
},
"sensor": {
Expand Down

0 comments on commit 50c55dc

Please sign in to comment.