Skip to content
This repository has been archived by the owner on Aug 22, 2021. It is now read-only.

Gamma Correction

Sacha Telgenhof edited this page Apr 8, 2019 · 7 revisions

AiLight

Since release: v0.3.0

The LED's in your Ai-Thinker LED RGBW light work in a linear way, that if you set its level to the maximum it will produce light with the maximum intensity. Likewise, if you set it to 50%, it will produce light with half intensity. Unfortunately, our eyes don't perceive light in a linear way.

To compensate for this, a process called Gamma Correction can be applied to the LED's light intensity. The correction will make the light's intensity match better how our eyes perceive the intensity of the LED's.

(Reference: https://en.wikipedia.org/wiki/Gamma_correction)

How to use

Setting the Gamma Correction of your Ai-Thinker LED RGBW light can be done in 3 different ways:

1. AiLight Web UI

The AiLight firmware contains an option to apply Gamma Correction to your Ai-Thinker LED RGBW light. You can simply enable or disable this option in the 'Light' page of the Web UI.

AiLight - Light Controls

2. Using MQTT

You can alternatively set the Gamma Correction by publishing an MQTT message to your Ai-Thinker LED RGBW light. To do that, simply send a JSON message to the MQTT Command Topic set for your Ai-Thinker LED RGBW light.

Example:

{"state":"ON","gamma":true}

Using mosquitto_pub:

mosquitto_pub -h <your_mqtt_broker> -t <your_ailight_command_topic> -m '{"state":"ON","gamma":true}'

This will turn on your Ai-Thinker LED RGBW light with Gamma Correction enabled.

3. Using the REST API

With the embedded REST API you can control your Ai-Thinker LED RGBW light parameters like the Gamma Correction. Using the cURL client as an example, send the following command to control the Gamma Correction:

curl -X PATCH http://<your_ailight_ip_address_or_hostname_here>/api/light -H 'API-Key: <your_api_key_here>' -d '{"gamma": true, "state": "ON"}'

This will turn on your Ai-Thinker LED RGBW light with Gamma Correction enabled.

Checkout the REST API Wiki page on how to use the embedded REST API.