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.
Files changed (55) hide show
  1. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/PKG-INFO +1 -1
  2. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/alarm.py +8 -2
  3. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm.egg-info/PKG-INFO +1 -1
  4. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/test_alarm.py +12 -1
  5. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/.github/CODEOWNERS +0 -0
  6. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/.github/workflows/main.yml +0 -0
  7. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/.gitignore +0 -0
  8. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/.pylintrc +0 -0
  9. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/.readthedocs.yaml +0 -0
  10. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/LICENSE +0 -0
  11. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/MANIFEST.in +0 -0
  12. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/README.rst +0 -0
  13. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/.DS_Store +0 -0
  14. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/.gitignore +0 -0
  15. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/api-docs.rst +0 -0
  16. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/conf.py +0 -0
  17. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/index.rst +0 -0
  18. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/protocol.rst +0 -0
  19. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/docs/requirements.txt +0 -0
  20. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/pyproject.toml +0 -0
  21. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/setup.cfg +0 -0
  22. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/setup.py +0 -0
  23. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/sonar-project.properties +0 -0
  24. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/__init__.py +0 -0
  25. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/base_cmd.py +0 -0
  26. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/callback.py +0 -0
  27. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/config.py +0 -0
  28. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/const.py +0 -0
  29. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/definitions/__init__.py +0 -0
  30. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/definitions/sensors.py +0 -0
  31. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/device_notifications.py +0 -0
  32. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/discovery.py +0 -0
  33. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/entities/__init__.py +0 -0
  34. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/entities/device.py +0 -0
  35. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/entities/sensor.py +0 -0
  36. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/exceptions.py +0 -0
  37. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/history.py +0 -0
  38. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/host_info.py +0 -0
  39. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/host_status.py +0 -0
  40. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/paginated_cmd.py +0 -0
  41. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/paginated_result.py +0 -0
  42. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/targeted_discovery.py +0 -0
  43. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm/user_data_crc.py +0 -0
  44. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm.egg-info/SOURCES.txt +0 -0
  45. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm.egg-info/dependency_links.txt +0 -0
  46. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm.egg-info/requires.txt +0 -0
  47. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/src/pyg90alarm.egg-info/top_level.txt +0 -0
  48. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/conftest.py +0 -0
  49. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/device_mock.py +0 -0
  50. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/test_base_commands.py +0 -0
  51. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/test_callback.py +0 -0
  52. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/test_discovery.py +0 -0
  53. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/test_notifications.py +0 -0
  54. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tests/test_paginated_commands.py +0 -0
  55. {pyg90alarm-1.12.1 → pyg90alarm-1.13.0}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyg90alarm
3
- Version: 1.12.1
3
+ Version: 1.13.0
4
4
  Summary: G90 Alarm system protocol
5
5
  Home-page: https://github.com/hostcc/pyg90alarm
6
6
  Author: Ilia Sotnikov
@@ -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('on_sensor_acitvity: %s %s %s', idx, name, occupancy)
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 ensur the
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyg90alarm
3
- Version: 1.12.1
3
+ Version: 1.13.0
4
4
  Summary: G90 Alarm system protocol
5
5
  Home-page: https://github.com/hostcc/pyg90alarm
6
6
  Author: Ilia Sotnikov
@@ -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