It can be done. This is a auto-discovery message for an openmqttgateway doorsensor (piped through a python script that parses the home/OpenMQTTGateway/SRFBtoMQTT messages and re-publish to sensor/xxx topic)
homeassistant/binary_sensor/garagedoor/config
'{"name": "garagedoor", "device_class": "garage_door", "state_topic": "sensor/garagedoor", "unique_id": "garagedoor", "off_delay": 30, "device": {"identifiers": ["rfbridge_564886"],"name": "garagedoor", "model": "Digoo door sensor", "manufacturer": "Digoo"}}'
The question is: how do you distinguish between a signal received from a switch and a signal received from a door sensor or a PIR ?