~helmut/onoff.git
18 months agodrop support for Python 2.x master
Helmut Grohne [Sat, 14 Apr 2018 09:04:59 +0000 (11:04 +0200)]
drop support for Python 2.x

Since Debian stretch, GObject.spawn_async works in Python 3.x, so there
is no reason not to prefer Python 3.x anymore.

Bump the minimum version to 3.5 in order to be able to use async def and
await.

2 years agoadd a device implementation for GPIOs
Helmut Grohne [Sun, 20 Aug 2017 07:28:24 +0000 (09:28 +0200)]
add a device implementation for GPIOs

2 years agoremove OnoffProcess parameter start_wait
Helmut Grohne [Sat, 19 Aug 2017 20:36:37 +0000 (22:36 +0200)]
remove OnoffProcess parameter start_wait

It duplicates the ondelay parameter of ThrottledDevice. Transform

    dev = OnoffProces(commandline, delay)

into

    dev = ThrottledDevice(OnoffProces(commandline), delay, 0)

2 years agoabstract away ScheduledFunction
Helmut Grohne [Sat, 19 Aug 2017 19:41:33 +0000 (21:41 +0200)]
abstract away ScheduledFunction

Rather than work with GObject.timeout_add and GObject.source_remove
directly, wrap them up in a ScheduledFunction to ease usage.

3 years agoLogger.warn is deprecated in Python 3.4
Helmut Grohne [Sat, 7 May 2016 19:18:43 +0000 (21:18 +0200)]
Logger.warn is deprecated in Python 3.4

5 years agodrop unused event id from spawn_child
Helmut Grohne [Wed, 12 Mar 2014 21:18:29 +0000 (22:18 +0100)]
drop unused event id from spawn_child

5 years agompd_watcher: automatically reconnect
Helmut Grohne [Wed, 12 Mar 2014 08:36:45 +0000 (09:36 +0100)]
mpd_watcher: automatically reconnect

6 years agoadd example .service file for dbus activation
Helmut Grohne [Sun, 28 Jul 2013 11:45:24 +0000 (13:45 +0200)]
add example .service file for dbus activation

6 years agompd_watcher: properly schedule all IO via gobject
Helmut Grohne [Sun, 21 Jul 2013 16:50:05 +0000 (18:50 +0200)]
mpd_watcher: properly schedule all IO via gobject

Otherwise it might block, which would make it impossible to run it in an
existing mainloop that also services different needs.

6 years agoOnoffControl: when logging activatefd tell the fd
Helmut Grohne [Sat, 20 Jul 2013 12:14:33 +0000 (14:14 +0200)]
OnoffControl: when logging activatefd tell the fd

6 years agoThrottledDevice: speed up quick reactivation
Helmut Grohne [Fri, 19 Jul 2013 12:56:05 +0000 (14:56 +0200)]
ThrottledDevice: speed up quick reactivation

When a deactivation is delayed by offdelay and reactivated before the
timer expires, the device is not powered down at all in between. So we
should not incur the ondelay, but immediately transition to ST_ACTIVE
after cancelling the pending deactivation.

6 years agofix markdown syntax
Helmut Grohne [Mon, 15 Jul 2013 08:39:06 +0000 (10:39 +0200)]
fix markdown syntax

6 years agoREADME.md: document dependencies
Helmut Grohne [Mon, 15 Jul 2013 08:28:32 +0000 (10:28 +0200)]
README.md: document dependencies

6 years agomove dbus introspection to dbusutils.list_objects
Helmut Grohne [Mon, 15 Jul 2013 08:12:52 +0000 (10:12 +0200)]
move dbus introspection to dbusutils.list_objects

6 years agosispmctl_device: permit selecting a device
Helmut Grohne [Mon, 15 Jul 2013 08:01:13 +0000 (10:01 +0200)]
sispmctl_device: permit selecting a device

6 years agoREADME.md: put the implementations in an itemize
Helmut Grohne [Mon, 15 Jul 2013 05:13:11 +0000 (07:13 +0200)]
README.md: put the implementations in an itemize

Suggested by Joachim Breitner.

6 years agorewrite README.md
Helmut Grohne [Sun, 14 Jul 2013 19:04:05 +0000 (21:04 +0200)]
rewrite README.md

