22 lines
414 B
Python
22 lines
414 B
Python
from components.atemperatureSensor import ATemperatureSensor
|
|
import math
|
|
|
|
|
|
class TempSensorSim(ATemperatureSensor):
|
|
def name(self):
|
|
return "FakeTemp"
|
|
|
|
def __init__(self):
|
|
self.count = 0
|
|
self.freq = 0.2
|
|
self.log("Created")
|
|
self.temp = 22.37
|
|
|
|
def set_fake_temp(self, temp):
|
|
self.temp = temp
|
|
|
|
def temperature(self):
|
|
self.count += 1
|
|
return self.temp + 0.1*math.sin(2*math.pi*self.count*self.freq)
|
|
|