Glad you like it!
Dota and CS:GO have an API for that, it's called Gamestate Integration. You just enable it in a config file. There are many values you can use, health, ammo, timers, items, abilities and much more.
If anybody wants to read more about this, here are the Dota values and here are the CS:GO values. There are many example scripts on github and other sites, you can just combine them with the Yeelight API.
Edit: added links