hey i wrote this code that can tell me what display im using and i want that when i use certain display the lights will go on and when i use the other one lights will go off my problem is that i cant install the library to the add on and im having trouble to understand how to connect visual studio code on my desktop to home assistant and i tried to find solutions in google but didnt find any im kinda newbie in programming and home assistant
I doubt this can work the way you imagine. The code you have runs locally on your computer. There the win32api is able to detect the displays. But I assume HA is running on a different machine. So even if you manage to import the library (which probably isn’t possible - it doesn’t sound like you’re running HA on Windows), it wouldn’t detect the displays since they’re obviously connected to a different machine.
Of course I might just have missed some details about your setup. But at first glance I don’t think your plans can work this way.
Instead you’d need some kind of service running on your Windows-machine, which HA can query periodically, or which sends out such information via MQTT so HA can react on it.