MQTT sensor, how to use with attributes?

If the state_topic can receive payloads meant for more than one sensor, you should consider implementing Strategy #2 described in the following topic: