Raspberry Pi 3B+ HASSIO + MCP23017 binary sensor / switches

Hello everyone!
I began my adventure with Raspberry PI yesterday and with hassio today. So I’m total beginner and I need your help guys.
My home lighting installation is based on a star topology. My lighting installations consists of 80 GPIO and 30 monostable switches.
I would like to create expansion port in the MCP23017 in amount of 8 pieces.
I understand all hardware but unfortunately I don’t have any experience with hassio.
Could you please tell me how it is supposed to work.
There is one button in each room. If I shortly press it ones I wil set scene 1. If I shortly press it twice I will set scene 2. If I press it triple I will set scene 3. But if currently scene 2 is set after pressing once scene will switch for the next one.
For the situation will be more interesting I would like to reach following effect. If I press for 2 seconds I want to switch off light in the whole room.
For example livingroom is 3 relays.
Scene one - only 1st relay works
Scene two - only 2nd and 3rd relays work
Scene three - only 1st and 3rd relays work
From the hardware side, the optoisolation system seems to be very easy.
Unfortunately, I don’t know how to run on hassio i2c and how to declare scenes.
I will be extremely grateful for any help from your side.