Discovery

A simple discovery script, able to discover all Lifx devices in LAN, is already shipped with this package:

python3 -m lifx.lan.discovery
class lifx.lan.Discovery(remote: Tuple[str, int])
GET_SERVICE = 'get_service'
GET = 'get_light'
GET_POWER = 'get_power_light'
STATE_SERVICE = 'state_service'
connection_made(transport: asyncio.transports.DatagramTransport)

Called when a connection is made.

The argument is the transport representing the pipe connection. To receive data, wait for data_received() calls. When the connection is closed, connection_lost() is called.

datagram_received(data: Union[bytes, str], addr: Tuple[str, int])

Called when some datagram is received.

broadcast()