A multifunction valve for a flange of a high pressure hydrogen tank for a fuel cell automotive system, comprising: A) a valve body comprising a main portion and an attachment portion which extends from the main portion along an attachment axis and ends with a head surface, wherein: a) said attachment portion internally has: i) an inlet duct ending, at one end distal from the main portion, with an inlet port on the head surface; ii) an outlet duct ending, at one end distal from the main portion, with an outlet port on the head surface; iii) a sensor duct ending, at one end distal from the main portion, with a sensor port on the head surface; iv) a thermal safety duct ending, at one end distal from the main portion, with a thermal safety port on the head surface; B) a one-piece ejector body, applicable to the head surface of the attachment portion so as to leave the outlet port uncovered, provided with: a) an ejector base having a lateral surface shaped so as to be contained in the head surface of the attachment portion, comprising an annular stop element, provided with a hole which, when the ejector body is applied to the attachment portion, is aligned with the sensor port; b) an ejector tube, axially protruding from the ejector base, provided internally with an ejector duct which, when the ejector body is applied to the attachment portion, is in fluid communication with the inlet duct through the inlet port; C) a temperature detection device, comprising a protective cap, protruding axially from the sensor port on the head surface, and a temperature sensor, located inside the cap, wherein the cap passes through the hole of the stop element of the ejector body. A) a valve body comprising a main portion and an attachment portion which extends from the main portion along an attachment axis and ends with a head surface, wherein: a) said attachment portion internally has: i) an inlet duct ending, at one end distal from the main portion, with an inlet port on the head surface; ii) an outlet duct ending, at one end distal from the main portion, with an outlet port on the head surface; iii) a sensor duct ending, at one end distal from the main portion, with a sensor port on the head surface; iv) a thermal safety duct ending, at one end distal from the main portion, with a thermal safety port on the head surface; a) said attachment portion internally has: i) an inlet duct ending, at one end distal from the main portion, with an inlet port on the head surface; ii) an outlet duct ending, at one end distal from the main portion, with an outlet port on the head surface; iii) a sensor duct ending, at one end distal from the main portion, with a sensor port on the head surface; iv) a thermal safety duct ending, at one end distal from the main portion, with a thermal safety port on the head surface; i) an inlet duct ending, at one end distal from the main portion, with an inlet port on the head surface; ii) an outlet duct ending, at one end distal from the main portion, with an outlet port on the head surface; iii) a sensor duct ending, at one end distal from the main portion, with a sensor port on the head surface; iv) a thermal safety duct ending, at one end distal from the main portion, with a thermal safety port on the head surface; B) a one-piece ejector body, applicable to the head surface of the attachment portion so as to leave the outlet port uncovered, provided with: a) an ejector base having a lateral surface shaped so as to be contained in the head surface of the attachment portion, comprising an annular stop element, provided with a hole which, when the ejector body is applied to the attachment portion, is aligned with the sensor port; b) an ejector tube, axially protruding from the ejector base, provided internally with an ejector duct which, when the ejector body is applied to the attachment portion, is in fluid communication with the inlet duct through the inlet port; a) an ejector base having a lateral surface shaped so as to be contained in the head surface of the attachment portion, comprising an annular stop element, provided with a hole which, when the ejector body is applied to the attachment portion, is aligned with the sensor port; b) an ejector tube, axially protruding from the ejector base, provided internally with an ejector duct which, when the ejector body is applied to the attachment portion, is in fluid communication with the inlet duct through the inlet port; C) a temperature detection device, comprising a protective cap, protruding axially from the sensor port on the head surface, and a temperature sensor, located inside the cap, wherein the cap passes through the hole of the stop element of the ejector body.