gotify#

Description#

Gotify integration.

Gotify allows you process messages and notifications asynchronously over your own devices without relying on 3rd-party cloud services.

Configuration#

gotify:
  # [Required]
  # Base URL of the Gotify server (e.g. ``http://localhost``).
  server_url:   # type=str

  # [Required]
  # Application token, required to send message and retrieve application info.
  # You can create a new application under ``http://<server_url>/#/applications``.
  app_token:   # type=str

  # [Required]
  # Client token, required to subscribe to messages.
  # You can create a new client under ``http://<server_url>/#/clients``.
  client_token:   # type=str

  # [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

Triggered events#

Actions#

Module reference#

class platypush.plugins.gotify.GotifyPlugin(server_url: str, app_token: str, client_token: str, **kwargs)[source]#

Bases: RunnablePlugin

Gotify integration.

Gotify allows you process messages and notifications asynchronously over your own devices without relying on 3rd-party cloud services.

__init__(server_url: str, app_token: str, client_token: str, **kwargs)[source]#
Parameters:
  • server_url – Base URL of the Gotify server (e.g. http://localhost).

  • app_token – Application token, required to send message and retrieve application info. You can create a new application under http://<server_url>/#/applications.

  • client_token – Client token, required to subscribe to messages. You can create a new client under http://<server_url>/#/clients.

delete_messages(*ids)[source]#

Delete messages.

Parameters:

ids – If specified, it deletes the messages matching these IDs. Otherwise, it deletes all the received messages.

get_messages(limit: int = 100, since: int | None = None)[source]#

Get a list of the messages received on the server.

Parameters:
  • limit – Maximum number of messages to retrieve (default: 100).

  • since – Retrieve the message having since as minimum ID.

Returns:

[
  {
    "appid": 1,
    "date": "2024-07-16T18:25:22.999216+00:00",
    "extras": {
      "home::appliances::lighting::on": {
        "brightness": 15
      },
      "home::appliances::thermostat::change_temperature": {
        "temperature": 23
      }
    },
    "id": 1,
    "message": "Test message",
    "priority": 2,
    "title": "Test title"
  }
]

main()[source]#

Implementation of the main loop of the plugin.

send_message(message: str, title: str | None = None, priority: int = 0, extras: dict | None = None)[source]#

Send a message to the server.

Parameters:
  • message – Message body (Markdown is supported).

  • title – Message title.

  • priority – Message priority (default: 0).

  • extras – Extra JSON payload to be passed on the message.

Returns:

{
  "appid": 1,
  "date": "2024-07-16T18:25:22.999216+00:00",
  "extras": {
    "home::appliances::lighting::on": {
      "brightness": 15
    },
    "home::appliances::thermostat::change_temperature": {
      "temperature": 23
    }
  },
  "id": 1,
  "message": "Test message",
  "priority": 2,
  "title": "Test title"
}

start()#

Start the plugin.

stop()[source]#

Stop the plugin.

wait_stop(timeout=None)#

Wait until a stop event is received.