Unfortunately, since analog sensors only provide a voltage from 0 to 5V and no other information to the InterfaceKit or Hub they're connected to, you have no way of knowing what kind of sensor it is without looking at what is physically connected.
For the same reason, you can't know for sure whether there's even a sensor plugged in, since the VoltageInput is constantly measuring the voltage difference between the white and black pins regardless of whether there's a cable connected or not.
You may be able to write a part of your program that is able to make a guess as to whether a sensor is plugged in or not based on looking at the voltage values for a second or two. Typically, disconnected voltage inputs will have a value near 0 and will not fluctuate that much. If this behaviour is significantly different than a sensor you have plugged in, your program will have a good guess as to whether a sensor is connected.
Depending on what kind of sensors you're interested in using, you may be able to solve this problem by switching to a VINT Hub
and using the "smart" VINT device equivalents of those sensors. For example, instead of using an 1125
temperature/humidity sensor, you could use a HUM1000
. These smart devices do
tell the hub what kind of device they are and you'll get events when they connect and disconnect. They can be monitored using the Phidget Manager
, which is the same thing our control panel example uses to tell which Phidgets are connected.