alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.46k stars 209 forks source link

✨ [REQUEST] free-games-claimer #747

Closed amosyuen closed 1 year ago

amosyuen commented 1 year ago

!!! I have a real life job in parallel to this addon, and don't think I'll be able to add new addons for the moment. You can still however express your interest in case someone would do it

Which addon? https://github.com/vogler/free-games-claimer. Supports epic games, prime gaming and GOG

Is your feature request related to a problem? Please describe. Claim free games from multiple services.

**If a new addon, have you checked on Google that such as addon doesn't already exists?** Yes

Describe the solution you'd like

Configure single add-on to claim all free games.

Describe alternatives you've considered

Not aware of other alternatives

diamant-x commented 1 year ago

there's an epic games one already.

https://github.com/alexbelgium/hassio-addons/tree/master/epicgamesfree

amosyuen commented 1 year ago

That one always prompts for a security code every checkout for me so isn't that helpful. free-games-claimer doesn't prompt and supports more accounts.

KairuByte commented 1 year ago

Oh my goodness, thank you For bringing this project to my attention. It seems they are looking to as even more services to The grabber as well!

hacshacdgacs commented 1 year ago

As someone who's had issues with the epicgamesfree addon in the past (was unable to get it to actually claim games because of the captcha) I would also like this if possible.

alexbelgium commented 1 year ago

I'll look at it

alexbelgium commented 1 year ago

Would this addon remove the epicgamesfree one? For sake of simplification

hacshacdgacs commented 1 year ago

I believe so but I don't personally use the epicfreegames addon so it may be worth putting a poll/question for them if that's an option?

On Mon, 22 May 2023, 21:14 Alexandre, @.***> wrote:

Would this addon remove the epicgamesfree one? For sake of simplification

— Reply to this email directly, view it on GitHub https://github.com/alexbelgium/hassio-addons/issues/747#issuecomment-1556852483, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUMWJOFBRJ5JCLNEXXQCERDXHMU55ANCNFSM6AAAAAAVQO7TTE . You are receiving this because you commented.Message ID: @.***>

KairuByte commented 1 year ago

I think it makes sense to keep both. They use different methods, and epic games free tends to be much more reliable from what I'm seeing.

alexbelgium commented 1 year ago

Is the latest working?

KairuByte commented 1 year ago

The latest egf is still working, and the latest container for fgc is working. I tried to set up the fgc addon last night but ran into issues with it accepting creds from the config file, so need to sit down today and figure out what's going on.

alexbelgium commented 1 year ago

In theory values from the config file (in yaml format) are exported as env variables

KairuByte commented 1 year ago

I'm not sure why, but I am getting constant stalls on start. It gets to the point that I am seeing output from the container, but it just stops sometimes moments after it starts up. Is that likely an issue with the container itself, or is that potentially a misconfiguration on the addon "wrapper" side?

Edit: Seems to come and go. I was just able to get it running, but it doesn't seem to be reading the values from the config file. Looking through the repo, I think it may have an incorrect file extension? The docs read like we should be interacting with config.env not config.yaml.

alexbelgium commented 1 year ago

Well config.yaml is my internet system to export env variables. Not sure about config.env

MaxWinterstein commented 1 year ago

Just found a minute and was going to check if 'epic-games-free' is fixable, and was confused where the readme part was gone. Found that you renamed the whole folder, therefore it looked 'abandoned' to me.

Tried the new 'free-games-claimer' - currently shown as 'epic-games-free' and had just one weird thing. It was not showing the novnc server, nor something useful in the logs. After adding a real port to the VNC port mapping everything started fine. After removing it still works fine. Not sure how settings are handled internally, and if a setting that once was overwritten is now empyt/null - or at least other than it was before.

To make every business consultant happy, here is the positive feedback: Would be nice to select which game plattforms i would like to check, as e.g. I have no usage of amazon prime gaming.

Keep up the good work :v:

KairuByte commented 1 year ago

Yeah, I'm having trouble getting novnc running here as well, and my entries in the config file don't seem to be working at all. I tried adding a vnc port in the network config section of the addon to no avail. I may need to remove and re-add or something.

