Thanks everyone for the resistor size, confirming that gpiod works, 1 is typically on and 0 is off, and all the other things from this thread.
Shell script needed
Here are my notes on what I looked at before I become convinced that a shell script will be needed the GPIO can not be controlled via /sys. I’m showing my work so others can correct me if I’m wrong.
Rules → Heating Control: Can see that it turns HeatingPin to ON or OFF.
Configuration → Items → Heating Pin: This is the item being controlled
Rules → Map a device to gpio pin: This is the rule that sends the new state to the pin (and the mapping is done in defaults.js). In the case of system in US mode and turning on the heat, that’d be going to Pin12.
/etc/openhab2/items/default.items: creates the Pin12 item and maps it to `gpio=”pin:12” (and it also creates the other 3 PinXX to GPIO mappings).
As best I can tell, at the end of the day, it’s the GPIO binding that is doing the actual turning on/off of the GPIO pin, and the documentation makes it clear that this requires /sys which is no longer around. I do acknowledge that in OpenHAB 5 (the current version at the time of writing), the GPIO binding has been updated to use pigpiod which based on the name is pretty clear it will use gpiod instead of /sys. However starting at v3, OpenHAB started requiring a newer version of Java, which requires a hardware floating point unit and the Pi Zero W doesn’t have that.
So that’s why I think we need a script if this image is going to work with the original hardware.
Experimental solution
To be honest, I still don’t understand how all these thing/channels/items/rules/commands all fit together in OpenHAB, even after reading the overview several times. But I was able to follow along the path of @cheeseyone1 with some slight modifications. I will list out the changes I made and then link to the repo where you can check out the config files.
- I created the same shell scripts, but I put them in
~pi/scripts/. - Add an Item called
Pin12on(type=Switch) which will activate the thing - Add a “Command heat relay on” Thing (type=Exec) that will run the script
- Edit the Thing and clicked on the blue circle next to the “Running” channel and selected
Pin12onas the item to link. This causes the script to run when a command is sent to pin12on. - Repeat steps 2-4 with
Pin12off - Repeat steps 2-5 with
Pin16onandPin16offfor second stage heating - Edit the JS in “then…” clause of the “Heating Control” rule to command these pins when needed (details below)
- For EU mode, repeat steps 2-5 with
Pin23onandPin23off for your heating to work.
The changes to the “then…” clause of the “Heating Control” are to load defaults.js and then look up the correct pin for your heat and so an events.sendCommand(pinItem + "on", ON); to turn whatever relay controls your heat on (it’s not the same for the US and EU modes).
If you’ve been making these changes along at home, at this point the heating should be functional (including 2nd stage heating if that’s enabled).
Getting the new rules
If you are running the test image, you can get the new rules by checking out my fork of the repo
git clone https://github.com/hestiahacker/hestia-touch-openhab.git
cd hestia-touch-openhab
sudo rsync -av ./var /var
sudo rsync -av ./etc /etc
sudo rsync -av ./home /home
Do note that I haven’t tested restoring these files, and I haven’t tested things out in EU mode yet. But I did test out Heating, 2nd stage heat, fan and cooling. If the files can be moved from my checkout to other machines, and I didn’t miss anything, you should be able to reproduce this.