neeeee
Getting Started with Smartylighting Streetlights API
Welcome, API developers! We're thrilled to have you on board. This guide will help you quickly understand and integrate with the Smartylighting Streetlights API, empowering you to build innovative solutions for smart city management.
Ready to illuminate the city? Let's get started!
What Does This API Do, and Why Is It Useful?
The Smartylighting Streetlights API is a powerful tool designed to remotely manage and monitor city streetlights. Imagine a world where you can control every streetlight with precision, optimize energy consumption, and react instantly to environmental changes. This API makes that possible!
Key Features and Use Cases:
- Turn Streetlights On/Off 🌃: Gain granular control over individual streetlights. This is incredibly useful for energy saving during off-peak hours, managing special events, or responding to emergencies.
- Dim Streetlights 😎: Adjust the brightness of streetlights to conserve energy while maintaining adequate illumination. Perfect for adapting to varying light conditions or implementing dynamic lighting schemes.
- Receive Real-Time Environmental Lighting Conditions 📈: Get immediate updates on ambient light levels. This data is crucial for implementing adaptive lighting, where streetlights automatically adjust based on natural light, leading to significant energy savings and improved public safety.
By leveraging this API, you can develop applications for smart city initiatives, energy management systems, public safety platforms, and much more. The possibilities are truly endless!
Prerequisites (Dependencies)
To effectively use the Smartylighting Streetlights API, you'll need to ensure you have the following in place:
- Kafka Client Library: This API communicates over Kafka. You'll need a Kafka client library compatible with your chosen programming language (e.g.,
confluent-kafka-pythonfor Python,kafka-clientsfor Java,node-rdkafkafor Node.js). - Network Access to Kafka Broker: Ensure your application has network connectivity to our Kafka test broker at
test.mykafkacluster.org:8092. - Authentication Credentials: You will need valid SASL/SCRAM credentials (username and password) to authenticate with the Kafka broker.
Note: Familiarity with Kafka concepts (topics, producers, consumers, messages) will be highly beneficial for a smooth integration experience.
Resources and Capabilities
The Smartylighting Streetlights API provides access to various resources and capabilities, allowing you to interact with streetlights in a meaningful way. Below is a summary of the key operations:
| Resource/Topic | Operation | Description | Message Type |
|---|---|---|---|
smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured | Publish (Receive) | Inform about environmental lighting conditions of a particular streetlight. This is where you'll receive real-time light measurement data. | lightMeasured |
smartylighting.streetlights.1.0.action.{streetlightId}.turn.on | Subscribe (Send) | Command a particular streetlight to turn its lights on. | turnOnOff |
smartylighting.streetlights.1.0.action.{streetlightId}.turn.off | Subscribe (Send) | Command a particular streetlight to turn its lights off. | turnOnOff |
smartylighting.streetlights.1.0.action.{streetlightId}.dim | Subscribe (Send) | Command a particular streetlight to dim its lights to a specified percentage. | dimLight |
Message Payloads:
lightMeasured:lumens(integer): Light intensity measured in lumens.sentAt(string, date-time): Date and time when the message was sent.
turnOnOff:command(boolean): Whether to turn on (true) or off (false) the light.sentAt(string, date-time): Date and time when the message was sent.
dimLight:percentage(integer, 0-100): Percentage to which the light should be dimmed.sentAt(string, date-time): Date and time when the message was sent.
Authentication
To ensure secure communication and access to the Smartylighting Streetlights API, we utilize SASL/SCRAM authentication.
How to Authenticate:
When connecting your Kafka client to our test broker (test.mykafkacluster.org:8092), you will need to provide your assigned username and password for SASL/SCRAM authentication. The specific configuration will vary slightly depending on your Kafka client library, but generally, it involves setting properties like:
sasl.mechanism=SCRAM-SHA-256(orSCRAM-SHA-512if supported)security.protocol=SASL_SSL(recommended for production, butSASL_PLAINTEXTmight be used for initial testing if SSL is not configured)sasl.username=sasl.password=
Please contact our support team or refer to your onboarding documentation to obtain your specific SASL/SCRAM credentials.
You're now equipped with the foundational knowledge to start building! We encourage you to experiment with the API and explore its full potential. Happy coding!