New Output: 8-Relay HAT for Raspberry Pi from Sequent Microsystems

Are you setting the correct bus? Are you selecting the correct board stack number? Are you showing errors before you saved the settings for the new output? You should only be showing relevant log lines for the new output code.

There were no errors from the new installation.

The bus is set to 1 and the Board is set to 1.

I do get this ERROR when I simply create a new output with no setup at all:
2022-12-15 22:57:59,157 - ERROR - mycodo.outputs.on_off_sequent_8_relay_hat_326f6694 - Could not set up output. Check the I2C bus and address are correct.
Traceback (most recent call last):
File “/home/garden-pi/Mycodo/mycodo/outputs/on_off_sequent_8_relay_hat.py”, line 165, in initialize
self.device = RELAYS(smbus2, self.output.i2c_bus, int(str(self.output.i2c_location), 16), self.logger)
File “/home/garden-pi/Mycodo/mycodo/outputs/on_off_sequent_8_relay_hat.py”, line 253, in init
self.bus = smbus.SMBus(bus)
File “/var/mycodo-root/env/lib/python3.9/site-packages/smbus2/smbus2.py”, line 280, in init
self.open(bus)
File “/var/mycodo-root/env/lib/python3.9/site-packages/smbus2/smbus2.py”, line 310, in open
self.fd = os.open(filepath, os.O_RDWR)
FileNotFoundError: [Errno 2] No such file or directory: ‘’
2022-12-15 22:57:59,157 - INFO - mycodo.outputs.on_off_sequent_8_relay_hat_326f6694 - Initialized in 162.7 ms

I’m not getting that error, so it seems you may have something wrong with your I2C.

At this point it looks like it was working (excluding the state change errors). So what happened, it seems like it initialized, now it’s not initializing. I also just pushed a fix for the state change issues:

I am still getting the I2C error while adding this 8 relay hat as an output (using the latest master).

2023-01-08 19:23:52,613 - ERROR - mycodo.outputs.on_off_sequent_8_relay_hat_8a0e3a89 - Could not set up output. Check the I2C bus and address are correct.
Traceback (most recent call last):
File “/home/garden-pi/Mycodo/mycodo/outputs/on_off_sequent_8_relay_hat.py”, line 168, in initialize
self.device = RELAYS(smbus2, self.output.i2c_bus, self.logger)
File “/home/garden-pi/Mycodo/mycodo/outputs/on_off_sequent_8_relay_hat.py”, line 256, in init
self.bus = smbus.SMBus(bus)
File “/var/mycodo-root/env/lib/python3.9/site-packages/smbus2/smbus2.py”, line 280, in init
self.open(bus)
File “/var/mycodo-root/env/lib/python3.9/site-packages/smbus2/smbus2.py”, line 310, in open
self.fd = os.open(filepath, os.O_RDWR)
FileNotFoundError: [Errno 2] No such file or directory: ‘’
2023-01-08 19:23:52,655 - INFO - mycodo.outputs.on_off_sequent_8_relay_hat_8a0e3a89 - Initialized in 309.8 ms

It defualts to an install at 0x27 and I see the board at that address using i2detect. I dont know what is wrong!

I think that the major delta that we have is you do not have the board to trouble shoot yourself. I would be happy to donate a few hats to mycodo, if you think that is an appropriate action. I also want to explore adding python on/off outputs and simply hardcode those to the command line command that works per manufacturer.

Example: I could add a python on/off output and use the below commands to turn the 4th relay off/on
8relind 0 write 4 on
8relind 0 write 4 off

Do you have any suggestions on how to call the above on/off commands in a python on/off output? I have tried and I am getting syntax looking errors when the commands are executed.

Python is tricky because you need to include the OEM library. I’ve been using a shell on/off output for this board and it works ok. The only problem is sometimes the Mycodo dictionary gets out of sync with the relay states.

cd ~
echo 8relind 0 write $1 $2 >script_on_off.sh
chmod +x script_on_off.sh

full instructions

I appreciate the feedback Craig!

Your project looks pretty cool! Thank you, for sharing!

I am going to try and implement your proposed solution in the next few days…

I am not getting the expected result when I create your script_on_off.sh script? It doesn’t seem to recognize my arguments…?

Forgot to quote.

echo '8relind 0 write $1 $2' >script_on_off.sh
nano script_on_off.sh

Edit it if it doesn’t read like this:

8relind 0 write $1 $2

Thank you, sir! It is working

I am using the same 8 relay and T3 sensor hats that you are using. Once I get further along, I will document and share like you have…