Using HOTAS buttons/axis to control home lights and fans?

I apologize if this has been answered elsewhere but is there any way to control home lighting and fans using HOTAS controls?

My dream would be to control the speed of a physical fan using a joystick axis or just switch room lights on/off using switches on my Thrustmaster HOTAS Warthog.

Is there a fairly straightforward way to accomplish either of these?

Yes it’s possible. I know some guys who are controlling Smart bulbs. Probably a few ways but i haven’t investigated all the possibilities as it’s not something I’ve considered doing. Straightforward though is a matter for debate. I may consider it so but you may not.