nfc#

Description#

Plugin to detect events from NFC devices.

Run the following command to check if your device is compatible with nfcpy and the right permissions are set:

python -m nfc

Configuration#

nfc:
  # [Optional]
  # Address or ID of the device to be opened. Examples:
  #
  # * ``usb:003:009`` opens device 9 on bus 3
  # * ``usb:003`` opens the first available device on bus 3
  # * ``usb`` opens the first available USB device (default)
  # device: usb

  # [Optional]
  # How often the `RunnablePlugin.loop <https://docs.platypush.tech/platypush/plugins/.html#platypush.plugins.RunnablePlugin.loop>`_ function should be
  # executed (default: 15 seconds). *NOTE*: For back-compatibility
  # reasons, the `poll_seconds` argument is also supported, but it's
  # deprecated.
  # poll_interval: 15  # type=Optional[float]

  # [Optional]
  # How long we should wait for any running
  # threads/processes to stop before exiting (default: 5 seconds).
  # stop_timeout: 5  # type=Optional[float]

  # [Optional]
  # If set to True then the plugin will not monitor
  # for new events. This is useful if you want to run a plugin in
  # stateless mode and only leverage its actions, without triggering any
  # events. Defaults to False.
  # disable_monitor: False  # type=bool

Dependencies#

pip

pip install ndeflib nfcpy>=1.0

Triggered events#

Actions#

Module reference#

class platypush.plugins.nfc.NfcPlugin(device='usb', **kwargs)[source]#

Bases: RunnablePlugin

Plugin to detect events from NFC devices.

Run the following command to check if your device is compatible with nfcpy and the right permissions are set:

python -m nfc
__init__(device='usb', **kwargs)[source]#
Parameters:

device

Address or ID of the device to be opened. Examples:

  • usb:003:009 opens device 9 on bus 3

  • usb:003 opens the first available device on bus 3

  • usb opens the first available USB device (default)

main()[source]#

Implementation of the main loop of the plugin.

start()#

Start the plugin.

status()[source]#

Get information about the NFC reader status.

Example output:

{
    "display_name": "ACS ACR122U PN532v1.6 at usb:001:017",
    "path": "usb:001:017",
    "product_name": "ACR122U",
    "vendor_name": "ACS"
}
stop()#

Stop the plugin.

wait_stop(timeout=None)#

Wait until a stop event is received.