Is there a relay module/controller

Yea, somewhere we changed pwm_pin to self.pwm_pin, so you need to use that:

        self.pwm = PWM(
         self.pwm_pin, hz=10, unit=unit, experiment=experiment
        ) 

Note that indents are important - this should all be lined up with the code above and below it.

Should look like:

    def __init__(self, unit: str, experiment: str) -> None:
        super().__init__(unit=unit, experiment=experiment, plugin_name="schedualed_relay")

        self.relay_on_for = 20 # seconds

        # looks at config.ini/configuration on UI to match
        self.pwm_pin = PWM_TO_PIN[config.get("PWM_reverse", "relay")]

        self.pwm = PWM(
          self.pwm_pin, hz=10, unit=unit, experiment=experiment
        )  # since we also go 100% high or 0% low, we don't need hz, but some systems don't allow a very low hz (like hz=1).
        self.pwm.lock()
        self.pwm.start(0)

Yay - seems to be working now…

1 Like

Thanks for your patience with this @CamDavidsonPilon

Oh sorry you’ve been talking to CameronGPT, not Cameron

2 Likes