Hi again HA forums, I’ve got another lighting implementation to share with you today.
I’ve created a small python script to monitor any rectangles on any screen, and then fire off APIs event to based on user defined settings. I use Home Assistant to receive the API calls and do the home automation work.
I tried uncommenting the lines you said to uncomment in order to see the rectangle. But when i try to run it i get this back
C:\lifelights-master>python lifelights.py Traceback (most recent call last): File "lifelights.py", line 6, in <module> from widthwatcher import WidthWatcher File "C:\lifelights-master\widthwatcher\__init__.py", line 49 cv2.rectangle(screen,(x,y),(x+w,y+h),(0,255,0),2)
^
IndentationError: unindent does not match any outer indentation level
Also you said lines 35, 46-50 but for me the commented lines were
37, 49-52
EDIT: Also would a healthbar that is split into segments work properly? For example
I got one game to kinda do something for me. When i started the game my lights turned green but as i was dying the lights didnt change. Im really not sure how the yml file is supposed to be.
Maybe someone could help me with whats going wrong? I can see the health changes being reported in the cmd window. but it just stays green
Did you ever figure this out? I’m also trying to work with a rest post and have not been able to understand the syntax. How did you end up passing your arguments?
I never actually got this working. The first attempt I made I could see the reports of my health being made to home assistant but I had the RGB color set to a single color so that’s all it did was go green.
Then someone told me to just grab the newest version. And leave this rgb_color: ‘LIFELIGHT_RGB’ alone. And it should work, but when I tried again it never report my health. And I could never get the drawn rectangles to show up in game. Just an error when I uncommented the lines he says.
I actually just tried downloading heroes of the storm which is the game its setup to work with already. I guess i could say its working. When i start the game the lights turn red then green then red again. Then when i go into battle and take damage it does nothing and when i leave the area still almost dead my lights turn green out of nowhere while im nearly dead. So i really dont know whats going on now.
On top of that i dont think this will work with a lot of games. Ive noticed every game on my 150 game list has vertical healthbars, seperated chunks, 2 phase health bars, etc, etc.
After looking through my games the only ones i found that would be a candidate would be csgo. But then there is a problem with the window title because it has a - in it. So i tried using a program to change the window title and it found the window but for some reason doesnt seem to want to send any data.
What games are you trying to make this work on? Maybe i could help out a little further.
Overwatch btw is not possible. The health bar is integrated into the main view so when the lighting changes the colors get all messed up. So maybe I will change the title to be “works on any horizontal health bars that stay the same color”
Anyway I’m over that now, I’ve decided to just read the game memory. New video coming soon
I wasn’t meaning anything negative about the game compatibility. It’s just a lot of different games have different methods. I was going to try it with Doom but it has like a multiphase healthbar. It’s 1 color then when it drains it’s another, then another. I figured the reason overwatch wasn’t working was because of the little slices that segment the bar.
I tried CSGO like I mentioned but after reading your comment about the lighting I looked and noticed it’s slightly transparent so it throws off the colors depending on the background.
How is the new method going to be setup exactly? Aren’t there a lot of games that ban for memory stuff? Or is it just writing to the memory that is looked down upon?
Would the new method work with a wider range of games? Easy to implement?
I’m just kinda curious and understand if you wanna keep it under wraps until it’s finished. But any further details would be awesome.