Bot releases are hidden (Show)
Published by kizniche over 3 years ago
This release contains changes that requires modification to any Custom Functions you may have in use. In order for the new features to work for Custom Functions, it required the use of an abstract base function class (similarly to Inputs and Outputs). As a result, any Custom Functions that previously were formatted as such:
from mycodo.controllers.base_controller import AbstractController
class CustomModule(AbstractController, threading.Thread):
"""
Class to operate custom controller
"""
def __init__(self, ready, unique_id, testing=False):
threading.Thread.__init__(self)
super(CustomModule, self).__init__(ready, unique_id=unique_id, name=__name__)
self.unique_id = unique_id
self.log_level_debug = None
# Set custom options
custom_function = db_retrieve_table_daemon(
CustomController, unique_id=unique_id)
self.setup_custom_options(
FUNCTION_INFORMATION['custom_options'], custom_function)
will need to be changed to the format:
from mycodo.functions.base_function import AbstractFunction
class CustomModule(AbstractFunction):
"""
Class to operate custom controller
"""
def __init__(self, function, testing=False):
super(CustomModule, self).__init__(function, testing=testing, name=__name__)
# Note: The following 2 lines are no longer needed to be defined here. Delete them.
# self.unique_id = function.unique_id
# self.log_level_debug = None
# Set custom options
custom_function = db_retrieve_table_daemon(
CustomController, unique_id=self.unique_id) # Note: "self." is added here
self.setup_custom_options(
FUNCTION_INFORMATION['custom_options'], custom_function)
# These two lines are new and are required to execute initialize_variables()
if not testing:
self.initialize_variables()
You also no longer need to define the following (i.e. you can remove these lines):
controller = db_retrieve_table_daemon(
CustomController, unique_id=self.unique_id)
self.log_level_debug = controller.log_level_debug
self.set_log_level_debug(self.log_level_debug)
Additionally, if you have pre_stop() in your Function Class, it will need to be renamed to stop_function().
There are two ways to perform these changes.
Method A:
Method B:
Method A is more involved, but does not require accessing the Pi from outside the web UI. Method B has fewer steps and doesn't require deleting and reconfiguring new Functions, but requires being able to SSH in to your Raspberry Pi or connecting a keyboard/mouse/monitor to be able to edit the files in-place.
As always, a backup of the current system files and settings is performed during an upgrade, allowing you to restore your system to a previous release state if needed.
Published by kizniche over 3 years ago
This bugfix release changes how sessions are handled and as a result will log all users out following the upgrade.
Published by kizniche over 3 years ago
This release contains bug fixes and several new types of Inputs and Outputs. These include stepper motors, digital-to-analog converters, a multi-channel PWM output, as well as an input to acquire current and future weather conditions.
This release also deprecates Math controllers. Current Math controllers will continue to function, but new Math controllers cannot be created. Instead, all Math controller functionality has been ported to Functions (Setup -> Function page), in order to reduce complexity and improve customizability. Much like Inputs and Outputs, Functions are single-file modules that can be created by users and imported. Take a look at the Mycodo/mycodo/functions directory for the built-in Function modules.
The new weather input acquires current and future weather conditions from openweathermap.org with either a city (200,000 to choose from) or latitude/longitude for a location and a time frame from the present up to 7 days in the future, with a resolution of days or hours. An API key to use the service is free and the measurements returned include temperature (including minimum and maximum if forecasting days in the future), humidity, dew point, pressure, wind speed, and wind direction. This can be useful for incorporating current or future weather conditions into your conditional controllers or other functions or calculations. For instance, you may prevent Mycodo from watering your outdoor plants if the forecasted temperature in the next 12 to 24 hours is below freezing. You may also want to be alerted by email if the forecasted weather conditions are extreme. Not everyone wants to set up a weather station, but might still want to have local outdoor measurements, so this input was made to bridge that gap.
Published by kizniche almost 4 years ago
Published by kizniche about 4 years ago
Published by kizniche about 4 years ago
Published by kizniche about 4 years ago
This release changes the Output framework to add the ability for a single Output to control multiple channels. This was originally based on the PCF8574 8-bit I/O Expander, which allows 8 additional IO pins to be controlled via the I2C bus, but applies to any other output device with more than one channel. As a result of this change, you will need to update any Custom Outputs to follow the new format (see /mycodo/outputs directory).
Published by kizniche about 4 years ago
Published by kizniche about 4 years ago
This update includes the final refactoring of the output system to accommodate output modules that can operate multiple different types of output types. For instance, a peristaltic pump can be instructed to turn on for a duration or instructed to pump a volume. As a result of the output framework being modified to accommodate this, the duty_cycle parameter was removed from output_on_off()
and output_on()
functions of the DaemonControl
class of mycodo_client.py. As a result, if you were previously using either of these function, you will need to add the parameter output_type='pwm'
and change the duty_cycle
parameter to amount
. For example, output_on(output_id, duty_cycle=50)
would need to be changed to output_on(output_id, output_type='pwm', amount=50)
, and output_on_off(output_id, 'on', duty_cycle=50)
to output_on_off(output_id, 'on', output_type='pwm', amount=50)
.
This update also adds the ability to import custom Widget modules. Much like custom Inputs, Outputs, and Functions, you can now create and import your own single-file Widget module that allow new widgets to be added to a dashboard.
Published by kizniche about 4 years ago
Published by kizniche about 4 years ago
Published by kizniche about 4 years ago
Published by kizniche about 4 years ago