gggg
Getting Started with the Smartylighting Streetlights API
What This API Does and Why It's Useful
Welcome to the Smartylighting Streetlights API! This powerful API allows you to remotely manage and interact with city streetlights, bringing smart city capabilities right to your fingertips. Whether you're building an urban management system, an energy efficiency application, or a real-time monitoring dashboard, this API provides the essential tools you need.
With this API, you can:
- Turn a specific streetlight on/off 🌃: Gain direct control over individual streetlights, enabling dynamic lighting schedules or immediate adjustments.
- Dim a specific streetlight 😎: Optimize energy consumption and adapt lighting levels to environmental conditions or specific needs.
- Receive real-time information about environmental lighting conditions 📈: Get live data on light intensity from streetlights, crucial for adaptive lighting systems and environmental monitoring.
This API is built on Kafka, providing a robust, scalable, and real-time messaging platform. This means you can expect high throughput and low latency for your streetlight interactions and data streams.
Prerequisites (Dependencies)
To get started with the Smartylighting Streetlights API, you'll need a few things set up in your development environment:
- Kafka Client Library: Since this API communicates over Kafka, you'll need a Kafka client library for your preferred programming language (e.g.,
confluent-kafka-pythonfor Python,kafka-clientsfor Java,node-rdkafkafor Node.js). - Access to a Kafka Broker: You'll need access to a Kafka broker. For testing, you can connect to our test broker at
test.mykafkacluster.org:8092. For production, you'll likely use your own Kafka cluster. - Authentication Credentials: As this API uses SASL/SCRAM authentication, you'll need a username and password provided by the API administrator.
- JSON Parsing Library: Messages are exchanged in JSON format, so ensure your environment has a JSON parsing library.
Resources and Capabilities
The following table outlines the main resources (Kafka topics) and the operations you can perform on them:
| Resource (Kafka Topic Pattern) | Description | Capabilities (Operations) | Message Type |
|---|---|---|---|
smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured | The topic on which measured values may be produced and consumed. |
| lightMeasured |
smartylighting.streetlights.1.0.action.{streetlightId}.turn.on | Command a specific streetlight to turn on. |
| turnOnOff |
smartylighting.streetlights.1.0.action.{streetlightId}.turn.off | Command a specific streetlight to turn off. |
| turnOnOff |
smartylighting.streetlights.1.0.action.{streetlightId}.dim | Command a specific streetlight to dim. |
| dimLight |
{streetlightId} in the topic patterns is a placeholder for the unique identifier of the streetlight you wish to interact with.
Authentication
To ensure secure communication and access control, the Smartylighting Streetlights API uses SASL/SCRAM authentication.
How to Authenticate:
When configuring your Kafka client, you will need to provide your assigned username and password for SASL/SCRAM authentication. This typically involves setting specific configuration properties for your Kafka producer or consumer client.
Here's a conceptual example of how you might configure your client (syntax will vary based on your chosen Kafka client library):
Important: Replace YOUR_USERNAME and YOUR_PASSWORD with the actual credentials provided to you. Keep your credentials secure and do not expose them in public repositories.
Upon successful authentication, your client will be able to produce and consume messages from the relevant Kafka topics.
Next Steps
You're now ready to start integrating with the Smartylighting Streetlights API! We recommend the following:
- Choose your preferred programming language and find a suitable Kafka client library.
- Set up your development environment with the necessary prerequisites.
- Refer to the detailed API reference documentation for specific message schemas and examples for each operation.
- Start sending and receiving messages to bring your smart city ideas to life!
Happy coding!