The goal of this library is to provide an easy to use interface of Bolt Cloud API's. The functions will be quite similar to the Raspberry Pi and Arduino functions.
-
Users need to type just one command
pip install boltiot
-
The user will set the client once and he can use the same client for every operation. For example.
from boltiot import Bolt api_key = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" device_id = “BOLT1234" mybolt = Bolt(api_key, device_id) response = mybolt.digitalWrite('0', 'HIGH')
- digitalWrite Command
from boltiot import Bolt api_key = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" device_id = “BOLT1234" mybolt = Bolt(api_key, device_id) response = mybolt.digitalWrite('0', 'HIGH')
- digitalRead Command
from boltiot import Bolt api_key = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" device_id = “BOLT1234" mybolt = Bolt(api_key, device_id) response = mybolt.digitalRead('A0')
- analogRead Command
from boltiot import Bolt api_key = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" device_id = “BOLT1234" mybolt = Bolt(api_key, device_id) response = mybolt.analogRead('A0')
- analogWrite Command
from boltiot import Bolt api_key = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" device_id = “BOLT1234" mybolt = Bolt(api_key, device_id) response = mybolt.analogWrite('0', '100')
- serialBegin Command
from boltiot import Bolt api_key = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" device_id = “BOLT1234" mybolt = Bolt(api_key, device_id) response = mybolt.serialBegin('9600')
- serialWrite Command
from boltiot import Bolt api_key = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" device_id = “BOLT1234" mybolt = Bolt(api_key, device_id) response = mybolt.serialWrite('Hello')
- serialRead Command
from boltiot import Bolt api_key = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" device_id = “BOLT1234" mybolt = Bolt(api_key, device_id) response = mybolt.serialRead('10')
-
isOnline Command (to check recent status of device with time when status updated)
from boltiot import Bolt api_key = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" device_id = “BOLT1234" mybolt = Bolt(api_key, device_id) response = mybolt.isOnline()
-
restart Command (to restart the Bolt)
from boltiot import Bolt api_key = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" device_id = “BOLT1234" mybolt = Bolt(api_key, device_id) response = mybolt.restart()
-
version Command (to check device version)
from boltiot import Bolt api_key = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" device_id = “BOLT1234" mybolt = Bolt(api_key, device_id) response = mybolt.version()
- send_sms function is used to send email using twilio API .
from boltiot import Sms ssid = 'You can find SSID in your Twilio Dashboard' auth_token = 'You can find on your Twilio Dashboard' from_number = 'This is the no. generated by Twilio. You can find this on your Twilio Dashboard' to_number = 'number to send the sms' sms = Sms(ssid, auth_token, to_number, from_number) sms.send_sms("Messge to be sent")
- send_email function is used to send emails using mailgun API .
from boltiot import Email mailgun_api_key = 'This is the private API key which you can find on your Mailgun Dashboard' sandbox_url= 'You can find this on your Mailgun Dashboard' sender_email = 'This would be test@your SANDBOX_URL' recipient_email = 'Enter your Email ID Here' mailer = Email(mailgun_api_key, sandbox_url, sender_email, recipient_email) mailer.send_email("Email Subject", "Email Body")
All the unit tests pertaining to this library are present in the /tests folder. These tests can be executed when you want to test particular functionalities of the library.
Running a unit test is simple enter your credentails in the /tests/config.py and you can run tests petaining to GPIO, UART and/or Utility functions.
- Setup the hardware as described in the hardware_config.txt
- Run functionality_testing.py
You can find the Bolt API documentation here http://cloud.boltiot.com/api_credentials.
Your contributions are always welcome! Please refer to the contribution guidelines.
- Fork the repository on GitHub.
- First checkout to dev branch.
- Create a feature branch only when you are working on a new feature.
- Write a test which shows that the bug was fixed or that the feature works as expected.
- Never work on master branch
- Send a pull request and wait until it gets merged and published. :)
- Check your spelling and grammar.
- Remove any trailing whitespaces.