M5Stack has defined three Groove ports A, B and C.
- A (red) is by default used for I2C (found on M5Core2)
- B (black) is by default used for DAC / ADC (found on M5GO Bottom2)
- C (blue) is by default used for UART (found on M5GO Bottom2)
that said, from the perspective of the ESP32 almost any GPIO can be used for any function. Or in other words the above is not set in stone, but only what M5Stack has decided to use as their default.
So, yes, you could use the two GPIOs on port A as standard GPIOs. In Arduino you'd just wouldn't initialize I2C on these two pins and then you could use for something else.
In UIFlow that would happen (automatically) if for instance you attach the relay unit (which is an UART device) to port A and then use the respective relay blocks.
Regarding the PbHub: this is an I2C device which by default is plugged into port A. It has 6 ports, each providing an input and an output. These 12 pins are controlled by an microcontroller inside PbHub and the available functionality is limited to a given set. Check the list at the bottom here.
Now, in Arduino you use this library which takes care of sending the proper I2C commands to lets say turn on the output pin on PbHub port 1. Or read the input pin on port 6.
In UIFlow if for instance you connect the relay unit to PbHub port 2 (instead of directly connecting it to a Groove port) you then use the PbHub specific block to control the 6 ports on PbHub. Again which I2C command that requires to be sent to PbHub is done automatically by the UIFlow firmware.
So, for your project, @cerietke, using OpenHASP, the OpenHASP firmware for M5Core2 would need to know about PbHub to be able to control the ports on PbHub. I don't know anything about OpenHAB so I cannot tell if it could deal with PbHub or not. That is probably an question on the OpenHAB forum to ask.