Skip to main content

No project description provided

Project description

volttron-emailer

Passing? pypi version

volttron-emailer allows an instance of the VOLTTRON platform to send email. When used in combination with the Alert agent, alerts from unpublished configured devices will automatically be sent. In addition, agents are able to send emails directly through the pub/sub interface.

Agents needing to send an email through the instance can do so by sending the following header and message to the platform/send_email topic which is monitored by the Emailer agent. The following is the expected payload for the message body and the optional header.

Requires

  • python >= 3.10
  • volttron >= 10.0

Installation

Before installing, VOLTTRON should be installed and running. Its virtual environment should be active. Information on how to install of the VOLTTRON platform can be found here.

Create a directory called config and use the change directory command to enter it.

mkdir config
cd config

After entering the config directory, create a file called emailer_config.json, use the below JSON to populate your new file. Refer to the configuration overview if needed.

Configuration Overview

Optional Headers

Emails by default will be sent to the initial configured email addresses. The below headers will overwrite those properties for the current email being sent. In this below example, the headers are "from-address" and "to-addresses". Please fill in the values after the : and within the quotations with your own email addresses

{
    "from-address": 'foo@bar.com',
    "to-addresses": ['alpha.beta@foo.com', 'bob-and-joe@bar.com']
}

Required Message Body

{
    "subject": "I am a happy camper",
    "message": "This is a big long string message that I am sending"
}

Example Sending of Email

headers = {
    "from-address": 'foo@bar.com',
    "to-addresses": ['alpha.beta@foo.com', 'bob-and-joe@bar.com']
}

message = {
    "subject": "I am a happy camper",
    "message": "This is a big long string message that I am sending"
}

self.vip.pubsub.publish('pubsub', topic='platform/send_email',
                        headers=headers, message=message)

Configuration Options

The following JSON configuration file shows all the options currently supported by the Forward Historian agent.

{
    # The smtp-address (Simple Mail Transfer Protocol) to ship the email
    # from (the "from-address" to each of the recipients).
    "smtp-address": "smtp.example.com",

    # The smtp-username is to provide the username of the SMTP server
    # which is being used for sending the messages.
    "smtp-username":"<smtp-username>",

    # The smtp-password is to provide the password of the SMTP server
    # corresponding to the username which is being used for sending the messages.
    "smtp-password":"<smtp-password>",

    # The smtp-port is to provide the port of the SMTP server.
    "smtp-port":"<smtp-port>",

    # The smtp-tls yes or no if we want to use TLS.
    "smtp-tls":<true/false>,

    # The sending address of the email.  This value will be listed in the
    # FROM attributed of the message envelop.  It will also be show in the
    # reply of the message when a recipient chooses reply from their
    # email client.
    "from-address": "no-reply@example.com",

    # A list of default email addresses for sending alerts to.  Each
    # address will be sent a copy of the email as if from a mailing list.
    "to-addresses": [
        "admin1@example.com"
    ],

    # When an alert is sent typically it can have the effect of being
    # sent many times.  This setting throttles the sending of email only
    # after a specific number of minutes.
    #
    # DEFAULT: "allow-frequency-minutes": 60
    "allow-frequency-minutes": 120
}
{
    "smtp-address": "<smtp-address>",
    "smtp-username":"<smtp-username>",
    "smtp-password":"<smtp-password>",
    "smtp-port":<smtp-port>,
    "smtp-tls":<true/false>,
    "from-address": "foo@foo.com",
    "to-addresses": [
        "foo1@foo.com",
        "foo2@foo.com"
    ],

    # Only send a certain alert-key message every 120 minutes.
    "allow-frequency-minutes": 120
}

Install and start emailer agent.

vctl install volttron-emailer --tag email --agent-config emailer_config.json --start --force

View the status of the installed agent.

vctl status

To verfiy functionality, Get the send_email.py file and run it with. If all is well, an email will be delivered to the address or addresses specified.

python3 send_email.py

Development

Please see the following for contributing guidelines contributing.

Please see the following helpful guide about developing modular VOLTTRON agents

Disclaimer Notice

This material was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor the United States Department of Energy, nor Battelle, nor any of their employees, nor any jurisdiction or organization that has cooperated in the development of these materials, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness or any information, apparatus, product, software, or process disclosed, or represents that its use would not infringe privately owned rights.

Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof, or Battelle Memorial Institute. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof.

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

volttron_emailer-0.1.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

volttron_emailer-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file volttron_emailer-0.1.0.tar.gz.

File metadata

  • Download URL: volttron_emailer-0.1.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for volttron_emailer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7668ba756ea827bebc4b3c8a5cc8ccf36bf9dc830cf719ee5719a506d2ac8d93
MD5 3703ddced6372a2f3946d3e187d57c3f
BLAKE2b-256 c713a84bd5b6cc67616bee5d9ff0aabe4ca981db978aa62338a5c8280a016cc0

See more details on using hashes here.

File details

Details for the file volttron_emailer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: volttron_emailer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for volttron_emailer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b0abbb37ef9d79b18a64d4bd59938851dabc062bce2490532fde0c041936cd4
MD5 aeb8e093e9b5b4a05164337f7beeeda0
BLAKE2b-256 628b21dc913c9cd088594dabd04c5630b126b166f6a040cc9cf709ada7362287

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