gotify#

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.

Triggers:

__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": "2023-08-04T23:51:13.062325+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": "2023-08-04T23:51:13.062325+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"
}

stop()[source]#

Stop the plugin.