MCPcopy Create free account
hub / github.com/antirez/freakwan / __init__

Method __init__

sensor.py:16–27  ·  view source on GitHub ↗
(self,fw,sensor_config)

Source from the content-addressed store, hash-verified

14# get the reading from the sensors, encode and send the information.
15class Sensor:
16 def __init__(self,fw,sensor_config):
17 self.fw = fw
18 self.config = sensor_config
19 self.state = "send_sample"
20
21 # We don't want any automatic communication when acting as sensors.
22 fw.config['quiet'] = True
23 fw.config['automsg'] = False
24
25 # Add the sensor channel key if needed.
26 if not self.fw.keychain.has_key(self.config['key_name']):
27 self.fw.keychain.add_key(self.config['key_name'],self.config['key_secret'])
28
29 # This method is called from FreakWAN main loop in order to
30 # execute the sensor state machine, that is: send sample, wait

Callers

nothing calls this directly

Calls 2

has_keyMethod · 0.80
add_keyMethod · 0.80

Tested by

no test coverage detected