Skip to content
This repository has been archived by the owner on Aug 15, 2021. It is now read-only.

Actions

zynzel edited this page Jul 17, 2016 · 8 revisions

Every action is simple python program which will do 'smth'. Executor execute actions with multiprocessing.Process().

List of actions can be found inside meact/executor/actions/ directory.

Every action should have defined TIMEOUT and return proper exit code (0 sucess, >0 error). Exitcode 255 is used by executor for action which didn't finish before TIMEOUT.

Default timeout for action is 10 seconds.

Every action should take 2 arguments.

First is used to pass sensor_data.

{
  'board_id': '123',
  'sensor_type': 'voltage',
  'sensor_data': '3.2',
  'message': 'voltage on board living room (123) reports value 3.2'
}

Second is used to pass action_config. Action config can be differ for each action. Action config send to action is result of merge action_config from global.yaml and sensors.yaml.

{
  'endpoint': 'https://maker.ifttt.com/trigger',
  'auth_key': 'authkey',
  'enabled': 1
}

log

Push sensor_data['message'] to log file.

send_bulksms

Send SMS via bulksms.com API.

  endpoint: "https://bulksms.vsms.net/eapi/submission/send_sms/2/2.0"
  user: "bulksms-user"
  password: "bulksms-password"
  message: "message"
  recipient:
    - "your-number"
    - "your-number2"
  enabled: 1

You can specify multiple recipients.

send_ifttt_maker

Send HTTP request to IFTTT maker channel.

  endpoint: "https://maker.ifttt.com/trigger"
  auth_key: "authkey"
  enabled: 1
  • Sensor_type will be used as IFTTT event name.
  • {{value1}} will be set to sensor_data['message']
  • {{value2}} will be set to sensor_data['sensor_data']
  • {{value3}} will be set to sensor_data['board_id']

This action can be used to do any action supported by IFTTT (if maker then smth).

Be advised that IFTTT maker sometimes is handled by IFTTT with long delay (ex. after 10 minutes).

send_instapush

Send HTTP request via instapush.im

  event: "event_name"
  endpoint: "https://api.instapush.im/v1/post"
  apps:
    - id: "instapush-app-id"
      secret: "instapush-app-secret"}
  enabled: 1

Instapush configuration:

  • Application name - rpi
  • Event title - event_name
  • Trackers - sensor_data['message']
  • Push message - RPI notification: {message}

This action can be used to show information directly on yours phone. You can specify multiple apps - send notification to multiple users.

send_mail

Send mail with SMTP

  sender: "[email protected]"
  recipient:
    - "[email protected]"
  subject: "RPI notification"
  host: "email-smtp.eu-west-1.amazonaws.com"
  port: 587
  tls: 1
  user: "user"
  password: "password"
  enabled: 1

send_mqtt

Send message over MQTT

  server: "localhost"
  port: 1883
  qos: 0
  message:
    - payload: '1'
      topic: 'mgmt/status/armed'
      retain: 1
  enabled: 1

In payload/topic you can use variable from sensor_data:

  • board_id
  • sensor_type
  • sensor_data
  • message

This action can be used to perform any meact action.

Examples:

  • disable alarm when button is pressed
  • send remote command to custom boards (ex. turn lights on)

send_sms_at

Send SMS via local modem (AT commands).

  recipient:
    - "your-number"
    - "your-number2'
  port: "/dev/ttyUSB1"
  speed: 19200
  enabled: 1

Local GSM modem is best way to be informed about yours Meact installation!

send_pushover

Send HTTP request via pushover.net

  endpoint: "https://api.pushover.net/1/messages.json"
  token: "auth_token"
  user_key: "user_or_group_key"
  priority: 0
  enabled: 1

This action can be used to show information directly on yours phone. You can send notifications to multiple users with pushover delivery groups.

Clone this wiki locally