Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def from_dict(data: Dict[str, Any]) -> Leds:
"""Return Leds object from WLED API response."""
leds = data.get("leds", {})
return Leds(
count=leds.get("count", 0),
max_power=leds.get("maxpwr", 0),
max_segments=leds.get("maxseg", 0),
pin=leds.get("pin", 0),
power=leds.get("pwr", 0),
rgbw=leds.get("rgbw", False),
)
rssi=wifi.get("rssi", 0),
signal=wifi.get("signal", 0),
)
@dataclass
class Info:
"""Object holding information from WLED."""
architecture: str
arduino_core_version: str
brand: str
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."""