Heyu
====

Compiles and installs [heyu](https://github.com/HeyuX10Automation/heyu) x10 automation software on a server.

Requirements
------------

This role assumes there is an x10 control hardware on /dev/ttyUSB0 which gets linked to /dev/firecracker (hardcoded in heyu). Heyu passes all commands to this device.

Role Variables
--------------

### defaults/main.yml

`heyu_user`: user to run heyu service as

### vars/main.yml:

`heyu_version`: [semver](https://semver.org) of heyu. Ex: `"2.10.1"`

### Other variables (set in [group_vars/heyu.yml](https://git.shareunderware.com/blaine/infra/src/master/group_vars/heyu.yml)):

#### `heyu_aliases`:

    - device: Cameras 
      type: StdAM
      code: A1

`type` can be one of the following:

 * `StdAM # Appliance Module`
 * `StdLM # Lamp Module`
 * `""    # empty string, used for multiple-unit aliases`

`code` examples:

* single-unit alias `A1`
* multiple-unit alias `A1-5`


#### `heyu_cronjobs`:

    - name: turn on cameras
      job: /usr/local/bin/heyu fon Cameras
      hour: 7
      minute: 30

All cronjob settings are available:

* `minute`: minute (0-59)
* `hour`: hour (0-23)
* `dom`: day of month (1-31)
* `month`: month (1-12)
* `dow`: day of week (0-7) where Sunday=(0 or 7)

How to Execute
--------------

From within the infra directory:<br>
`ansible-playbook plays/heyu.yml`

To only run necessary tasks to update aliases and cronjobs, use `--tags update`<br>
`ansible-playbook plays/heyu.yml --tags update`

License
-------

GPLv3