In our MIP SDK plugin integration, we have a custom sensor item. This item can either be automatically created from the background plug-in using the create Item method
of the ItemManager class of our sensor item, or manually created through the configuration client. But we noticed differences in behavior between the items manually created
and items created by the background plugin.
Automatically created items:
Are created by the background plugin by calling the CreateItem from the item manager class
private void CreateNewSensor(string name, string tag_id) {
// create a new ObjID
Guid new_objId = Guid.NewGuid();
// create a suggested FQID
FQID suggestedFQID = new FQID(_connectedEAGL.FQID.ServerId, _connectedEAGL.FQID.ObjectId, new_objId, FolderType.No, EAGL_alarmDefinition.EAGL_sensorKind);
// new user controls
EaglSensorUserControl userControl = new EaglSensorUserControl();
// new item manager instance
EAGL_sensorItemManager item_manager = new EAGL_sensorItemManager(EAGL_alarmDefinition.EAGL_sensorKind);
// use the item manager to create the item
Item CurrentItem = item_manager.CreateItem(_connectedEAGL, suggestedFQID, tag_id);
// set the item properties of the item
CurrentItem.Properties["TagId"] = tag_id;
CurrentItem.Properties["Sensor_name"] = tag_id;
userControl.FillContent(CurrentItem);
// save the item
Configuration.Instance.SaveItemConfiguration(EAGL_alarmDefinition.EAGL_alarmPluginId, CurrentItem);
EnvironmentManager.Instance.Log(false, "EAGL_alarmBackgroundPlugin", "Created a sensor");
}
note: I think the issue might lies in the suggested fqid definition
This is what the CreateItem method looks like:
// automatically created items
public Item CreateItem(Item parentItem, FQID suggestedFQID, String name)
{
EnvironmentManager.Instance.Log(false, "EAGL_alarmBackgroundPlugin automatic", suggestedFQID.ToString());
CurrentItem = new Item(suggestedFQID, name);
if (_userControl != null)
{
_userControl.FillContent(CurrentItem);
}
Configuration.Instance.SaveItemConfiguration(EAGL_alarmDefinition.EAGL_alarmPluginId, CurrentItem);
return CurrentItem;
}
created items visible in the management client
Manually creating items:
Differences between manually created items and automatically created items:
Only manually created item appear as possible source for rule trigger events (using our custom event)
Only automatically added items appear when getting a list of sensor items:
// get all the sensors here
List<Item> sensors = Configuration.Instance.GetItemConfigurations(EAGL_alarmDefinition.EAGL_alarmPluginId, _connectedEAGL, EAGL_alarmDefinition.EAGL_sensorKind);
This call would only return sensor 1 and 2 but not the manually added sensors.
I am confused about the difference in the backend between manually created items and items created through the Item Manager. Can someone give me some insight as to what might be causing the difference between the two items?
Thank you



