SwitchResource¶
SwitchResource
¶
Multi-port KVM switch and EDID management for PiKVM.
Source code in src/aiopikvm/resources/switch.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
get_state()
async
¶
Get the current switch state.
Returns:
| Type | Description |
|---|---|
SwitchState
|
Current switch state with active port and port list. |
set_active(port)
async
¶
Set the active port.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
port
|
str
|
Port identifier to activate. |
required |
get_edids()
async
¶
create_edid(edid_id, data, *, description='')
async
¶
Create a new EDID profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edid_id
|
str
|
EDID profile identifier. |
required |
data
|
str
|
Raw EDID data as hex string. |
required |
description
|
str
|
Optional human-readable description. |
''
|
Source code in src/aiopikvm/resources/switch.py
change_edid(port, edid_id)
async
¶
Change the EDID profile for a port.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
port
|
str
|
Port identifier. |
required |
edid_id
|
str
|
EDID profile identifier to assign. |
required |
Source code in src/aiopikvm/resources/switch.py
remove_edid(edid_id)
async
¶
Remove an EDID profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edid_id
|
str
|
EDID profile identifier to remove. |
required |
set_active_prev()
async
¶
set_active_next()
async
¶
set_beacon(state, *, port=None, uplink=None, downlink=None)
async
¶
Control indicator beacon lights.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
bool
|
Turn beacon on or off. |
required |
port
|
int | float | None
|
Port number ( |
None
|
uplink
|
int | None
|
Uplink beacon number. |
None
|
downlink
|
int | None
|
Downlink beacon number. |
None
|
Source code in src/aiopikvm/resources/switch.py
set_port_params(port, *, edid_id=None, dummy=None, name=None, atx_click_power_delay=None, atx_click_power_long_delay=None, atx_click_reset_delay=None)
async
¶
Configure port parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
port
|
int | float
|
Port number ( |
required |
edid_id
|
str | None
|
EDID profile identifier. |
None
|
dummy
|
bool | None
|
Pretend host has display attached. |
None
|
name
|
str | None
|
Port name (ASCII letters and numbers). |
None
|
atx_click_power_delay
|
float | None
|
ATX power click delay in seconds ( |
None
|
atx_click_power_long_delay
|
float | None
|
ATX long power click delay in seconds
( |
None
|
atx_click_reset_delay
|
float | None
|
ATX reset click delay in seconds ( |
None
|
Source code in src/aiopikvm/resources/switch.py
set_colors(beacon)
async
¶
Set beacon indicator colors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
beacon
|
str
|
Color in |
required |
Source code in src/aiopikvm/resources/switch.py
reset(unit, *, bootloader=False)
async
¶
Reboot a switch unit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit
|
int
|
Unit number ( |
required |
bootloader
|
bool
|
Enter reflashing mode after reboot. |
False
|
Source code in src/aiopikvm/resources/switch.py
atx_power(port, action)
async
¶
ATX power control for a specific port.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
port
|
int | float
|
Port number ( |
required |
action
|
str
|
Power action ( |
required |
Source code in src/aiopikvm/resources/switch.py
atx_click(port, button)
async
¶
Simulate an ATX button click for a specific port.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
port
|
int | float
|
Port number ( |
required |
button
|
str
|
Button to simulate ( |
required |