# LED Widget

**General Setting**

User can change following things in LED widget:

* Name for widget which will be used data referenceFor Example, if widget name is 'LED', then data of widget is referenced as LED.data
* Show title - User can show/hide widget title
* Title Color
* Background Color

![Configure LED Widget](/files/Amy599tjyKGb8OTniFJ9)

**Widget Setting**

In Widget Setting option, user can change following parameters:

* Key - key parameter of JSON Object which will define state of LED.
* LED Style - Select one from available options of LED

![Configure LED Widget](/files/KaOtU7Gqtwm2ELnPLdKf)

User can manage state of LED using MQTT or Actions. To change state of LED, user need to send data in following format.

```
{"dataKey":true/false}   
OR
{"dataKey":1/0} 

// 'dataKey' is set as key in widget form.
```

#### Source <a href="#source" id="source"></a>

User can select a source mode as MQTT or Action.

**Using MQTT**

Here, to change state of LED user can publish JSON object on given **data** MQTT topic. No need to provide \<account\_id> while providing the MQTT topic. The JSON object will be as below.

```
{"dataKey":true/false}   
OR
{"dataKey":1/0} 

// 'dataKey' is set as key in widget form.
```

![Configure LED Widget](/files/QEGMFak1fy8Zfs3kY8n0)

**Using Action**

Here, to change state of LED, output of the action should contain key-value pair with 'dataKey' key. User can also update the widget either onLoad or periodically by providing refresh interval.

![Configure LED Widget](/files/G29jVzWW9RX0ftnUL8wE)

#### Event Handling

LED widget does not support any event.

#### Example

If we configure LED Widget as below:

1. key - testWidgetKey

and set source type for widget as MQTT and topic configured is 'data'. And if we publish following JSON Object over 'data' topic then LED Widget will look as shown in image.

```
// Data over configured MQTT Topic

{ 
    "ledKey":true/1 
}

OR 

{ 
    "ledKey":false/0
}
```

![Enabled LED Widget](/files/jqJ1cwDgOe2f6PL1FGen) ![Disabled LED Widget](/files/US1rEmWqsxhtcHGvGByq)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thingsup.io/widgets/led-widget.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
