def __init__(self): self.mock = True self.comm = communicator.Communicator(self) self.data_sync = DataSync() self.id = "" self.name = "" self.wunder_key = "" self.operator = "" self.email = "" self.phone = "" self.location = "" self.longitude = "" self.latitude = "" self.twilio_acct_sid = "" self.twilio_auth_token = "" self.scheduler = None self.hostname = "" self.last_status = "" self.ifconn = InfluxDBClient("127.0.0.1", 8086, "root", "root") self.log = log.Log("smartmodule.log") self.rtc = rtc_interface.RTCInterface() self.rtc.power_on_rtc() self.launch_time = self.rtc.get_datetime() self.asset = Asset() self.asset.id = self.rtc.get_id() self.asset.context = self.rtc.get_context() self.asset.type = self.rtc.get_type() self.ai = asset_interface.AssetInterface(self.asset.type, self.rtc.mock) self.rtc.power_off_rtc()
def __init__(self): self.mock = True self.comm = communicator.Communicator(self) self.data_sync = DataSync() self.id = "" self.name = "" self.wunder_key = "" self.operator = "" self.email = "" self.phone = "" self.location = "" self.longitude = "" self.latitude = "" self.scheduler = None self.hostname = socket.gethostname() self.last_status = "" self.ifconn = None self.rtc = rtc_interface.RTCInterface() self.rtc.power_on_rtc() self.launch_time = self.rtc.get_datetime() self.asset = Asset() self.asset.id = self.rtc.get_id() self.asset.context = self.rtc.get_context() self.asset.type = self.rtc.get_type() self.ai = asset_interface.AssetInterface(self.asset.type, self.rtc.mock) self.rtc.power_off_rtc()
def get_asset_data(self): value = "" try: #ai = asset_interface.AssetInterface(self.asset.type) ai = asset_interface.AssetInterface() value = str(ai.read_value()) self.push_data(self.asset.name, self.asset.context, value, self.asset.unit) self.comm.send("RESPONSE/ASSET/" + self.asset.name, value) except Exception, excpt: logging.getLogger(sm_logger).exception( "Error getting asset data: %s", excpt)