private RpmSmartPlugState getTpLinkState() { try { var tp = new TPLink_SmartPlug.HS1XX(System.Net.IPAddress.Parse(IpAddress), 10000, 0, 0); var dev_info = tp.GetDeviceInfo(); return(dev_info != null ? dev_info.RelayState == (byte)0 ? RpmSmartPlugState.off : RpmSmartPlugState.on : RpmSmartPlugState.unknown); } catch (Exception ex) { throw new RpmSmartPlugCommunicationException($"Could not get state from plug. Message: {ex.Message}", RpmSmartPlugs.TPLinkHS110, IpAddress, ex); } }
private string getTpLinkAlias() { try { var tp = new TPLink_SmartPlug.HS1XX(System.Net.IPAddress.Parse(IpAddress), 10000, 0, 0); var dev_info = tp.GetDeviceInfo(); return(dev_info?.Alias); } catch (Exception ex) { throw new RpmSmartPlugCommunicationException($"Could not get name from plug. Message: {ex.Message}", RpmSmartPlugs.TPLinkHS110, IpAddress, ex); } }