temperature_host: Improve backwards compatibility check

Don't register two names for the same instance of the sensor.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-02-19 18:51:42 -05:00
parent 3d35c003db
commit 227d9bdbcf
1 changed files with 5 additions and 2 deletions

View File

@ -18,8 +18,11 @@ class Temperature_HOST:
self.temp = self.min_temp = self.max_temp = 0.0
self.printer.add_object("rpi_temperature " + self.name, self) # XXX
self.printer.add_object("temperature_host " + self.name, self)
if config.get("sensor_type", "", note_valid=False).startswith('rpi'):
# Temporary backwards compatibility
self.printer.add_object("rpi_temperature " + self.name, self)
else:
self.printer.add_object("temperature_host " + self.name, self)
if self.printer.get_start_args().get('debugoutput') is not None:
return
self.sample_timer = self.reactor.register_timer(