def add_entity(device: SmartPlug, async_add_entities):
    'Check if device is online and add the entity.'
    device.get_sysinfo()
    async_add_entities([SmartPlugSwitch(device)], update_before_add=True)
Check if device is online and add the entity.
def add_entity(device: SmartPlug, async_add_entities):
    
    device.get_sysinfo()
    async_add_entities([SmartPlugSwitch(device)], update_before_add=True)