Fix octoprint sensor (#3385)

* Fix non-temperature sensors for octoprint

* Fix double space in octoprint temperature names

* Fix tox linting errors
This commit is contained in:
Jeff Wilson 2016-09-14 02:10:49 -04:00 committed by Paulus Schoutsen
parent b78e98702a
commit 7724cb9eb4

View File

@ -60,17 +60,14 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
tool) tool)
devices.append(new_sensor) devices.append(new_sensor)
else: else:
_LOGGER.error("Unknown OctoPrint sensor type: %s", octo_type) new_sensor = OctoPrintSensor(octoprint.OCTOPRINT,
octo_type,
new_sensor = OctoPrintSensor(octoprint.OCTOPRINT, SENSOR_TYPES[octo_type][2],
octo_type, name,
SENSOR_TYPES[octo_type][2], SENSOR_TYPES[octo_type][3],
name, SENSOR_TYPES[octo_type][0],
SENSOR_TYPES[octo_type][3], SENSOR_TYPES[octo_type][1])
SENSOR_TYPES[octo_type][0], devices.append(new_sensor)
SENSOR_TYPES[octo_type][1])
devices.append(new_sensor)
add_devices(devices) add_devices(devices)
@ -87,7 +84,7 @@ class OctoPrintSensor(Entity):
self._name = '{} {}'.format(sensor_name, condition) self._name = '{} {}'.format(sensor_name, condition)
else: else:
self._name = '{} {} {} {}'.format( self._name = '{} {} {} {}'.format(
sensor_name, condition, tool, ' temp') sensor_name, condition, tool, 'temp')
self.sensor_type = sensor_type self.sensor_type = sensor_type
self.api = api self.api = api
self._state = None self._state = None