Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
contact-sensor-domapic-module
Advanced tools
Domapic module for handling a contact sensor
This package starts a Domapic Module with an ability called "contactSensor" that handles a GPIO in "in" mode. It is intended to be used in a Raspberry Pi or any other system supporting the onoff library, such as C.H.I.P. or BeagleBone.
It can be used alone, but also can be connected to a Domapic Controller to get the most out of it.
npm i contact-sensor-domapic-module -g
domapic-contact-sensor start --gpio=12 --debounce=3000 --reverse=false --save
The server will be started in background using pm2.
To display logs, type:
domapic-contact-sensor logs #--lines=300
The module, apart of all common domapic services options, provides custom options for configuring the sensor:
gpio
- Number defining the Gpio where the contact sensor to be controlled is connected.debounce
- Time in miliseconds to wait for before notifying about a change in the status of the contact sensor.reverse
- If true
, the value of the gpio will be inverted when emitting event or returning state. Default is false
(returns true
when contact sensor detects contact, and false
when not)Connect the module with a Domapic Controller providing the Controller url and connection token (you'll find it the Controller logs when it is started):
domapic-contact-sensor start --controller=http://192.168.1.110:3000 --controllerApiKey=fo--controller-api-key
Now, the module can be controlled through the Controller interface, or installed plugins.
Domapic modules are intended to be used through Domapic Controller, but can be used as an stand-alone service as well. Follow next instructions to use the built-in api by your own:
When the server is started, you can browse to the provided Swagger interface to get all the info about the api resources. Apart of all api methods common to all Domapic Services, the server provides one Domapic Ability for getting the state of the sensor, which generates one extra API resource:
/api/abilities/contact-sensor/state
- Returns the current state of the sensor.The server includes the Domapic Services authentication method, which is disabled by default for 127.0.0.1
.
You can disable the authentication using the --authDisabled
option (not recommended if your server is being exposed to the Internet). Read more about available options in the domapic services documentation.
If you want to authenticate when requesting from another IPs, look for the api key automatically generated and intended to be used by Domapic Controller when the server is started. You'll find it in the server logs:
-----------------------------------------------------------------
Try adding connection from Controller, using the next service Api Key: HMl6GHWr7foowxM40CB6tQPuXt3zc7zE
-----------------------------------------------------------------
To make your own requests to the api, provide this token using the X-Api-Key
header.
Use the mentioned api key also for authenticating when using the Swagger interface.
If the package is not installed globally, you can replace the domapic-contact-sensor
command in examples above by npm run domapic-contact-sensor --
(commands must be executed inside the package folder in that case)
If you don't want to use the built-in background runner, you can start the server directly, attaching logs to current stdout
. Move to the package folder and replace the domapic-contact-sensor
command of examples above by node server.js
. Press CTRL+C
to stop the server.
[1.1.0] - 2018-12-22
FAQs
Domapic module for handling a contact sensor
The npm package contact-sensor-domapic-module receives a total of 1 weekly downloads. As such, contact-sensor-domapic-module popularity was classified as not popular.
We found that contact-sensor-domapic-module demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.