lewagon/alfred-coworker

Name: alfred-coworker

Owner: Le Wagon

Description: Automatically check-in people on Cobot as they connect to the Unifi Wifi

Created: 2016-04-20 17:46:11.0

Updated: 2017-03-21 11:59:57.0

Pushed: 2018-02-26 13:25:49.0

Homepage: http://lewagon.cobot.me/

Size: 43

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Some code put together to automatically check-in people on Cobot when connecting to the Unifi network.

Still a lot to refactor and extract from Rakefile… Sorry for that!

Available tasks
ke -T
 cobot:check_in:create[membership_id]         # Check-in a member
 cobot:check_in:create_for_connected_clients  # 'main' rake task to check-in all connected users
 cobot:check_in:list                          # List all today's check-ins
 cobot:invoice:list[membership_id]            # List invoices for a member
 cobot:members                                # Print a list of all active Cobot members
 cobot:plan:list                              # List plans for space
 cobot:time_pass:create[membership_id]        # Create a dont_charge time pass for a member
 cobot:time_pass:unused[membership_id]        # List unused time passes for a member
 cobot:token                                  # Generate a new Cobot access token
 dotenv                                       # Load environment settings from .env
 redis:ping                                   # PING Redis
 unifi:clients                                # Print a list of all clients currently connected
 unifi:devices                                # Print a list of all devices (APs) currently connected
 unifi:squatters                              # Detect squatters
Cron job
,20,30,40,50 9-11,14-16 * * * cd /home/seb/deployment/current && /usr/local/opt/rbenv/shims/bundle exec rake cobot:check_in:create_for_connected_clients unifi:squatters >> /var/log/cron.log 2>&1
Environment

You need the following environment variables (in a .env file or directly in the environment):

I_USER
I_PASSWORD
I_CONTROLLER_ADDRESS
T_ACCESS_TOKEN
K_INCOMING_WEBHOOK_URL

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.