boneIO 1.2.0.dev19__py3-none-any.whl → 1.2.0.dev20__py3-none-any.whl

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.
@@ -67,7 +67,8 @@ class InputManager:
67
67
  self._event_pins = event_pins
68
68
  self._binary_pins = binary_pins
69
69
  # Track inputs that already had first long press published to MQTT (for single mode)
70
- self._long_press_mqtt_published: set[str] = set()
70
+ # Maps input_id -> timestamp of last long press MQTT publish
71
+ self._long_press_mqtt_last_ts: dict[str, float] = {}
71
72
 
72
73
  # Configure inputs
73
74
  self._configure_inputs()
@@ -659,22 +660,28 @@ class InputManager:
659
660
  return
660
661
 
661
662
  # Long press MQTT mode filtering:
662
- # In 'single' mode, only publish the first long press event to MQTT.
663
+ # In 'single' mode, only publish the first long press event per press cycle.
663
664
  # Periodic updates (with growing duration) are skipped to avoid
664
665
  # triggering repeated actions in Node-RED or other MQTT consumers.
666
+ # A new press cycle is detected when duration resets (new duration < last duration).
665
667
  if click_type == LONG:
666
668
  mqtt_mode = getattr(input_instance, 'long_press_mqtt_mode', 'single')
667
669
  if mqtt_mode == "single":
668
- if input_id in self._long_press_mqtt_published:
670
+ current_duration = event.duration or 0.0
671
+ last_duration = self._long_press_mqtt_last_ts.get(input_id, 0.0)
672
+ if current_duration > last_duration and last_duration > 0.0:
673
+ # Duration is growing — this is a periodic update, skip it
669
674
  _LOGGER.debug(
670
- "Skipping periodic long press MQTT for %s (mode=single, already published)",
671
- input_id
675
+ "Skipping periodic long press MQTT for %s (mode=single, duration=%.3f > last=%.3f)",
676
+ input_id, current_duration, last_duration
672
677
  )
678
+ self._long_press_mqtt_last_ts[input_id] = current_duration
673
679
  return
674
- self._long_press_mqtt_published.add(input_id)
680
+ # New press cycle (duration reset) or first long press — publish
681
+ self._long_press_mqtt_last_ts[input_id] = current_duration
675
682
  else:
676
- # Any non-long event clears the tracking (button released, new click cycle)
677
- self._long_press_mqtt_published.discard(input_id)
683
+ # Any non-long event clears the tracking
684
+ self._long_press_mqtt_last_ts.pop(input_id, None)
678
685
 
679
686
  event_payload: dict[str, str | float | None] = {"event_type": click_type}
680
687
  if event.duration is not None:
boneio/version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  # flake8: noqa
2
- __version__ = "1.2.0dev19"
2
+ __version__ = "1.2.0dev20"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: boneio
3
- Version: 1.2.0.dev19
3
+ Version: 1.2.0.dev20
4
4
  Summary: Python App for BoneIO
5
5
  Author-email: Paweł Szafer <pszafer@gmail.com>
6
6
  License: GNU General Public License v3.0
@@ -3,7 +3,7 @@ boneio/bonecli.py,sha256=7T5UAeiH65BUiPQXWLT5LrKcYL2apV3asvAFieHx2fg,10054
3
3
  boneio/const.py,sha256=JNOvRTo3emE4kbg_6B6UaREYdL1crzeUR68xGOFuGF0,6098
4
4
  boneio/exceptions.py,sha256=cBph-TsLF7FSz6p4wYeMs3pjVmVRaNQRJP82JgYYV-c,810
5
5
  boneio/runner.py,sha256=0SmyRqss0B7qJqglzt8lauuuB_Cv29rnB-pRQZ37dBk,12476
6
- boneio/version.py,sha256=z206s_9m40-kIvtwYczWApPU1xqVnw8jzU4yU1iL08c,42
6
+ boneio/version.py,sha256=hLuX2P6A0HmCatIUOFnIwjAy5TaaRWymUtKTpifgDvU,42
7
7
  boneio/boards/0.2/input.yaml,sha256=3HA3rBG23frhZWDcNu76U-Hz5r_uG6WvSsGnXkNE4nE,1581
