pyg90alarm 1.12.1__tar.gz → 1.13.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/PKG-INFO +1 -1
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/alarm.py +8 -2
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm.egg-info/PKG-INFO +1 -1
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/test_alarm.py +12 -1
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/.github/CODEOWNERS +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/.github/workflows/main.yml +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/.gitignore +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/.pylintrc +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/.readthedocs.yaml +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/LICENSE +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/MANIFEST.in +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/README.rst +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/.DS_Store +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/.gitignore +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/api-docs.rst +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/conf.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/index.rst +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/protocol.rst +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/requirements.txt +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/pyproject.toml +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/setup.cfg +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/setup.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/sonar-project.properties +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/__init__.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/base_cmd.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/callback.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/config.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/const.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/definitions/__init__.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/definitions/sensors.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/device_notifications.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/discovery.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/entities/__init__.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/entities/device.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/entities/sensor.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/exceptions.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/history.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/host_info.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/host_status.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/paginated_cmd.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/paginated_result.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/targeted_discovery.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/user_data_crc.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm.egg-info/SOURCES.txt +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm.egg-info/dependency_links.txt +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm.egg-info/requires.txt +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm.egg-info/top_level.txt +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/conftest.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/device_mock.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/test_base_commands.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/test_callback.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/test_discovery.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/test_notifications.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/test_paginated_commands.py +0 -0
- {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tox.ini +0 -0
|
@@ -434,7 +434,7 @@ class G90Alarm(G90DeviceNotifications):
|
|
|
434
434
|
alerts (only for `door` type sensors, if door open/close alerts are
|
|
435
435
|
enabled)
|
|
436
436
|
"""
|
|
437
|
-
_LOGGER.debug('
|
|
437
|
+
_LOGGER.debug('on_sensor_activity: %s %s %s', idx, name, occupancy)
|
|
438
438
|
sensor = await self.find_sensor(idx, name)
|
|
439
439
|
if sensor:
|
|
440
440
|
_LOGGER.debug('Setting occupancy to %s (previously %s)',
|
|
@@ -573,9 +573,15 @@ class G90Alarm(G90DeviceNotifications):
|
|
|
573
573
|
"""
|
|
574
574
|
sensor = await self.find_sensor(event_id, zone_name)
|
|
575
575
|
# The callback is still delivered to the caller even if the sensor
|
|
576
|
-
# isn't found, only `extra_data` is skipped. That is to
|
|
576
|
+
# isn't found, only `extra_data` is skipped. That is to ensure the
|
|
577
577
|
# important callback isn't filtered
|
|
578
578
|
extra_data = sensor.extra_data if sensor else None
|
|
579
|
+
# Invoke the sensor activity callback to set the sensor occupancy if
|
|
580
|
+
# sensor is known, but only if that isn't already set - it helps when
|
|
581
|
+
# device notifications on triggerring sensor's activity aren't receveid
|
|
582
|
+
# by a reason
|
|
583
|
+
if sensor and not sensor.occupancy:
|
|
584
|
+
await self.on_sensor_activity(event_id, zone_name, True)
|
|
579
585
|
|
|
580
586
|
G90Callback.invoke(
|
|
581
587
|
self._alarm_cb, event_id, zone_name, extra_data
|
|
@@ -396,7 +396,9 @@ async def test_door_open_close_callback(mock_device):
|
|
|
396
396
|
b'["Hall",100,0,1,1,0,32,0,0,16,1,0,""],'
|
|
397
397
|
b'["Room",101,0,1,1,0,32,0,0,16,1,0,""]'
|
|
398
398
|
b']]IEND\0',
|
|
399
|
-
|
|
399
|
+
# Alert configuration, used by sensor activity callback invoked when
|
|
400
|
+
# handling alarm
|
|
401
|
+
b'ISTART[117,[256]]IEND\0',
|
|
400
402
|
],
|
|
401
403
|
notification_data=[
|
|
402
404
|
b'[208,[3,100,1,1,"Hall","DUMMYGUID",1630876128,0,[""]]]\0',
|
|
@@ -425,6 +427,8 @@ async def test_alarm_callback(mock_device):
|
|
|
425
427
|
await asyncio.wait([future], timeout=0.1)
|
|
426
428
|
# Verify extra data is passed to the callback
|
|
427
429
|
alarm_cb.assert_called_once_with(100, 'Hall', 'Dummy extra data')
|
|
430
|
+
# Verify the triggering sensor is set to active
|
|
431
|
+
assert sensors[0].occupancy is True
|
|
428
432
|
|
|
429
433
|
# Simulate alarm for sensor with no extra data
|
|
430
434
|
alarm_cb.reset_mock()
|
|
@@ -433,6 +437,8 @@ async def test_alarm_callback(mock_device):
|
|
|
433
437
|
await asyncio.wait([future], timeout=0.1)
|
|
434
438
|
# Verify no extra data is passed to the callback
|
|
435
439
|
alarm_cb.assert_called_once_with(101, 'Room', None)
|
|
440
|
+
# Verify the triggering sensor is set to active
|
|
441
|
+
assert sensors[0].occupancy is True
|
|
436
442
|
|
|
437
443
|
# Simulate alarm for non-existent sensor
|
|
438
444
|
alarm_cb.reset_mock()
|
|
@@ -517,6 +523,9 @@ async def test_history(mock_device):
|
|
|
517
523
|
b'["Sensor 1",33,0,138,0,0,33,0,0,17,1,0,""],'
|
|
518
524
|
b'["Sensor 2",100,0,138,0,0,33,0,0,17,1,0,""]'
|
|
519
525
|
b']]IEND\0',
|
|
526
|
+
# Alert configuration, used by sensor activity callback invoked when
|
|
527
|
+
# handling alarm
|
|
528
|
+
b'ISTART[117,[256]]IEND\0',
|
|
520
529
|
])
|
|
521
530
|
async def test_simulate_alerts_from_history(mock_device):
|
|
522
531
|
# Callback handlers for alarm and arm/disarm, just setting their
|
|
@@ -545,9 +554,11 @@ async def test_simulate_alerts_from_history(mock_device):
|
|
|
545
554
|
# Stop simulating the alert from history
|
|
546
555
|
await g90.stop_simulating_alerts_from_history()
|
|
547
556
|
|
|
557
|
+
sensors = await g90.get_sensors()
|
|
548
558
|
# Ensure callbacks have been called and with expected arguments
|
|
549
559
|
alarm_cb.assert_called_once_with(33, 'Sensor 1', None)
|
|
550
560
|
armdisarm_cb.assert_called_once_with(3)
|
|
561
|
+
assert sensors[0].occupancy is True
|
|
551
562
|
|
|
552
563
|
|
|
553
564
|
async def test_simulate_alerts_from_history_exception(mock_device, caplog):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|