[edit] Unrelated to LordBoos’ component, but I’ve found that when asleep, docked and connected via wired ethernet, Switch sysmodules (including Discord presence) remain active for at least 12 hours and presumably indefinitely. This causes issues with using presence or other sysmodules to detect the sleep/awake state accurately. I’m working around this by disabling “display home menu as a status” closing the game and exiting to Home when I’m done playing, but this is a bit of a pain since I can’t leave games suspended. If anyone knows a better solution please let me know
Can anyone advise me how to write a automation to trigger the game server to start when a server member starts a game and close if every ones out for an hour. So far i’ve for the below which gets it started. Issue is ark server uses 30% of my RAM and i want to run a similar setting for factorio. The switch is via MQTT to unraid.
- alias: "ark on"
trigger:
- platform: state
entity_id: sensor.discord_gruff_mumeen_0004 #me
attribute: game
to: ark
- platform: state
entity_id: sensor.discord_ #freind1
attribute: game
to: ark
- platform: state
entity_id: sensor.discord_ #freind2
attribute: game
to: ark
- platform: state
entity_id: sensor.discord_ #freind3
attribute: game
to: ark
- platform: state
entity_id: sensor.discord_ #freind4
attribute: game
to: ark
action:
service: switch.turn_on
entity_id: switch.storage_docker_arksurvivalevolved
Had this working a dream before this recent update. Tried to fix it by uninstalling, reinstalling, double checking my config.yaml but my discord sensors are now nowhere to be seen.
I have the following in my sensors.yaml, where it was before (when it worked). With the recent update I changed the members from “MyUsername#4566” etc to the numbers below using the method outlined in the readme.
Thanks for the quick response. I also tried searching “discord” in my entities and could not find anything (apart from the automations I set up using that word)
AFAIK the images are only available if the game is using Discord Rich Presence. I will check it again to see if there were any API changes, but no promises.
@oyvindhauge Turns out it is possible. I’ve released version 4.1.0 which adds images for most (bot not all) games. If the game has icon on Discord, it should show up in sensor.
Great! Than you very much for a fast reply. Is there something I need to do (except updating to 4.1.0)? I do unfortunately not see any images/ulrs to images. I could be unlucky as I have just tested three games (Apex, Days Gone and Zombie Army 4). Apex does appear to have an icon in Discord:
From those 3 games only Apex Legends should work.
You can check by searching at this Discord API json: https://discordapp.com/api/applications/detectable
I’ve not tested Apex Legends personally though.
Image URL should be filled to “Game image small” attribute of discord_game sensor.
Can you enable debug log level for discord_game and see if there are any "FOUND app = " messages from discord_game?
To enable debug level, just change your logger config in HA configuration.yaml to
logger:
default: info
logs:
custom_components.discord_game: debug
It is working when I start the game using Origin, but not when I start it using Steam. When using Steam, I find no log entries. When using Origin I find the following:
Ok I’ve found that there is indeed a difference when the game is launched from Steam or from Origin. Discord has different application ids for those 2 and one is in the list, while second isn’t. I’ve fixed a bug where “Search by game name” function was only called when the game had application_id in Discord, so It will now work for you.
Also I’m now developing much more better version which will load images from Steam, not icons tho, but many more images. Basically those images you can see here in the Web assets cell: https://steamdb.info/app/1172470/info/
I’ve just released a new version 4.2.0. This version contains fix for issue that sometimes game icons from Discord were not loaded properly.
This version also adds loading of game images from Steam.
Changelog:
Fixed game images sometimes not loading from Discord
Added game images loading from Steam, new attributes are following:
Not all games have all the images, only those existing for the game will show up
This will mostly only work for games available on Steam, but there are exceptions. Eg. I’ve tested League of Legends and surprisingly Steam have some of the images available for it (even though those images are extremely outdated)
Games are loaded from Steam by name, generally this should work reliably, but in some cases where there are 2 or more games with the same name, wrong images may be shown. This is a limitation I’m not able to fix.
I’m not sure. Have you enabled PRESENCE INTENT and SERVER MEMBERS INTENT for your bot in Discord developer portal? And are you sure that you have correct User IDs set up for your other users? Also those users have to be present in the same server as the bot.
This component is great! I have it configured properly and see all the info on my sensors when viewing the States pages under Developer Tools in HA. However, I’m not sure how to best to add this to Lovelace. Can someone point me in the general direction? Sorry- new to HA in general. Should I be looking at creating a template or something along those lines?