from components import ATemperatureSensor
import numpy as np


class TempSensorSim(ATemperatureSensor):
	def name(self):
		return "FakeTemp"

	def __init__(self, temp_offset=0.0, variance=0.0, **kwargs):
		ATemperatureSensor.__init__(self)
		self.temp_set = 19.99
		self.offset = temp_offset
		self.variance = variance

	def set_fake_temp(self, temp):
		self.temp_set = temp

	def temperature(self):
		return self.temp_set + self.offset + self.variance * np.random.normal(0, 1) / np.sqrt(12.0)
