Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
build_type=data.get("btype", "Unknown"),
effect_count=data.get("fxcount", 0),
free_heap=data.get("freeheap", 0),
leds=Leds.from_dict(data),
live_ip=data.get("lip", "Unknown"),
live_mode=data.get("lm", "Unknown"),
live=data.get("live", False),
mac_address=data.get("mac", ""),
name=data.get("name", "WLED Light"),
pallet_count=data.get("palcount", 0),
product=data.get("product", "DIY Light"),
udp_port=data.get("udpport", 0),
uptime=data.get("uptime", 0),
version_id=data.get("vid", "Unknown"),
version=data.get("ver", "Unknown"),
wifi=Wifi.from_dict(data),
)
def from_dict(data: Dict[str, Any]) -> Optional[Wifi]:
"""Return Wifi object form WLED API response."""
if "wifi" not in data:
return None
wifi = data.get("wifi", {})
return Wifi(
bssid=wifi.get("bssid", "00:00:00:00:00:00"),
channel=wifi.get("channel", 0),
rssi=wifi.get("rssi", 0),
signal=wifi.get("signal", 0),
)
build_type: str
effect_count: int
free_heap: int
leds: Leds
live_ip: str
live_mode: str
live: bool
mac_address: str
name: str
pallet_count: int
product: str
udp_port: int
uptime: int
version_id: str
version: str
wifi: Optional[Wifi]
@staticmethod
def from_dict(data: Dict[str, Any]) -> Info:
"""Return Info object from WLED API response."""
return Info(
architecture=data.get("arch", "Unknown"),
arduino_core_version=data.get("core", "Unknown").replace("_", "."),
brand=data.get("brand", "WLED"),
build_type=data.get("btype", "Unknown"),
effect_count=data.get("fxcount", 0),
free_heap=data.get("freeheap", 0),
leds=Leds.from_dict(data),
live_ip=data.get("lip", "Unknown"),
live_mode=data.get("lm", "Unknown"),
live=data.get("live", False),
mac_address=data.get("mac", ""),