Thanks to Joachim Breitner for asking good questions. Most of his
questions are answered by this revised version.

6 years agofix epydoc markup
Helmut Grohne [Sun, 14 Jul 2013 19:02:46 +0000 (21:02 +0200)]
fix epydoc markup

6 years agoadd a sispmctl_device
Helmut Grohne [Sun, 14 Jul 2013 18:54:38 +0000 (20:54 +0200)]
add a sispmctl_device

6 years agodbus_client: handle multiple transition signals
Helmut Grohne [Sun, 14 Jul 2013 15:09:04 +0000 (17:09 +0200)]
dbus_client: handle multiple transition signals

There bay be multiple changestate signals with ST_ACTIVE|ST_TRANSITION
before a signal for ST_ACTIVE.

6 years agomust not pass float to GObject.timeout_add
Helmut Grohne [Sun, 14 Jul 2013 06:59:33 +0000 (08:59 +0200)]
must not pass float to GObject.timeout_add

6 years agoThrottledDevice: missing state notifiation
Helmut Grohne [Sun, 14 Jul 2013 06:42:34 +0000 (08:42 +0200)]
ThrottledDevice: missing state notifiation

When a throttled device is transitioning to off and we activate it,
activation may be a noop on the actual device thus not emitting any
state change. From a users point of view we are transitioning to on now,
so the state has changed.

6 years agogeneralize ThrottledDevice
Helmut Grohne [Sat, 13 Jul 2013 09:54:24 +0000 (11:54 +0200)]
generalize ThrottledDevice

It gained the capability to delay the activation signal by a specified
amount of time. This should be useful when using it with sispmctl,
because hardware usually takes significant time to power on.

6 years agoadd an example dbus_policy.conf
Helmut Grohne [Sat, 6 Jul 2013 11:42:08 +0000 (13:42 +0200)]
add an example dbus_policy.conf

This can be used when running onoff on the system bus. It should be
placed as /etc/dbus-1/system.d/onoff.conf then.

6 years agodbus_client: add --list to list devices
Helmut Grohne [Fri, 28 Jun 2013 10:38:37 +0000 (12:38 +0200)]
dbus_client: add --list to list devices

6 years agoprovide a default for --busname
Helmut Grohne [Fri, 28 Jun 2013 09:46:29 +0000 (11:46 +0200)]
provide a default for --busname

6 years agomove OnoffControl to onoff.dbusutils
Helmut Grohne [Fri, 28 Jun 2013 09:35:58 +0000 (11:35 +0200)]
move OnoffControl to onoff.dbusutils

What's left in dbus_service.py now is mainly the configuration part.
Maybe configuring onoff should happen by writing a python script for
now?

6 years agodocument device configuration
Helmut Grohne [Sat, 22 Jun 2013 17:01:39 +0000 (19:01 +0200)]
document device configuration

6 years agochange activatefd method and add ThrottledDevice
Helmut Grohne [Sat, 22 Jun 2013 11:33:43 +0000 (13:33 +0200)]
change activatefd method and add ThrottledDevice

When activating via activatefd, there is no reason to add an additional
delay. Simply close the socket later. If a device should delay
deactivation, this is a policy decision, that should be made by the
service. This policy decision can be done using the new ThrottledDevice.

6 years agomove the socketpair utility to dbusutils
Helmut Grohne [Wed, 19 Jun 2013 18:17:47 +0000 (20:17 +0200)]
move the socketpair utility to dbusutils

6 years agoadd a README
Helmut Grohne [Wed, 19 Jun 2013 18:15:57 +0000 (20:15 +0200)]
add a README

Outline what onoff is about and what problem it aims to solve.

6 years agowrite down some ideas
Helmut Grohne [Wed, 19 Jun 2013 17:44:14 +0000 (19:44 +0200)]
write down some ideas

6 years agolicense the code as BSD-3
Helmut Grohne [Wed, 19 Jun 2013 10:00:28 +0000 (12:00 +0200)]
license the code as BSD-3

6 years agoadd minimal setup.py
Helmut Grohne [Tue, 18 Jun 2013 21:59:19 +0000 (23:59 +0200)]
add minimal setup.py