As for picking and choosing which service works, technically the following command can be appended to the end of the docker run command to achieve that, leaving out what you don't want: bash -c node epic-games; node prime-gaming; node gog it may be possible to incorporate that into the plugin but I'm not sure.

alexbelgium commented 1 year ago

Great idea, I'll do that in next version

alexbelgium commented 1 year ago

Latest version includes custom commands through addon options as you propose, and usage of the config.env instead of my config.yaml. The config.env uses the nomenclature KEY=VALUE instead of the previous yaml that was KEY: VALUE

alexbelgium commented 1 year ago

Just found a minute and was going to check if 'epic-games-free' is fixable, and was confused where the readme part was gone. Found that you renamed the whole folder, therefore it looked 'abandoned' to me.

Hi - sorry this was unintended, I had pushed the folder in the free-games-claimer one on explorer :-) corrected now

KairuByte commented 1 year ago

Errors with the following output now:

/./etc/cont-init.d/99-run.sh: line 44: syntax error near unexpected token `}'

/etc/cont-init.d/99-run.sh: exiting 2
alexbelgium commented 1 year ago

Not working yet

alexbelgium commented 1 year ago

Hi, latest version is tested to start. Could you please check the applicability of the config.env ? I've modified the format to export KEY=VALUE and the CMD_ARGUMENTS must be changed to node epic-games ; node prime-gaming ; node gog

KairuByte commented 1 year ago

Trying now, and while some things seem to work (size for example) it doesnt seem to be reading string inputs? Should they be wrapped in a quote of some type?

Edit: Wrapping in single quotes seems to have worked.

Edit2: New error to contend with: cp: './config.env' and '/data/config.env' are the same file

Edit3: Or not? The error has now gone away...

KairuByte commented 1 year ago

Okay, I got it to run. Wrapping strings in single quotes, export keyword in front (though I'm surprised that can't be simulated) does work. Integers can remain unquoted no issue.

One major problem at the moment, is the command entry. The first command works, anything after that fails to ever run. For example, if you set node prime-gaming ; node gog ; node epic-games the prime-gaming module does indeed run, but the gog and epic-games modules never get run.

Another edit: I still can't seem to get VNC or noVNC to output anything, but that might not be on the wrappers fault. :P

alexbelgium commented 1 year ago

Would "node prime-gaming" "node gog" "node epic-games" work? I'll check this evening

KairuByte commented 1 year ago

I tried looking into that, but it's proving difficult since I'm actually terrible with docker. My initial thought was wrapping them all in a double quote together, so it's seen as a single command. But I don't have proper knowledge of what that script being referenced actually does (I assume it's part of the original image?...) so I can't speak with any authority.

alexbelgium commented 1 year ago

Thanks, I've pushed a new version. Now, the CMD_ARGUMENTS should be in the form : node prime-gaming; node gog; node epic-games and the config.env should be in the form KEY='VALUE'. I've also corrected the default files but as you have already installed the addon it won't probably use the new defaults.

KairuByte commented 1 year ago

Sorry to be the bearer of bad news:

/./etc/cont-init.d/99-run.sh: line 46: AZE: unbound variable
/etc/cont-init.d/99-run.sh: exiting 1
alexbelgium commented 1 year ago

That's my test variable, I went too fast and need to push another version

alexbelgium commented 1 year ago

still not working

amosyuen commented 1 year ago

I got it running, but then it needs me to login in UI. So when I try to access the noVNC port the chrome tab shows the loading icon for a while then eventually says site can't be reached.

MaxWinterstein commented 1 year ago

btw, works fine for me, thanks :)

alexbelgium commented 1 year ago

For me it works too... Perhaps a matter of ram availability too as I think it requires quite an amount?

amosyuen commented 1 year ago

Hmm, I have 2.2 GB of free memory so I feel it's unlikely a memory problem. I also tried accessing from a different browser with same problems.

KairuByte commented 1 year ago

I'm still seeing the issue of the first module running, but no others. I'm wondering if I'm missing something since two different individuals have said things are working for them.

I also find the idea of RAM being an issue, dubious. I regularly have >4GB of ram available, but noVNC has never worked.

alexbelgium commented 1 year ago

When I say it works for me, I mean I can access Firefox through the novnc webui, and even go on internet through it. I havent tested other functionalities. I'll look again for multi modules launch

KairuByte commented 1 year ago

Oh! Okay, sorry, I misunderstood. Reading back I see what was meant now.

When you access noVNC is it just at the iP address and port, or are you mapping to a domain name or anything? It does seem to start to connect, but sits loading forever until the addon stops.

Stooovie commented 1 year ago

For whatever reason none of these claimer addons work for me. This one launches successfully (no errors in log) but tying to access the webUI spins indefinitely and the addon takes 50% CPU. I don't have any weird network config, it's all typical 192.168. IPs. I do have filled in the config file.

KairuByte commented 1 year ago

Yeah, I can't get the web Ui working either. You can use the config.env to get yourself logged in though. The variables are all listed on the main repo.

Stooovie commented 1 year ago

I can't. I never got the text prompt. I can, however, run the very same config env file with docker outside of HA (I am used to run docker stuff in HA as I didn't have other options before, now I do), and it does work there for me. No problem, thanks!

alexbelgium commented 1 year ago

So weird. Here is my log:

Starting...
/etc/cont-init.d/00-banner.sh: executing
-----------------------------------------------------------
 Add-on: Free Games Claimer (in development)
 automatically claims free games on the Epic Games Store, Amazon Prime Gaming and GOG
-----------------------------------------------------------
 Add-on version: 1.4
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.5  (amd64 / qemux86-64)
 Home Assistant Core: 2023.5.2
 Home Assistant Supervisor: 2023.04.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
/etc/cont-init.d/01-custom_script.sh: executing
[10:08:57] INFO: Execute /config/addons_autoscripts/free-games-claimer.sh if existing
[10:08:57] INFO: ... script found, executing
dos2unix: converting file /config/addons_autoscripts/free-games-claimer.sh to Unix format...
/etc/cont-init.d/20-folders.sh: executing
Creating config location ...
Copying files if needed...
/etc/cont-init.d/99-run.sh: executing
[10:08:58] WARNING: The config.env file found in /config/addons_config/free_games_claimer will be used. Please customize according to https://github.com/vogler/free-games-claimer/tree/main#configuration--options and restart the add-on

[10:08:58] INFO: Starting the app with arguments node epic-games ; node prime-gaming ; node gog
Xvfb display server created screen with resolution 1280x1280
VNC is running on port 5900 (no password!)
noVNC (VNC via browser) is running on http://localhost:6080
2023-05-30 10:08:58.288 started checking epic-games
Not signed in anymore. Please login in the browser or here in the terminal.
Open http://localhost:6080 to login inside the docker container.
Login timeout is 180 seconds!
Press ESC to skip the prompts if you want to login in the browser (not possible in headless mode).

And going to http://homeassistant.local:6080/ shows image

I'll do some other tests.

alexbelgium commented 1 year ago

Btw even with default settings (running straight the container from upstream), it's using between 47% and 109% (reported by HA - not sure what it actually means) of my 8go ram rpi4

alexbelgium commented 1 year ago

Last version pushed (1.4-test8) fully works on my system.

  1. I uninstalled everything and clean reinstalled.
  2. Started addon, waiting for log to complete (until "started checking epic-games")
  3. Logged on webui on epic
  4. Logged in epic (the addon then moved on automatically to prime-gaming)
  5. Logged on webui on prime ...

10% ram on a 16gb system

Full log :

Starting...
/etc/cont-init.d/00-banner.sh: executing
-----------------------------------------------------------
 Add-on: Free Games Claimer (NOT WORKING)
 automatically claims free games on the Epic Games Store, Amazon Prime Gaming and GOG
-----------------------------------------------------------
 Add-on version: 1.4-test8
 You are running the latest version of this add-on.
 System: Home Assistant OS 9.5  (amd64 / qemux86-64)
 Home Assistant Core: 2023.5.2
 Home Assistant Supervisor: 2023.04.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
/etc/cont-init.d/01-custom_script.sh: executing
[15:00:55] INFO: Execute /config/addons_autoscripts/free-games-claimer.sh if existing
[15:00:55] INFO: ... script found, executing
dos2unix: converting file /config/addons_autoscripts/free-games-claimer.sh to Unix format...
/etc/cont-init.d/20-folders.sh: executing
Creating config location ...
Copying files if needed...
/etc/cont-init.d/99-run.sh: executing
[15:00:55] WARNING: The config.env file found in /config/addons_config/free_games_claimer will be used. Please customize according to https://github.com/vogler/free-games-claimer/tree/main#configuration--options and restart the add-on

[15:00:55] INFO: Starting the app with arguments node epic-games ; node prime-gaming ; node gog
Xvfb display server created screen with resolution 1280x1280
VNC is running on port 5900 (no password!)
noVNC (VNC via browser) is running on http://localhost:6080
2023-05-30 15:00:56.100 started checking epic-games
Not signed in anymore. Please login in the browser or here in the terminal.
Open http://localhost:6080 to login inside the docker container.
Login timeout is 180 seconds!
Press ESC to skip the prompts if you want to login in the browser (not possible in headless mode).
? Enter email ‣  ✖ Enter email ·  timeout
Waiting for you to login in the browser.
page.waitForURL: Timeout 180000ms exceeded.
=========================== logs ===========================
waiting for navigation to "https://store.epicgames.com/en-US/free-games" until "load"
============================================================
    at file:///data/epic-games.js:102:16 {
  name: 'TimeoutError'
}
2023-05-30 15:07:02.376 started checking prime-gaming
Not signed in anymore.
Login timeout is 180 seconds!
Press ESC to skip the prompts if you want to login in the browser (not possible in headless mode).
? Enter email ‣  ✖ Enter email ·  timeout
Waiting for you to login in the browser.
page.waitForURL: Timeout 180000ms exceeded.
=========================== logs ===========================
waiting for navigation to "https://gaming.amazon.com/home?signedIn=true" until "load"
============================================================
    at file:///data/prime-gaming.js:81:16 {
  name: 'TimeoutError'
}
2023-05-30 15:13:08.832 started checking gog
Not signed in anymore.
Login timeout is 180 seconds!
Press ESC to skip the prompts if you want to login in the browser (not possible in headless mode).
alexbelgium commented 1 year ago

edit : working on amd64 virtual machine, not on aarch64 rpi4

It is also not working within the container : curl 127.0.0.1:6080 works on my amd64 system, not on the aarch64. Hard to know if this is from the addon or the upstream container

alexbelgium commented 1 year ago

I've created a request on the upstream repo here : https://github.com/vogler/free-games-claimer/issues/149

viny182 commented 1 year ago

Hello, not working on a HAOS 10.2 am64 / generic x86-64 installation. (edit: physical machine, not VM) which makes it weirder.

Direct VNC is not reacheable on port 5900, so noVNC is also not reachable as well on :6080 trough browser... The tab opens, and keeps spinning for a while and eventually a timeout error is displayed.

I've also added a comment in here https://github.com/vogler/free-games-claimer/issues/149

viny182 commented 1 year ago

update: after insisting a lot to connect trough VNC direct client on port:5900 I was able to connect after pressing connect button several times on my VNC Client! However, it was already on one of the later stages, during the GOG login, so I have missed the login for Epic and Prime...

KairuByte commented 1 year ago

I may need to fiddle, but I can't seem to get the environment variables to work. Even something simple like setting the height and width seems to fail.

viny182 commented 1 year ago

@alexbelgium I'm wondering if this might be related specifically to the "node epic" and "node prime", as I managed to connect only trough direct VNC 2 times only after node gog have started...

I've tried to remove nodes epic and prime from the "CMD_ARGUMENTS" paramenter from the Configuration tab, but after saving and restart the addon, the Epic and Prime nodes were still being executed.

Same behavior when I removed the port number from NoVNC configuration in the addon. I still see messages on the logs saying noVNC was started, even with ports removed.

From this behavior, I presume that the addon is still not using the paramenters configured from Configuration Tab on home assistant.

alexbelgium commented 1 year ago

Hi sorry I disabled the function to customize the nodes to be as close as possible to the base container to avoid sources of issues

KairuByte commented 1 year ago

Just as a side note for the env variables, it is not possible to use the built in way of using them? The config file appears to be loaded as described here: https://github.com/vogler/free-games-claimer/issues/143#issuecomment-1551822765