@@ -39,13 +39,22 @@ efficient state change detection with minimal CPU usage.
39
39
name : " Legacy Sensor"
40
40
use_interrupt : false # Use polling instead of interrupts
41
41
42
+ # Example with shared pin (automatic polling mode)
43
+ binary_sensor :
44
+ - platform : gpio
45
+ pin :
46
+ number : GPIO15
47
+ allow_other_uses : true # Pin is shared with other components
48
+ name : " Pump Status"
49
+ # Interrupts will be automatically disabled for compatibility
50
+
42
51
Configuration variables:
43
52
------------------------
44
53
45
54
- **pin ** (**Required **, :ref: `Pin Schema <config-pin_schema >`): The pin to monitor.
46
55
- **use_interrupt ** (*Optional *, boolean): Use hardware interrupts instead of polling for better
47
- performance and lower CPU usage. Defaults to ``true `` for most platforms, but defaults to ``false ``
48
- for LibreTiny-based platforms (BK72xx, RTL87xx, LN882x) due to hardware limitations. Only supported
56
+ performance and lower CPU usage. Defaults to ``true `` for most platforms, but defaults to ``false ``
57
+ for LibreTiny-based platforms (BK72xx, RTL87xx, LN882x) due to hardware limitations. Only supported
49
58
on internal GPIO pins.
50
59
- **interrupt_type ** (*Optional *, string): The type of interrupt to use. One of:
51
60
@@ -78,13 +87,20 @@ The GPIO binary sensor supports two modes of operation:
78
87
79
88
.. note ::
80
89
81
- Interrupt mode is only available on internal GPIO pins. External GPIO
90
+ Interrupt mode is only available on internal GPIO pins. External GPIO
82
91
expanders (like PCF8574) will automatically fall back to polling mode.
83
92
84
- LibreTiny-based platforms (BK72xx, RTL87xx, LN882x) default to polling mode
85
- due to hardware limitations with edge interrupts. You can explicitly enable
93
+ LibreTiny-based platforms (BK72xx, RTL87xx, LN882x) default to polling mode
94
+ due to hardware limitations with edge interrupts. You can explicitly enable
86
95
interrupt mode if needed, but it may not work reliably on all pins.
87
96
97
+ .. note ::
98
+
99
+ When a pin is configured with ``allow_other_uses: true `` (for sharing with
100
+ other components), interrupts are automatically disabled to prevent conflicts.
101
+ This ensures compatibility with components like ``duty_cycle `` sensors that
102
+ need to monitor pin state changes. The sensor will use polling mode instead.
103
+
88
104
Activating internal pullups
89
105
---------------------------
90
106
0 commit comments