6 years agodbus_client: improve documentation
Helmut Grohne [Tue, 18 Jun 2013 21:42:47 +0000 (23:42 +0200)]
dbus_client: improve documentation

6 years agodbus_client: make duration configurable
Helmut Grohne [Tue, 18 Jun 2013 21:37:33 +0000 (23:37 +0200)]
dbus_client: make duration configurable

6 years agomake clients configurable via argparse
Helmut Grohne [Tue, 18 Jun 2013 20:22:27 +0000 (22:22 +0200)]
make clients configurable via argparse

6 years agoship some documentation
Helmut Grohne [Mon, 17 Jun 2013 21:10:29 +0000 (23:10 +0200)]
ship some documentation

6 years agoadd mpd_watcher
Helmut Grohne [Mon, 17 Jun 2013 18:50:46 +0000 (20:50 +0200)]
add mpd_watcher

It activates a device when mpd plays music.

6 years agochange activatefd signature
Helmut Grohne [Mon, 17 Jun 2013 18:15:59 +0000 (20:15 +0200)]
change activatefd signature

The method no longer takes a UnixFd, but returns one. This is copied
from the systemd inhibitor interface. Advantages:

 * Not having fds to arbitrary things in the service is probably a good
   thing.
 * Maybe the interfaces can converge?

6 years agoversion dbus interface
Helmut Grohne [Mon, 17 Jun 2013 17:56:37 +0000 (19:56 +0200)]
version dbus interface

The interface is still subject to change. Choosing version 0 as an
unstable version now. Change to 1 on initial release.

6 years agodeduplicate spawn_async invocations
Helmut Grohne [Mon, 17 Jun 2013 11:32:49 +0000 (13:32 +0200)]
deduplicate spawn_async invocations

6 years agoadd an OnoffCommand device
Helmut Grohne [Mon, 17 Jun 2013 10:28:21 +0000 (12:28 +0200)]
add an OnoffCommand device

6 years agoOnoffProcess: don't fail inopportune transitions
Helmut Grohne [Mon, 17 Jun 2013 07:47:36 +0000 (09:47 +0200)]
OnoffProcess: don't fail inopportune transitions

Previously a call to activate while transitioning to ST_INACTIVE would
be ignored.

6 years agoattempt to fix for python3
Helmut Grohne [Sun, 16 Jun 2013 22:39:07 +0000 (00:39 +0200)]
attempt to fix for python3

 * Wrong way to invoke logging.
 * spawn_async returns pid as 0. Bug in library?

6 years agoimplement a redshift device
Helmut Grohne [Sun, 16 Jun 2013 22:04:17 +0000 (00:04 +0200)]
implement a redshift device

6 years agodraft device api
Helmut Grohne [Sun, 16 Jun 2013 22:03:44 +0000 (00:03 +0200)]
draft device api

6 years agodbus_service: swap print for logging
Helmut Grohne [Sun, 16 Jun 2013 22:02:06 +0000 (00:02 +0200)]
dbus_service: swap print for logging

6 years agoservice: more generic activation
Helmut Grohne [Sun, 16 Jun 2013 21:57:41 +0000 (23:57 +0200)]
service: more generic activation

6 years agoimprove dbus api
Helmut Grohne [Sun, 16 Jun 2013 21:51:09 +0000 (23:51 +0200)]
improve dbus api

 * rename state signal to changestate
 * provide a state method returning the current state

6 years agochange state meanings
Helmut Grohne [Sun, 16 Jun 2013 19:55:56 +0000 (21:55 +0200)]
change state meanings

The ST_ACTIVE bit is now to define the desired state. The previous
definition of using the state we are coming from does not make much
sense. Consider the case when being deactivated while transitioning to
active. Then we are coming from inactive and transitioning to inactive.

6 years agoport to python3
Helmut Grohne [Sun, 16 Jun 2013 13:33:01 +0000 (15:33 +0200)]
port to python3

6 years agoinitial commit
Helmut Grohne [Sun, 16 Jun 2013 10:32:08 +0000 (12:32 +0200)]
initial commit

Proof-of-concept for the dbus interaction of the onoff service.