8
8
  boneio/boards/0.2/output_24_16.yaml,sha256=GQGM3gUK7UobdGL-Ejt9UKdCs1HLPgZ7kziVZ1tjQlA,1462
9
9
  boneio/boards/0.2/output_32_10.yaml,sha256=169ubuzRqFLGiOr7zgB1xL1tKdQyOx2FJZvTCkxCA4U,1920
@@ -88,7 +88,7 @@ boneio/core/events/bus.py,sha256=6AwQyFvwjyD1PGxvQ5eEiOGlaCw3mlmKzxMdJ4XLkPU,173
88
88
  boneio/core/manager/__init__.py,sha256=Vp6LqoIoQnHrGlZRRTNb1VVuzp7Y6VWsor1FmoVjL6k,1071
89
89
  boneio/core/manager/covers.py,sha256=i1mblzS6kqVrPDpEZbfKtthFx7dT8_rnu-6cS4-YNwo,17739
90
90
  boneio/core/manager/display.py,sha256=qXOHMbSer62Br3HdQGHC8G1VJBa5mwSpI8RmKSCF4dM,9237
91
- boneio/core/manager/inputs.py,sha256=ZZgAmXSyO4iUF3QFeNIfCxEsiuo4bBRCnEAyLFtRFiI,36696
91
+ boneio/core/manager/inputs.py,sha256=vOOY5G_vl5MM9ZVspeIzAt4mSROHwi3OfB8HFJU_944,37306
92
92
  boneio/core/manager/manager.py,sha256=YE5RiXjdWEdaibsHGgxt1IDBULWrATEpzR9nWNXhCtA,49531
93
93
  boneio/core/manager/modbus.py,sha256=Pn96F4uXBL0UMAcqM21C7NK6hR9J8soW0quJFdPSfZQ,15788
94
94
  boneio/core/manager/outputs.py,sha256=Ao7qX6lR67IidxeVwjibNflaET_pnK2OGGBm_VMRTXI,33839
@@ -431,9 +431,9 @@ boneio/webui/schema/virtual_energy_sensor.schema.json,sha256=BN6Egh-CAnXSa80bQ6Y
431
431
  boneio/webui/schema/web.schema.json,sha256=cactLq1MVwDL5hu8bLeuq5yiz49BWVS4OtjWLmhbw2M,2592
432
432
  boneio/webui/services/__init__.py,sha256=do_t59tE9zi1qNKkbkq6Et-gc5et4iKyYMntnQBXVG8,282
433
433
  boneio/webui/services/logs.py,sha256=ampdsOx_xwOr0gRC-fW65c1y5Po0nACgUw0tG2bdqUM,11426
434
- boneio-1.2.0.dev19.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
435
- boneio-1.2.0.dev19.dist-info/METADATA,sha256=FJQ5yDjarPxvfEo3cl6Lv5ogdD5LZvL6A3DtMrBvQmU,1924
436
- boneio-1.2.0.dev19.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
437
- boneio-1.2.0.dev19.dist-info/entry_points.txt,sha256=JX7gluDIkQ6MBlzzxGHMItnBjciiJ73tsXwYcazMW_U,47
438
- boneio-1.2.0.dev19.dist-info/top_level.txt,sha256=ag9S5n1_KXZfyk9tN8R0YUDYbdA--e5a2w2FOD_yMdg,7
439
- boneio-1.2.0.dev19.dist-info/RECORD,,
434
+ boneio-1.2.0.dev20.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
435
+ boneio-1.2.0.dev20.dist-info/METADATA,sha256=B67cSTNWyyfj3fEm2jZEfeKy-ldF6CwitaEJNjU2J78,1924
436
+ boneio-1.2.0.dev20.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
437
+ boneio-1.2.0.dev20.dist-info/entry_points.txt,sha256=JX7gluDIkQ6MBlzzxGHMItnBjciiJ73tsXwYcazMW_U,47
438
+ boneio-1.2.0.dev20.dist-info/top_level.txt,sha256=ag9S5n1_KXZfyk9tN8R0YUDYbdA--e5a2w2FOD_yMdg,7
439
+ boneio-1.2.0.dev20.dist-info/RECORD,,