Output module(s) Sparkfun Relay kits!

Hey again,

so the last couple of days I spent my free time trying to setup my unsupported powerbox with a custom module. With a little help from a friend I succeeded.

there’s 2 versions.

A version with sparkfuns Slow_pwm function. You can set duty cycle’s to a promised Hertz rate. However it will only switch states twice every second. once off and once on. The time the relay is in on_state is the duty_cycles percent…

This was so utterly useless to me I changed the code to an on/off version as well. Both modules are attached below.

btw: if you have on/off and PWM in 1 module I didn’t get it to show configured because with on / off its expecting on or nothing, and not a PWM Value… or 0… you might want to look into that…

without further ado:

Sparkfun solid state relay 2.py (8.1 KB)
Sparkfun solid state relay PWM 2.py (10.9 KB)


Great. Thanks for sharing the models you made. I’ve never done it, but you should be able to have a mix of on/off and PWM channels in an output. You would just need to have the measurements and channels defined appropriately and set the output types to both on/off and PWM.

With the update of 8.13 my modules cannot errors it’s initialise with the error:

2022-04-05 16:51:07,587 - ERROR - mycodo.outputs.sparkfun qwiic relay_616e40b2 - OutputModule did not overwrite the initialize() method. All subclasses of the AbstractOutput class are required to overwrite this method

and shows up as unconfigured… channels in inspector tell me null instead of its output value… I’m using the non-ppm version… any clue what I should change?

I;m downgraded now cause my system is in use :slight_smile:

1 Like

All modules are now required to overwrite initialize() of the abstract base class, so make sure it’s in your module. It can be as simple as:

def initialize(self):

In your modules, this would mean renaming setup_output(self) to initialize(self).

1 Like

Fixed in v8.13.7

It seems I’m unable to edit posts… but here’s the updated module:

[fix: now works with mycodo 8.13.X]

Sparkfun solid state relay 2.1.py (8.1 KB)
Sparkfun solid state relay slowPWM 2.1.py (11.0 KB)