WebCore, converting from type of sensor to another

Hi all, I had a couple of D-Link DCS-5222L cameras sitting around and decided to play around with their IO port. You can configure the camera to turn the IO port high when the camera detects motion. So merry as I am I, I hooked up a zwave contact sensor to the port and figured out a way to power it from the camera, eliminating the need for a battery.

Second, I created a couple of virtual motion sensors and have set up a piston to run them like as follows:

This lead to a couple of questions:

  1. is there any performance degradation from pre-defining the devices at the beginning of the piston?
  2. is there a more efficient way to implement this?

Thanks for any insights.

If there is a performance hit it should be very small. Since the devices don't change after definition, you may negate any hit experienced by declaring them as constants in addition to devices.

If you can find a Hubitat Driver for the Z-Wave Contact Sensor, it would be pretty trivial to add the "Motion Sensor" capability to it, and keep the 'motion' attribute updated whenever the 'contact' attribute is updated. This way, all of the work is done in the driver, thereby eliminating the Virtual device and webCoRE piston.

Agreed, that would make a lot more sense. I did check the Hubitat repository, yet I didn't find the source for the generic z-wave contact sensor driver.

Unless somebody have asked support for it already and perhaps could post a copy, I'd be inclined to try to port one of the built-in example DHT's from the SmartThings IDE.

1 Like

@Thebearmy - Thanks for confirming, I had an idea that declaring a device=physical device is more or less just a pointer, however it doesn't look like you can or need to declare the device a constant for that same reason.