Skip to main content

Runbullet service

Project description

Runbullet
=========

Execute any command or custom complex logic on your devices, wherever they are, using your PushBullet account.

Installation
------------

```shell
pip install runbullet
```

Configuration
-------------

Copy /etc/runbullet/config.example.yaml to /etc/runbullet/config.yaml (system-wise settings) or ~/.config/runbullet/config.yaml (user-wise settings).

Edit the file to include:

* Your PushBullet access token (create one [here](https://www.pushbullet.com/#settings/account));
* The name of the (virtual) PushBullet device used to listen for events (create one [here](https://www.pushbullet.com/#devices)).

Each target device is identified by a unique device_id in the messages sent over your account. The device_id is the hostname by default, unless changed in config.yaml.

Testing
-------

`runbullet` installs `pusher`, a command-line tool to send PushBullet messages to the connected devices in the format used by runbullet.

Some examples:

```shell
echo '{"cmd":"scp /home/user/photos/*.jpg backup_host:/mnt/hd/photos"}' | pusher --target laptop --plugin shell
echo '{"play":true}' | pusher --target raspberrypi --plugin music.mpd
```

Writing your plugins
--------------------

Writing your own `runbullet` plugin, that would execute your own custom logic whenever a bullet with your plugin name is received, is a very simple task.

1. Create your plugin directory under `runbullet/plugins` (e.g. `light/batsignal`).

2. In the case above, `runbullet.plugins.light.batsignal` will be your package name.

3. Create an `__init__.py` under `runbullet/plugins/light/batsignal`.

4. If your module is `light/batsignal`, then its main class should be named `LightBatsignalPlugin`.

5. The configuration for your module will be read from a section named `light.batsignal` from your `config.yaml`, the attributes are accessible in your class in `self.config`.

The `__init__.py` will look like this:

```python
from .. import LightPlugin

class LightBatsignalPlugin(LightPlugin):
def _init(self):
self.batsignal = batsignal.Batsignal(self.config['intensity'])

def on(self):
self.batsignal.on()

def off(self):
self.batsignal.off()

def toggle(self):
self.batsignal.toggle()

def status(self):
return [self.batsignal.status().stdout, self.batsignal.status().stderr]
```

6. It's a good practice to define a `status` method in your plugin, which returns a 2-items list like `[output, error]`.

7. Rebuild and reinstall `runbullet` if required and relaunch it.

8. Test your new plugin by sending some bullets to it:

```shell
echo '{"on":true}' | pusher --target your_pc --plugin light.batsignal
```



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

runbullet-0.2.0.dev1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

runbullet-0.2.0.dev1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file runbullet-0.2.0.dev1.tar.gz.

File metadata

File hashes

Hashes for runbullet-0.2.0.dev1.tar.gz
Algorithm Hash digest
SHA256 d5e70266d9fa7920ec878f19bfc5d6d83bd92b0459d9faa5789c540abef1bd00
MD5 16c21ccda7234b6807f527a136471ac6
BLAKE2b-256 4e05a2c1d1fa815fc1a1d5d6b289494176fb1d4bd73340c95fdddd38625e6181

See more details on using hashes here.

File details

Details for the file runbullet-0.2.0.dev1-py3-none-any.whl.

File metadata

File hashes

Hashes for runbullet-0.2.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 c79c44c7fdd1eaca16c2e12f8ddb1887ac8e242f3081aeee73bc3380a1ff4425
MD5 9c892090d8416a3d8f4d494be2ef9c10
BLAKE2b-256 0f3757b6ea97f6cdf23b537422a152ab55476d2fcb94763334befc683d37cafb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page