Can a device handler reference other devices?

I have three contact sensor devices which represent the three signals from a thermostat to the HVAC system (heat call, cooling call, and fan call). I would like to present this information to an App as a device implementing the ThermostatOperatingState capability ("cooling", "heating", "fan only", "idle"). What I am trying to do doesn't fit nicely into the App/Device Handler dichotomy. Can I write a device handler that would subscribe to events from the contact sensors? Or, do I need to write a device handler and an app that work together to accomplish this translation?

I'd write an app that sets the state of a virtual thermostat. You might be able to do it in Rule machine.

The virtual thermostat adjusts the ThermostatOperatingState itself based on setpoints, temperature, and mode. I wouldn't be confident that the operating state would remain at what my App set it to.

To directly answer your question, devices cannot subscribe to or "see" other devices at all, at least not arbitrary other devices. Parent/child devices can communicate with each other, so depending on your needs, that may work. Alternatively, an app would allow this (for either child devices of that app or any device selected by a user input). A third possibility you could consider is combining your three (or four? I'm sorry if I don't completely understand the use) disparate devices into one custom device that tracks all three aspects, whether that's a custom thermostat-esque driver or something else.

As long as you don't setTemperature or change setpoint, you are fine. Even if you do, the next contact change will fix it back, since it is event based.