1. Alexander Schremmer
  2. Dwimd

Overview

dwimd

the ambient sensing gestalt optimizer for the n900

dwimd works by sampling sensors and taking user-defined actions based on a user-written config file.

Howto

  1. Look at http://hg.alexanderweb.de/dwimd-main/file/tip/contrib/alex_config.py how a config file should look like.
  2. Write your own config file. Every function is executed every 30 seconds. You can use the values and actions explained below.
  3. Copy your config file to /etc/dwimd/dwimd_plugins/configs. It should have a .py extension.

Reference

dwimd ships the following sensors:
  • history: Not really a sensor, it buffers data and returns the buffered

    data as a list.

  • load: Provides the system load as load.

  • locationcheck: Provides the current location as location. Such location

    objects then have a near method that should be called with the name of a location that was previously defined with define_location. define_location takes a name and either network_in_sight="network_name" for wifi sensing or coordinates=(50, 8, 100) for an 100m circle around the GPS coordinates 50N 8E.

  • moving: Provides moving and not_moving_for_5min. The latter is useful

    for autoaway.

  • orientation: Provides orientation, face_up and on_stand. orientation

    either contains "portrait" or "landscape" or the same string with " (inverse)" appended (XXX check). The other two variables are booleans.

  • time: Provides time which supports time.between("12:00", "15:00") like

    calls.

It ships the following actions. These are activatable by using the verbs explained below.
  • availability: Should be activated with a status like "online" or "away". Additionally,

    availability_message can be activated with the status message.

  • lock: If activated with off, avoids that the screen locks.

  • profile: Can be activated with a profile name that should be switched to (like

    "silent" or "general").

  • wifi: Should be activated with a network name as the value.

These verbs are provided to activate an action:
  • require(object, value) triggers an error if somebody votes against it
  • suggest(object, value) is a weak vote (defaults values but does not count in votes)
  • vote(object, value, votes) is used for voting
  • force(object, value) overwrites requires and votes

where object is a gestalt name or an action.

Gestalts can be defined like this:
define_gestalt("Default",
availability="available", profile="general")

They group similar action values.

TODO

  • Adjustable sample rate for every plugin.
  • Planned inputs: gps, time, weekday, load, location, orientation charging, playing, display, locked, noise level, ringing
  • planned outputs: availability, profile, cellular, secure, lock, wifi os.system