2017-03-06 11:15:08 +00:00
|
|
|
"""The tests for the Ring sensor platform."""
|
2020-01-14 20:54:45 +00:00
|
|
|
from .common import setup_platform
|
2019-12-09 10:58:40 +00:00
|
|
|
|
2020-01-14 20:54:45 +00:00
|
|
|
WIFI_ENABLED = False
|
2017-03-06 11:15:08 +00:00
|
|
|
|
2019-12-09 10:58:40 +00:00
|
|
|
|
2020-01-14 20:54:45 +00:00
|
|
|
async def test_sensor(hass, requests_mock):
|
|
|
|
"""Test the Ring sensors."""
|
|
|
|
await setup_platform(hass, "sensor")
|
2017-03-06 11:15:08 +00:00
|
|
|
|
2020-01-14 20:54:45 +00:00
|
|
|
front_battery_state = hass.states.get("sensor.front_battery")
|
|
|
|
assert front_battery_state is not None
|
|
|
|
assert front_battery_state.state == "80"
|
2017-03-06 11:15:08 +00:00
|
|
|
|
2020-01-14 20:54:45 +00:00
|
|
|
front_door_battery_state = hass.states.get("sensor.front_door_battery")
|
|
|
|
assert front_door_battery_state is not None
|
|
|
|
assert front_door_battery_state.state == "100"
|
2017-03-06 11:15:08 +00:00
|
|
|
|
2020-01-14 20:54:45 +00:00
|
|
|
downstairs_volume_state = hass.states.get("sensor.downstairs_volume")
|
|
|
|
assert downstairs_volume_state is not None
|
|
|
|
assert downstairs_volume_state.state == "2"
|
2017-03-06 11:15:08 +00:00
|
|
|
|
2020-01-14 20:54:45 +00:00
|
|
|
front_door_last_activity_state = hass.states.get("sensor.front_door_last_activity")
|
|
|
|
assert front_door_last_activity_state is not None
|
2017-03-06 11:15:08 +00:00
|
|
|
|
2020-01-14 20:54:45 +00:00
|
|
|
downstairs_wifi_signal_strength_state = hass.states.get(
|
|
|
|
"sensor.downstairs_wifi_signal_strength"
|
|
|
|
)
|
2017-03-06 11:15:08 +00:00
|
|
|
|
2020-01-14 20:54:45 +00:00
|
|
|
if not WIFI_ENABLED:
|
|
|
|
return
|
2017-03-06 11:15:08 +00:00
|
|
|
|
2020-01-14 20:54:45 +00:00
|
|
|
assert downstairs_wifi_signal_strength_state is not None
|
|
|
|
assert downstairs_wifi_signal_strength_state.state == "-39"
|
2020-01-10 20:35:31 +00:00
|
|
|
|
2020-01-14 20:54:45 +00:00
|
|
|
front_door_wifi_signal_category_state = hass.states.get(
|
|
|
|
"sensor.front_door_wifi_signal_category"
|
|
|
|
)
|
|
|
|
assert front_door_wifi_signal_category_state is not None
|
|
|
|
assert front_door_wifi_signal_category_state.state == "good"
|
2017-03-06 11:15:08 +00:00
|
|
|
|
2020-01-14 20:54:45 +00:00
|
|
|
front_door_wifi_signal_strength_state = hass.states.get(
|
|
|
|
"sensor.front_door_wifi_signal_strength"
|
|
|
|
)
|
|
|
|
assert front_door_wifi_signal_strength_state is not None
|
|
|
|
assert front_door_wifi_signal_strength_state.state == "-58"
|