Skip to content

Commit

Permalink
v0.8.7 Bug Fixes to Configs
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric authored and Eric committed Mar 30, 2020
1 parent e6424d2 commit 1be8ae7
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mudpi-core",
"version": "0.8.6",
"version": "0.8.7",
"description": "Configurable automated smart garden for raspberry pi",
"bugs": "https://github.com/mudpi/mudpi-core/issues",
"contributors": [
Expand Down
2 changes: 1 addition & 1 deletion workers/adc_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def init_sensors(self):
'type').capitalize() + 'Sensor'
# analog_pin_mode = False if sensor.get('is_digital', False) else True
imported_sensor = self.dynamic_sensor_import(sensor_type)
new_sensor = imported_sensor(sensor.get('pin'),
new_sensor = imported_sensor(int(sensor.get('pin')),
name=sensor.get('name', sensor.get('type')),
key=sensor.get('key', None),
mcp=self.mcp)
Expand Down
2 changes: 1 addition & 1 deletion workers/arduino_control_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def init_controls(self):
# Define default kwargs for all control types, conditionally include optional variables below if they exist
control_kwargs = {
'name' : control.get('name', control.get('type')),
'pin' : control.get('pin'),
'pin' : int(control.get('pin')),
'connection': self.connection,
'key' : control.get('key', None),
'analog_pin_mode': analog_pin_mode,
Expand Down
2 changes: 1 addition & 1 deletion workers/arduino_sensor_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def init_sensors(self, connection=None):
# Define default kwargs for all sensor types, conditionally include optional variables below if they exist
sensor_kwargs = {
'name' : sensor.get('name', sensor.get('type')),
'pin' : sensor.get('pin'),
'pin' : int(sensor.get('pin')),
'connection': self.connection,
'key' : sensor.get('key', None)
}
Expand Down
12 changes: 6 additions & 6 deletions workers/camera_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ def __init__(self, config, main_thread_running, system_ready, camera_available):
self.camera_available = camera_available

#Dynamic Properties based on config
self.path = self.config['path'].replace(" ", "-") if self.config['path'] is not None else 'mudpi/img/'
self.path = self.config['path'].replace(" ", "-") if self.config['path'] is not None else '/etc/mudpi/img/'
self.topic = self.config['topic'].replace(" ", "/").lower() if self.config['topic'] is not None else 'mudpi/camera/'
if self.config['resolution'] is not None:
self.resolutionX = self.config['resolution'].get('x', 1920)
self.resolutionY = self.config['resolution'].get('y', 1080)
self.resolutionX = int(self.config['resolution'].get('x', 1920))
self.resolutionY = int(self.config['resolution'].get('y', 1080))
if self.config['delay'] is not None:
self.hours = self.config['delay'].get('hours', 0)
self.minutes = self.config['delay'].get('minutes', 0)
self.seconds = self.config['delay'].get('seconds', 0)
self.hours = int(self.config['delay'].get('hours', 0))
self.minutes = int(self.config['delay'].get('minutes', 0))
self.seconds = int(self.config['delay'].get('seconds', 0))

self.init()
return
Expand Down
2 changes: 1 addition & 1 deletion workers/pi_control_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def init_controls(self):
# Define default kwargs for all control types, conditionally include optional variables below if they exist
control_kwargs = {
'name' : control.get('name', control.get('type')),
'pin' : control.get('pin'),
'pin' : int(control.get('pin')),
'key' : control.get('key', None),
'topic': control.get('topic', None),
'resistor': control.get('resistor', None),
Expand Down
2 changes: 1 addition & 1 deletion workers/pi_sensor_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def init_sensors(self):
# Define default kwargs for all sensor types, conditionally include optional variables below if they exist
sensor_kwargs = {
'name' : sensor.get('name', sensor.get('type')),
'pin' : sensor.get('pin'),
'pin' : int(sensor.get('pin')),
'key' : sensor.get('key', None)
}

Expand Down
1 change: 1 addition & 0 deletions workers/pump_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class PumpWorker():
def __init__(self, config, main_thread_running, system_ready, pump_ready, pump_should_be_running):
#self.config = {**config, **self.config}
self.config = config
self.config['pin'] = int(self.config['pin']) #parse possbile strings to avoid errors
self.main_thread_running = main_thread_running
self.system_ready = system_ready
self.pump_ready = pump_ready
Expand Down
1 change: 1 addition & 0 deletions workers/relay_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class RelayWorker():
def __init__(self, config, main_thread_running, system_ready, relay_available, relay_active):
#self.config = {**config, **self.config}
self.config = config
self.config['pin'] = int(self.config['pin']) #parse possbile strings to avoid errors

#Events
self.main_thread_running = main_thread_running
Expand Down
2 changes: 1 addition & 1 deletion workers/sensor_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def init_sensors(self):
# Define default kwargs for all sensor types, conditionally include optional variables below if they exist
sensor_kwargs = {
'name' : sensor.get('name', sensor.get('type')),
'pin' : sensor.get('pin'),
'pin' : int(sensor.get('pin')),
'connection': self.connection,
'key' : sensor.get('key', None)
}
Expand Down

0 comments on commit 1be8ae7

Please sign in to comment.