dm_mac.neon_fob_adder module

Tool to add RFID fobs to NeonOne accounts via API.

class dm_mac.neon_fob_adder.NeonFobUpdater

Bases: object

Class to add RFID fobs to NeonOne accounts via API.

BASE_URL: str = 'https://api.neoncrm.com/v2/'
_get_custom_fields_raw() List[Dict[str, Any]]

Return the raw API response for custom fields.

_get_fobcsv_field_id() int

Get the field ID for the FobCSV custom field, with caching.

_setup_update_logger(timestamp: str) Logger

Set up a logger for writing fob update records to file.

Args:

timestamp: Timestamp string for log filename (format: YYYYmmddHHMMSS)

Returns:

Configured logger instance

add_fob_to_account(account_id: str) None

Interactive method to add a fob to an account.

Displays account information, prompts for new fob code, validates, and updates if confirmed.

Args:

account_id: Neon account ID to process

get_account_info(account_id: str) Dict[str, Any]

Retrieve account information including all fob codes.

Returns dict with keys: account_id, full_name, preferred_name, email, fob_codes

update_account_fob(account_id: str, new_fob_code: str) str

Update account by appending new fob code to FobCSV field.

Args:

account_id: Neon account ID new_fob_code: New fob code to add (will be left-padded to 10 digits)

Returns:

Updated FobCSV value

Raises:

ValueError: If fob code is invalid or duplicate RuntimeError: If API call fails

dm_mac.neon_fob_adder.main() None

Main entrypoint for CLI script.

dm_mac.neon_fob_adder.parse_args(argv: List[str]) Namespace

Parse command line arguments.

dm_mac.neon_fob_adder.process_csv_file(csv_path: str, field_name: str, updater: NeonFobUpdater) None

Process a CSV file and add fobs to accounts.