LIFX Developer Zone

Bulbs not responding

Hi,

I’ve used two packets to get info about my bulbs (both LIFX Mini Day & Dusk) for awhile but suddenly they stopped working.

I’ve tried in Packet Sender and other software but there is no response returned from the bulbs. I’m able to ping them fine.

To get the label of the bulb:
24 00 00 34 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 00 00 00 00 00 00 00 00 17 00 00 00

To get the power state:
24 00 00 34 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 00 00 00 00 00 00 00 00 74 00 00 00

I’m able to switch the bulbs on and off just fine using the LAN protocol, I just can’t get a reply from these packets.

Hello,

I take it you’re broadcasting these? They don’t have a target set.

Broadcast packets are the first packets to be dropped by a router if it’s struggling. It’s recommended you determine the IP addresses of your bulbs (by broadcasting a GetService or looking at your router to see the IP addresses) and then unicasting to those.

Also, if you send a GetColor message you can get both label and power in the same reply.

You can try this out with Photons.

# Make a virtualenv and install photons into it
python3 -m venv .photons-core
./.photons-core/bin/pip install lifx-photons-core

# Then we can query the devices on the network
./.photons-core/bin/lifx lan:get_attr _ color

# or if you know the serial number of your device
# This way it'll keep doing discovery till it finds the device or timeout
./.photons-core/bin/lifx lan:get_attr d073d5001337 color

Though, if that doesn’t work, then it’s something else that’s wrong.

Hi @delfick,

Currently I’m sending those packets out to a specific IP address. I’m not using GetService at the moment, I’m just sending packets to the IP address that I specify.

So I would need to change this part to the MAC address of the bulb for it to work?:
24 00 00 34 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 00 00 00 00 00 00 00 00 17 00 00 00

Yeah, change the target to the MAC address.

Also, that packet doesn’t seem right. The response required bit isn’t set and the pkt_type is 5888.

You can also use photons to create the message if you want.

lifx pack --silent -- '{"ack_required": false, "res_required": true, "sequence": 1, "target": "d073d5001337", "protocol": 1024, "source": 1, "pkt_type": 101}'

So does Photons allow you to generate hex for LIFX? Also, I tried running that command above just to try it out and it said it wasn’t valid json?

For context, I’m trying to work this into a C# app.

Photons does many things :slight_smile:

That command won’t work in windows prompt because you have to escape it differently.

But you can use a script instead

Copy make_packet.py somewhere and .photons-core/bin/python make_packet.py

It seems changing the source value helped make it work.

When it comes to the source value, can you just pick anything and go with it? Or should it be something randomised every so often? Just wondering what’s the best way to avoid clashing with something else.

The source field can be anything (except 0, that has problems with the originals). It’s good practice to generate a random value and use that for the duration of your script. But each time you can pick a new value. Realistically it should be fine with a static source you always use.

Okay, thanks. It seems to work now and Photons was a big help.

Awesome! :slight_smile:

1 Like