class ups {
  include apcupsd

  case $ups_type {
    '': { $ups_type = 'usb' }
  }

  case $ups_cable {
    '': { $ups_cable = 'usb' }
  }

  case $ups_dev {
    '': { $ups_dev = '/dev/usb/hiddev0' }
  }

  case $ups_nisip {
    '': { $ups_nisip = '127.0.0.1' }
  }

  case $ups_polltime {
    '': { $ups_polltime = '60' }
  }

  case $has_ups {
    true: {
      apcupsd::ups { "ups0":
        upstype  => $ups_type,
        cable    => $ups_cable,
        device   => $ups_dev,
        nisip    => $ups_nisip,
        polltime => $ups_polltime,
      }
    }
  }
}