void LoadChildDevices() { Scheduler.Classes.clsDeviceEnumeration devenum = HS.GetDeviceEnumerator() as Scheduler.Classes.clsDeviceEnumeration; while (!devenum.Finished) { Scheduler.Classes.DeviceClass hsDev = devenum.GetNext(); if (hsDev.get_Interface(null) != Constants.PLUGIN_STRING_NAME) { continue; // Not ours! } var extraData = hsDev.get_PlugExtraData_Get(HS); if (extraData == null) { extraData = new PlugExtraData.clsPlugExtraData(); } var typeStr = (string)extraData.GetNamed("EnOcean Type"); // if (typeStr == null) // Console.WriteLine("Warning: No device type set on child device"); var dataStr = (string)extraData.GetNamed("EnOcean Cfg"); var childConfig = new JObject(); if (dataStr != null) { childConfig = JObject.Parse(dataStr); } if (hsDev.get_Address(null).StartsWith(ControllerId)) { // Console.WriteLine("DT : {0} vs {1}", hsDev.get_Device_Type_String(null), EnOceanDeviceType.SimpleDevice.ToString()); if (hsDev.get_Device_Type_String(null) != "EnOcean " + EnOceanDeviceType.SimpleDevice.ToString()) { continue; } DeviceTypes.CreateDeviceInstance(HS, this, hsDev.get_Address(null), (string)childConfig["device_type"], childConfig); Console.WriteLine("Found child device: {0}", hsDev.get_Address(null)); } } }
public Scheduler.Classes.DeviceClass getHSDevice(EnOceanDeviceType type, string id = "") { Scheduler.Classes.clsDeviceEnumeration devenum = HS.GetDeviceEnumerator() as Scheduler.Classes.clsDeviceEnumeration; while (!devenum.Finished) { Scheduler.Classes.DeviceClass dev = devenum.GetNext(); if (dev.get_Interface(null) != Constants.PLUGIN_STRING_NAME) { continue; // Not ours! } if (dev.get_Device_Type_String(null) == "EnOcean " + type.ToString()) { string hsAddr = dev.get_Address(null); //FIXME: Should probably not use address but a plugin value! if (id == hsAddr) { return(dev); } } } return(null); }
public void GenericDeviceStuff(SiidDevice SiidDev) { Scheduler.Classes.DeviceClass Device = SiidDev.Device; Values["ID"] = SiidDev.Ref; Values["Name"] = Device.get_Name(Instance.host); Values["Floor"] = Device.get_Location2(Instance.host); Values["Room"] = Device.get_Location(Instance.host); Values["code"] = Device.get_Code(Instance.host); Values["address"] = Device.get_Address(Instance.host); Values["statusOnly"] = Device.get_Status_Support(Instance.host); Values["CanDim"] = Device.get_Can_Dim(Instance.host); Values["doNotLog"] = Instance.host.DeviceNoLog(SiidDev.Ref); // voiceC=AllInstances[InstanceFriendlyName].host.DeviceProperty_Boolean(DeviceID", HomeSeerAPI.Enums.eDeviceProperty.Prop; // includeInPower=AllInstances[InstanceFriendlyName].host.; // usePopUp=Device.use; //doNotUp = HomeSeerAPI.Enums.eCapabilities; Values["userAccess"] = Device.get_UserAccess(Instance.host); Values["notes"] = Device.get_UserNote(Instance.host); var DeviceType = Device.get_DeviceType_Get(Instance.host); Values["DeviceType"] = DeviceType.Device_API.ToString() + "?" + DeviceType.Device_API_Description.ToString() + "?" + DeviceType.Device_SubType.ToString() + "?" + DeviceType.Device_SubType_Description.ToString() + "?" + DeviceType.Device_Type.ToString() + "?" + DeviceType.Device_Type_Description.ToString(); Values["deviceTypeString"] = Device.get_Device_Type_String(Instance.host); Values["RelationshipStatus"] = Device.get_Relationship(Instance.host); Values["associatedDevicesList"] = Device.get_AssociatedDevices_List(Instance.host); HomeSeerAPI.VSVGPairs.VSPair[] AllStatus = Instance.host.DeviceVSP_GetAllStatus(SiidDev.Ref); Values["vsp"] = EncodeVSPairs(AllStatus); Values["vgp"] = EncodeVGPairs(AllStatus, SiidDev.Ref); // Values["vgp"] =; // Values["associatedDevices"]=Device.get_AssociatedDevices(Instance.host); }