Components Behavior and IoT Integration

Behavior

Table 1.
Component Behavior Behavior
Toggle Functionality The LED turns on when the button is pressed and turns off when the button is pressed again, effectively toggling its state with each press. Publish the LED status to the IoT platform via MQTT whenever it changes. This updates the value of the property.
PIR Motion Sensor Detects movement within its range. Publish the PIR status to the IoT platform via MQTT whenever it changes. This updates the value of the property.
Humidity and Temperature Sensor Reads humidity and temperature values and displays them on an LCD screen. Publish sensor readings to the IoT platform via MQTT when significant changes occur.
RGB LED Users can choose the LED mode by updating the value of a property in IoT Studio.
  • Use MQTT to receive mode changes from the IoT platform and update the LED accordingly.
  • Ensure the current mode is published back to the platform for synchronization.
Fan The fan is controlled by a second physical button and can also be controlled remotely from IoT Studio through actions. When the fan’s status is changed (either manually or via IoT Studio), a message is sent via MQTT to update the platform with the new state, and the corresponding action is performed (turn it on or off).
Window The window's status (open or closed) can be controlled remotely via IoT Studio. When the window's status is changed, a message is sent via MQTT to update the platform with the new state, and the corresponding action is performed (turn it on or off).
Raindrop Sensor The raindrop sensor monitors rainfall intensity. If rain is detected, the sensor value changes and is updated on the platform. The raindrop sensor constantly monitors for rain, and any change in its value is also sent to the platform via MQTT.
Door The door's status (open or closed) can be controlled remotely via IoT Studio or triggered by scanning the correct RFID card. When the door status changes (either from an RFID scan or a command from IoT Studio), the new status is sent to the platform via MQTT.
RFID Sensor
  • The RFID sensor authorizes or denies access based on predefined access cards.
  • When an authorized RFID tag is scanned, the door opens for 3 seconds, and a success message is displayed on the LCD.
  • If an unauthorized RFID tag is scanned, a "denied" message is shown on the LCD.
Successful or denied access attempts trigger corresponding events. If access is denied, a SecurityAlert event is sent to the platform, and users can be notified through email or push notifications.
Gas Alarm When gas is detected, a "warning" message is displayed on the LCD to alert the occupants. Publish sensor readings to the IoT platform via MQTT when significant changes occur.