For future reference, under RRF3 the M305 command needs to be replaced with M308.
This is from my machine where I have a thermister connected to the second extruder (E1) thermister connector. The A term is the name of the sensor that appears in the extras list. The S value should be between 0 and 31 for a Duet 2.
M308 S10 A"Extra Thermister" P"e1_temp" Y"thermistor" T100000 B3950 R4700
More details at https://duet3d.dozuki.com/Wiki/RepRapFirmware_3_overview#Section_M308_Create_or_modify_sensor_or_report_sensor_parameters