events¶
ibox.events in the library, ibox events in the CLI.
Subscribe to and poll real-time event channels on the Internet Box.
service ¶
Get service event channel information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
int
|
event channel ID. Default is None, which returns all channels. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
response content |
handler ¶
Get service event channel information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
handler
|
Sequence[str]
|
event handlers to filter for. |
required |
id
|
int
|
event channel ID. Default is None, which returns all channels. |
None
|
method
|
str
|
event manager method to call. Default is "get_events". "open_channel" can also be used to open a new channel for events. |
'get_events'
|
handler examples (case sensitive): NeMo.Intf.wifi1_bcm.ChannelMgt NeMo.Intf.wifi0_bcm.ChannelMgt NMC.Wifi NMC.Guest NeMo.Intf.wwan NMC.VoiceActivation VPN.Server.default.Client.account{1,2,3...} WebuiupgradeService
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
response content |
log ¶
Get event log information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mac
|
str
|
filter event log by MAC address. Required. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
response content |
open_channel ¶
Open a new event channel with event subscriptions.
Creates a new event channel and subscribes to the specified events. Returns immediately with the assigned channel ID. Use poll() to retrieve events from the channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
events
|
Sequence[Mapping[str, Any]]
|
list of event subscription dicts. Each dict can be:
- |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
response containing the channel ID |
Example
events = [ {"service": "Devices.Device", "event": "wifi_device_updated"}, {"service": "Devices.Device", "event": "eth_device_updated"}, {"handler": "NMC.Wifi"}, ] result = events_client.open_channel(events)
subscribe ¶
Subscribe to additional events on an existing event channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
events
|
Sequence[Mapping[str, Any]]
|
list of event subscription dicts (same format as open_channel). |
required |
id
|
int
|
existing channel ID to add subscriptions to. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
response content |
unsubscribe ¶
Unsubscribe from events on an existing event channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
events
|
Sequence[Mapping[str, Any]]
|
list of event subscription dicts (same format as open_channel). |
required |
id
|
int
|
existing channel ID to remove subscriptions from. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
response content |
poll ¶
Poll for events on an existing event channel (long polling).
Blocks until events are available or times out after ~30 seconds. Must be called again within ~10 seconds to keep the channel alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
int
|
channel ID to poll. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
response with channelid and events list |
device_network ¶
Open an event channel to monitor network events for specific devices.
Convenience method that creates an event channel subscribed to network events for each provided MAC address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
macs
|
Sequence[str]
|
list of MAC addresses to monitor. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
response containing the channel ID |
ethernet_ports ¶
Open an event channel to monitor ethernet port network events.
Subscribes to eth_device_updated and network events for each ethernet port.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ports
|
Sequence[str] | None
|
list of port identifiers. Default is ["ETH0", "ETH1", "ETH2", "ETH3", "ETH4"]. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
response containing the channel ID |