pushbullet#

Description#

PushBullet integration.

Among the other things, this plugin allows you to easily interact with your mobile devices that have the app installed from Platypush.

If notification mirroring is enabled on your device, then the push notifications will be mirrored to Platypush as well as PushBullet events.

Since PushBullet also comes with a Tasker integration, you can also use this plugin to send commands to your Android device and trigger actions on it. It can be used to programmatically send files to your devices and manage shared clipboards too.

Configuration#

pushbullet:
  # [Required]
  # PushBullet API token, see https://docs.pushbullet.com/#authentication.
  token:   # type=str

  # [Optional]
  # Device ID that should be exposed. Default: ``Platypush @
  # <device_id | hostname>``.
  # device:   # type=Optional[str]

  # [Optional]
  # If set to True (default) then the plugin will
  # receive notifications mirrored from other connected devices -
  # these will also be rendered on the connected web clients. Disable
  # it if you don't want to forward your mobile notifications through
  # the plugin.
  # enable_mirroring: True  # type=bool

  # [Optional]
  # How often the `RunnablePlugin.loop <https://docs.platypush.tech/platypush/plugins/.html#platypush.plugins.RunnablePlugin.loop>`_ function should be
  # executed (default: 15 seconds). *NOTE*: For back-compatibility
  # reasons, the `poll_seconds` argument is also supported, but it's
  # deprecated.
  # poll_interval: 15  # type=Optional[float]

  # [Optional]
  # How long we should wait for any running
  # threads/processes to stop before exiting (default: 5 seconds).
  # stop_timeout: 5  # type=Optional[float]

  # [Optional]
  # If set to True then the plugin will not monitor
  # for new events. This is useful if you want to run a plugin in
  # stateless mode and only leverage its actions, without triggering any
  # events. Defaults to False.
  # disable_monitor: False  # type=bool

Dependencies#

pip

pip install git+https://github.com/rbrcsk/pushbullet.py

Alpine

apk add git

Debian

apt install git

Fedora

yum install git

Arch Linux

pacman -S git

Triggered events#

Actions#

Module reference#

class platypush.plugins.pushbullet.PushbulletEventType(type: PushbulletType, event_class: Type[PushbulletEvent])[source]#

Bases: object

PushBullet event type.

__init__(type: PushbulletType, event_class: Type[PushbulletEvent]) None#
class platypush.plugins.pushbullet.PushbulletPlugin(token: str, device: str | None = None, enable_mirroring: bool = True, **kwargs)[source]#

Bases: RunnablePlugin

PushBullet integration.

Among the other things, this plugin allows you to easily interact with your mobile devices that have the app installed from Platypush.

If notification mirroring is enabled on your device, then the push notifications will be mirrored to Platypush as well as PushBullet events.

Since PushBullet also comes with a Tasker integration, you can also use this plugin to send commands to your Android device and trigger actions on it. It can be used to programmatically send files to your devices and manage shared clipboards too.

__init__(token: str, device: str | None = None, enable_mirroring: bool = True, **kwargs)[source]#
Parameters:
  • token – PushBullet API token, see https://docs.pushbullet.com/#authentication.

  • device – Device ID that should be exposed. Default: Platypush @ <device_id | hostname>.

  • enable_mirroring – If set to True (default) then the plugin will receive notifications mirrored from other connected devices - these will also be rendered on the connected web clients. Disable it if you don’t want to forward your mobile notifications through the plugin.

property device#
Returns:

Current PushBullet device object.

get_device(device: str) dict | None[source]#

Get a device by ID or name.

Parameters:

device – Device ID or name

Returns:

{
  "active": true,
  "created": "2021-01-01T00:00:00",
  "device_id": "12345",
  "icon": "system",
  "kind": "android",
  "manufacturer": "Example manufacturer",
  "model": "Example model",
  "modified": "2021-01-01T00:00:00",
  "name": "Example device",
  "pushable": true
}

get_devices()[source]#

Get the list of available devices.

Returns:

[
  {
    "active": true,
    "created": "2021-01-01T00:00:00",
    "device_id": "12345",
    "icon": "system",
    "kind": "android",
    "manufacturer": "Example manufacturer",
    "model": "Example model",
    "modified": "2021-01-01T00:00:00",
    "name": "Example device",
    "pushable": true
  }
]

get_pushes(limit: int = 10)[source]#

Get the list of pushes.

Parameters:

limit – Maximum number of pushes to fetch (default: 10).

Returns:

[
  {
    "actions": "Actions of the notification/message",
    "application_name": "Example app",
    "body": "Example body",
    "created": "2021-01-01T00:00:00",
    "dismissible": true,
    "file_name": "example.txt",
    "file_type": "text/plain",
    "file_url": "https://example.com/example.txt",
    "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABpUlEQVQ4T",
    "image_height": 100,
    "image_url": "https://example.com/example.png",
    "image_width": 100,
    "modified": "2021-01-01T00:00:00",
    "notification_id": "12345",
    "package_name": "com.example.app",
    "receiver_email": "user2@example.com",
    "receiver_id": "12346",
    "sender_email": "user1@example.com",
    "sender_id": "12345",
    "sender_name": "John Doe",
    "source_device": "device123",
    "source_user": "user123",
    "target_device": "device456",
    "title": "Hello world",
    "url": "https://example.com"
  }
]

main()[source]#

Implementation of the main loop of the plugin.

property pb#
Returns:

PushBullet API object.

send_clipboard(text: str)[source]#

Send text to the clipboard of other devices.

Parameters:

text – Text to be copied.

send_file(filename: str, device: str | None = None)[source]#

Send a file.

Parameters:
  • device – Device ID or name (default: None, all devices)

  • filename – Path to the local file

send_note(device: str | None = None, body: str | None = None, title: str | None = None, url: str | None = None, **kwargs)[source]#

Send a note push.

Parameters:
  • device – Device ID or name (default: None, all devices)

  • body – Note body

  • title – Note title

  • url – URL attached to the note

  • kwargs – Push arguments, see https://docs.pushbullet.com/#create-push

Returns:

{
  "actions": "Actions of the notification/message",
  "application_name": "Example app",
  "body": "Example body",
  "created": "2021-01-01T00:00:00",
  "dismissible": true,
  "file_name": "example.txt",
  "file_type": "text/plain",
  "file_url": "https://example.com/example.txt",
  "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABpUlEQVQ4T",
  "image_height": 100,
  "image_url": "https://example.com/example.png",
  "image_width": 100,
  "modified": "2021-01-01T00:00:00",
  "notification_id": "12345",
  "package_name": "com.example.app",
  "receiver_email": "user2@example.com",
  "receiver_id": "12346",
  "sender_email": "user1@example.com",
  "sender_id": "12345",
  "sender_name": "John Doe",
  "source_device": "device123",
  "source_user": "user123",
  "target_device": "device456",
  "title": "Hello world",
  "url": "https://example.com"
}

start()#

Start the plugin.

stop()#

Stop the plugin.

wait_stop(timeout=None)#

Wait until a stop event is received.

class platypush.plugins.pushbullet.PushbulletType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

PushBullet event types.