Skip to content

events

ibox.events in the library, ibox events in the CLI.

Subscribe to and poll real-time event channels on the Internet Box.

service

service(id: int | None = None) -> str

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

handler(handler: Sequence[str], id: int | None = None, method: str = 'get_events') -> str

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

log(mac: str) -> str

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_channel(events: Sequence[Mapping[str, Any]]) -> str

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: - {"service": "<service>", "event": "<event_type>"} for service events - {"service": "<service>", "event": "<event_type>", "data": {"key": "value"}} for queried events - {"handler": "<handler_path>"} for handler events Multiple types can be mixed in the same list.

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(events: Sequence[Mapping[str, Any]], id: int) -> str

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(events: Sequence[Mapping[str, Any]], id: int) -> str

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(id: int) -> str

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

device_network(macs: Sequence[str]) -> str

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

ethernet_ports(ports: Sequence[str] | None = None) -> str

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