|
Post by papa on Dec 6, 2021 22:26:43 GMT
LIFX Smart Bulb & OpenHAB, Introduction (Pronounced "Life X")
I was looking for a smart bulb that did not need a hub or bridge & could work with openHAB 3. I got this LIFX White bulb (model E26 base) for a standard U.S. bulb socket. Other types of bulbs (including color & other types of sockets) are available. These bulbs use an ESP32, but I have no plans so far to put new firmware on it. It uses 8.5 watts & can give a 50 watt equivalent of illumination (650 lumens). It seems to be fixed at a ("warm") 2700 Kelvin temperature/appearance. My LIFX White bulb can be set up & controlled with a smart phone, but I mainly used my phone to link the LIFX to my WiFi & update firmware (settings via the gear icon). I found some tricks for the WiFi & openHAB setup that I'll give below. Other threads will give examples of using the smart bulb with openHAB. Next, Connect the LIFX Bulb to WiFi
|
|
|
Post by papa on Dec 6, 2021 22:43:14 GMT
Connect the LIFX Bulb to WiFi
On your smart phone, search for & install the LIFX app for your phone's operating system.
Important: The following works better if in your phone's settings, you temporarily turn off Mobile Data. Of course, have WiFi on & connected.
It may also help setup to power the bulb temporarily near your WiFi router. Use a light socket that has a switch.
In the LIFX app near the bottom right, click the "+" sign to add new device. Then click "New Device" & then "New Light." On the Setup page, click the green arrow at the bottom right. When the app finds your bulb, click "connect." Continue through the screens. For our openHAB purposes, you can stop when the bulb is connected to your WiFi.
Sometimes the LIFX app tells us to "try again." In that case, switch the bulb socket on & off five times with each switch being about 1 second apart. This resets the device. Start over with instructions in the previous paragraph.
Once the LIFX bulb is connected to WiFi, you can turn on the phone's Mobile Data.
Next, Prepare OpenHAB for the LIFX Bulb
|
|
|
Post by papa on Dec 7, 2021 21:34:18 GMT
Prepare OpenHAB for the LIFX Bulb
Go to localhost:8080/settings/addons/binding. There click the "+" icon & then search for & install the LIFX binding.
After that, I fussed long over successfully creating a LIFX White Thing for the LIFX binding, both via the inbox & manually. I did more research & found reference to LIFX using UDP port 56700. Oh, I wondered, does that port needs to be opened in the firewall?
The following is VERY important for openHAB success. It's for Linux, but in parallel, you can check Windows Firewall rules & create a new rule if necessary.
In Linux Terminal, execute sudo ufw status
To open UDP port 56700, in Linux Terminal, execute sudo ufw allow 56700/udp
Next, Create LIFX Thing in OpenHAB
|
|
|
Post by papa on Dec 7, 2021 22:04:14 GMT
Create LIFX Thing in OpenHAB
Go to localhost:8080/settings/things/add. Click LIFX Binding.
At the top, click the (inbox) Scan button.
At the bottom, you should see that the inbox has a new addition. Click on that.
Accept the LIFX Thing.
Go to localhost:8080/settings/things. Click the LIFX Thing. In those properties, you may add an optional location (like location in the home). For sure in the host field, add the LIFX's IP address. (Log into your router & get IP from the DHCP client list.) Click Save at the upper right.
After the above, in the Things list we should see the LIFX Thing & we hope to see a green ONLINE button beside it. Perhaps because my openHAB is very full or peculiar to the LIFX, until much later, my LIFX Thing stayed offline even with rebooting openHAB (with & without clearing the openHAB cache).
However, even with the LIFX Thing labeled "OFFLINE," I was able to proceed to the next step. (Eventually the ONLINE status showed up.)
NEXT, Configure LIFX Channels & Link to Items
|
|
|
Post by papa on Dec 8, 2021 19:19:35 GMT
Configure LIFX Channels & Link to ItemsFor the LIFX White bulb, Brightness & Signal Strength are the main channels. A (Color) Temperature channel is also offered, but since the LIFX White's Temperature seems fixed, no point in using this channel. Temperature & other channels may be usable in other types of LIFX bulbs (especially color bulbs). Click on the LIFX Thing then the Channel tab. Then click on the Brightness channel. Click Add Link to Item. You could create a related Item in an .items file & link to an existing item. However, it's easier to click beside Create a New Item. You may edit what openHAB offers or accept as is. When ready, scroll to the bottom & click Link. Do the same for the Signal Strength Channel. To use for the next post, make note of the Items' names linked to the Brightness & Signal Strength channels.
Note: I created items named LIFXWhiteUpBR_Brightness & LIFXWhiteUpBR_RSSI
Next, Display/Control LIFX Bulb in HABPanel
|
|
|
Post by papa on Dec 8, 2021 19:31:21 GMT
Display/Control LIFX Bulb in HABPanelIn your browser, go to localhost:8080/ habpanel. At the upper right, click the gear icon. Scroll down to an existing dashboard to receive LIFX widgets OR scroll to the bottom & at the bottom left, click Add new dashboard. Click on the dashboard you want to use. In your chosen dashboard, add a slider widget for Brightness & a dummy widget for Signal Strength. For each widget's "openHAB item" field, find & select the items you linked in the last post. Save & run the updated dashboard. After success with the above, you can click or slide the select point on the Brightness widget to change the LIFX bulb's brightness. The following threads give examples of using a smart bulb with openHAB:
|
|