Skip to content

The Config File

jbaumann edited this page Apr 4, 2020 · 26 revisions

The Structure

The configuration file is a simple textual file that begins with a header line denoting its purpose:

[attinydaemon]

Following this are the option. If an option is missing at startup, the daemon determines the value that is currently set in the ATTiny Daemon and copies it to the config file. An example config file can be found in the here.

If you change a value of an existing option in the configuration file, then the daemon writes to new value to the ATTiny Daemon after a restart of the daemon. You can either reboot the system or execute the following command (assuming you used the service file for the installation of the daemon):

sudo systemctl restart attiny_daemon.service

This simply stops and restarts the daemon.

By default the configuration file is assumed to be in the same directory as the daemon itself. By using the command line option

--cfgfile <file>

another file with an arbitrary path can be provided as a config file.

The Options

Option Name Default Comment
primed true This option arms the ATTiny Daemon. As long as this option is set to falseyou can experiment and read all values of the ATTiny Daemon without it influencing your system in any way (apart from showing up as an I2C device).
loglevel DEBUG This is the log level for all messages in the system log file. Available levels are DEBUG, INFO, WARNING, ERROR, CRITICAL.
button function shutdown The possible options are shutdown, reboot and nothing.
timeout 60 This is the time in seconds until the ATTiny decides that the RPi has shut down and has to be restarted by resetting it.
sleeptime 20 This is the sleep time in seconds for the daemon until it checks the ATTiny Daemon for the next time.
force shutdown True If this option is set (and the option primed as well), then the system does a hard shutdown at the shutdown voltage by turning off the Geekworm UPS.
shutdown voltage 3200 This is the voltage in Millivolts at which the ATTiny Daemon executes a hard shutdown. You should ensure that this voltage is sufficiently below the warn voltage (200mV should be safe).
warn voltage 3400 This is the voltage in Millivolts at which the ATTiny Daemon warns the RPi to shut down.
restart voltage 3900 At this voltage (in Millivolts) the ATTiny tries to restart the RPi if it is not running.
battery voltage coefficient 1000 This is the coefficient used as a factor with which the battery voltage measurement is multiplied (times 1.000). See Compensating Measurement Errors for a detailed explanation.
battery voltage constant 0 This is the constant added to the battery voltage measurement after the multiplication (times 1.000). See Compensating Measurement Errors for a detailed explanation.
external voltage coefficient 1818 This is the coefficient used as a factor with which the external voltage measurement is multiplied (times 1.000). See Compensating Measurement Errors for a detailed explanation.
external voltage constant 0 This is the constant added to the external voltage measurement after the multiplication (times 1.000). See Compensating Measurement Errors for a detailed explanation.
temperature coefficient 1000 This is the coefficient used as a factor with which the temperature measurement is multiplied (times 1.000). See Compensating Measurement Errors for a detailed explanation.
temperature constant -270 This is the constant added to the temperature measurement after the multiplication (times 1.000). See Compensating Measurement Errors for a detailed explanation.
i2c address 0x37 This is the I2C address of the ATTiny, shouldn't have to be changed normally.
reset configuration 0|3 This value configures how the ATTiny daemon tries to reset the system:
Bit 0 = 0: Reset using a voltage level change (pulling the line low turns off the UPS)
Bit 0 = 1: Reset by „pressing“ a switch twice (pulling the line down for the reset pulse lenght turns the switch once)
Bit 1 = 0: Do not check external voltage (external voltage is not connected to RPi Vcc)
Bit 1 = 1: Check external voltage: (external voltage is connected to RPi Vcc)
Recommended for Geekworm UPS1 is the value 0, for the Geekworm UPS2 the value 3 (including connecting the EXT_V pin to the RPi Vcc via the jumper)
reset pulse length 200|4000 This is the length of the pulse used to execute the reset (200ms if the reset is induced by a voltage level change, 4000ms if a switch has to be pressed)
switch recovery delay 500 This is the time in ms to wait before „pressing“ the switch again (only used when in switch mode)

Comments

The difference between timeout and sleeptime (in the default configuration 40 seconds) should allow the RPi to fully reboot. If the time is not sufficient, then the ATTiny Daemon might reset the system just before it comes online again.

Clone this wiki locally