What and why?
Well, it took me forever to figure it out, but apparently during the winter months I have problems with my nose not because I became super-sensitive as I age, but simply because humidity at my home office is not as good as it is was in the "real" office.
I, therefore, bought a simple smart diffuser by a company "Gologi" which looks cool I guess and fits well into my office. So, basically, how do I turn it on/off? No fancy scheduling required, mind you, just a small on/off switch on my stream deck (I don't want to use their smartphone app).
TL;DR
You need to:
rewire this IoT device into Tuya cloud via Tuya smart app to get the remote access capability
connect Home Assistant with Tuya smart app (not via the Tuya cloud API, that's enterprise-level pricing)
add Home Assistant control buttons to Stream Deck
profit!
Step by step
Tuya smart app
Gologi has a smart app already that can control the humidifer, but if you use that one you can't actually do anything in regards to the cloud-driven control.
You need to install another smartphone app: Tuya Smart App. Then, you need to go through the "add the device" flow to be able to get control over it from the Tuya app.
Interestingly, even after I have uninstalled the Gologi app I got the same interface on my smartphone to handle the Gologi humidifier from within Tuya 💣 . This brings me to the conclusion that Gologi is just one of the brands that built their IoT integration on the Tuya cloud and that's why it was so easy to add it into the Tuya app.
Now, do you see the "Stop diffuser" and "Start diffuser" buttons on the top? Those are there since I have added Tuya "Scenes" that trigger On/Off buttons of the diffuser. These will become important momentarily, since they will allow the actions from the Home Assistant even though HA doesn't support this type of Tuya devices, so you better add them:
Open Tuya App
Go to "Scene"
Add a "Tap-to-run" action
Choose "Control Single Device" -> Smart diffuser -> "Switch" -> "ON"
Do the same thing for "OFF" switch
Home Assistant integration
You don't necessarily have to use HA, but it's the thing I have found is so ubiquitous these days that you might be probably missing a lot if you don't have it in your home network and still want to play around with IoT devices. YMMV if you are using some other hub.
Within Home Assistant you just need to add Tuya integration. That's it.
Important: If your HA is older than 2024.0 please upgrade, since earlier versions demanded more complex setup using Tuya Cloud and developer accounts; newer version integrates on a higher level without any need to go into the cloud - it just uses the Tuya Smart app QR code scanner to integrate, easy-peasy!Scene
Scene after adding the Tuya integration shows "2 entities" which are the 2 scenes we've added in the Tuya smart app!
Stream Deck setup
Stream Deck is amazing since, even though it was meant for the streamers (obviously) it's an extremely hack-friendly device and can execute anything you can think of. In this case I want to have a panel setup like shown on the screenshot below, one for ON and one for OFF button.
Some important parts:
you need to install official HA plugin for the stream deck
you need to provide a "long-lived access token" from HA and expose (if you haven't already) the home assistant websocket URL
both Keypad Appearance and the Keypad Action need to be selected and configured, otherwise button will do nothing
Note: in my case the HA is behind Tailscale, but since Stream Deck talks to the server software within your connected computer, and then that software talks to the HA, you do not need to expose HA to Stream Deck via a public API, you can just use internal IP
And the "Short press" Keypad action is configured like this:
Conclusion
This was kind of a multi-day exercise to figure out what works and what doesn't work. There are, like with any integration, many moving pieces, expecting no breaking API changes on Tuya Cloud (cloud service... I hope it remains stable), smartphone app, HA plugin, HA itself... but that's just normal day in IT I guess.
It's amazing how little thing like Stream Deck button helps removing context-switching tasks out of your daily life. I'm very happy with my Stream Deck and are continuously thinking "what else can I use it for" and definitely would recommend it for your homelab / office setup since it is very extensible tool that is super useful.