Giter Site home page Giter Site logo

discord_game's People

Contributors

lordboos avatar myztillx avatar niklaswa avatar pinpoint87 avatar xiidoz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

discord_game's Issues

'spotify_artist' always null

Listening to Spotify doesn't send the Artist to Home Assistant:

listening: Children - Undercatt Remix
listening_url: null
listening_details: null
spotify_artist: null
spotify_title: Children - Undercatt Remix
spotify_album: Children (Undercatt Remix)
spotify_album_cover_url: https://i.scdn.co/image/ab67616d0000b273da1dfc9b715543e53811ac41
spotify_track_id: 539yxbKKHPHrI1vc3BI2Ee
spotify_duration: 0:06:45.071000
spotify_start: 2022-10-02 20:57:26.827000+00:00
spotify_end: 2022-10-02 21:04:11.898000+00:00

I think I see why. In the source code I see "spotify_artists" mixed with "spotify_artist", is that correct?

Null state

This automation works great

alias: AAA - Discord
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.discord_user_***
    attribute: voice_channel
    to: General
condition: []
action:
  - device_id: ***
    domain: cover
    entity_id: cover.guest_blind
    type: set_position
    position: 0
mode: single

The issue appears to be with the null state of the attribute. This automation won't trigger when leaving a channel and the state of voice_channel reverts to null.

alias: AAA - Discord
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.discord_user_***
    attribute: voice_channel
    to: null
condition: []
action:
  - device_id: ***
    domain: cover
    entity_id: cover.guest_blind
    type: set_position
    position: 100
mode: single

Underscores causing issues with discord name detection

I have multiple people in my configuration.yaml file that are detected just fine. Only one is giving me issues and I believe it is because of the underscores in his name. That's the only thing I can find different from the others. Is there a simple fix to this that I don't know? I'm not a programmer or anything. I tried quotes thinking that may work but no.

Here's the discord name

George_W_#6605

No 'version' key in the manifest file for custom integration 'discord_game'.

On the newer versions of HA, I'm getting this error in my log when the HA service starts:

No 'version' key in the manifest file for custom integration 'discord_game'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'discord_game'

Version | core-2021.3.2
Installation Type | Home Assistant Core
Development | false
Supervisor | false
Docker | false
Virtual Environment | true
Python Version | 3.8.5
Operating System Family | Linux
Operating System Version | 5.4.103-1-pve
CPU Architecture | x86_64
Timezone | America/Denver

GitHub API | ok
Github API Calls Remaining | 4813
Installed Version | 1.11.3
Stage | running
Available Repositories | 775
Installed Repositories | 8

Home Assistant 2021.6 compatibility

No 'version' key in the manifest file for custom integration 'discord_game'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'discord_game'

[FEATURE REQUEST] Bot Commands and messaging

Not sure if its within the scope of the project but it would be cool if we could use the bot to perform actions based on home assistant triggers. For example i run a UFC discord and would love to have the bot embed a message with the upcoming calendar information i have coming into home assistant. Maybe a way to make announcements that can @everyone when an event is about to kick off.

I looked around and didnt find much else as far as discord bots that would work with home assistant so figured i would ask and hope for the best here.

It is possible to poll the sensor for different actions reported by Discord?

I would like to use the state my Discord reports in some automations, so that I can for instance automatically turn the brightness of my lights down if I start playing a game. The way things are now I don't think you can do anything besides seeing whether or not my account is online, which it is pretty much 24/7.

Is it currently possible to watch game, streaming, listening or watching status for use in automation and am I just missing it? And if it's not possible, is this something that would be possible to add and you would consider adding?

Discord user name changes cause entities to be renamed

First of all, thanks for an excellent integration!

The entity created by this integration contains both the Discord nick and the Discord numeric id, causing the entity to be renamed if the user changes the nickname (which many younger Discord users seem to do pretty frequently). This obviously breaks any other automations or Lovelace cards that rely on a fixed entity name.

Would it be possible for the integration to provide a somewhat static name for the entity instead?
For example sensor.discord_user_<id> instead of the current model with sensor.discord_<nick>_<id>.

(More) problems with Intents?

I am getting this error

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 197, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/discord_game/sensor.py", line 37, in async_setup_platform
intents = discord.Intents.default()
AttributeError: module 'discord' has no attribute 'Intents'

I have granted my bot the two new privliges mentioned in the recently updated readme.md. The stock Discord component works as my notifications shows up in the channel as before.

I am running Home Assistant 117.2 and Discord Game 3.3.1.

Any tips on what I can do to get back the game stats? Thanks!

Notifications

Hey Iโ€™m wondering if you can fix a function so if a friend in my discord group that is added to my list if it is possible to get a notification when that friend has started up vrchat, like if friend Peter starts playing vrchat then my home assistant says in my google home that Peter is now playing vrchat

Feature Request - Game Playing State

I can see from the code that this returns a bunch of additional states including the game currently playing state, could this be accessible in home assistant?

adding the example config breaks the config

I added the example config, replacing with my token and usernames, and when I hit check configuration, it just spins circles. As soon as I remove the discord_game entry its valid again.

Configuration not getting validated

Hi there,

I installed the component from HACS, restarted the HA and then added the config part.

Now, I am trying to check my config and restart, but it's just stuck at checking the configuration, any ideas why this could be?

My config snippet:

- platform: discord_game
   token: <token>
   members:
      - 287694783730810880

entity_id not using new format?

Entity_ID not using new format.

I have migrated to your new version 4.# and ajusted my config to use discord user ids.

It is definitely working as I am seeing all the new attribute you have added.

It appears the unique_id is using the new format of sensor.discord_user_{id number} however the entity_ids themselves are still sensor.{discord_displayname]#{number}

image

Bot stays offline

It was working great last night now the bot stays offline. Anyone know how to fix this?

4.0.1 breaks on load

2021-05-25 03:00:55 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform discord_game
Traceback (most recent call last):
  File "/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in async_add_entities
    await asyncio.gather(*tasks)
  File "/homeassistant/homeassistant/helpers/entity_platform.py", line 482, in _async_add_entity
    entity.entity_id = entry.entity_id
AttributeError: can't set attribute
2021-05-25 03:00:55 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up discord_game platform for sensor
Traceback (most recent call last):
  File "/homeassistant/homeassistant/helpers/entity_platform.py", line 239, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in async_add_entities
    await asyncio.gather(*tasks)
  File "/homeassistant/homeassistant/helpers/entity_platform.py", line 482, in _async_add_entity
    entity.entity_id = entry.entity_id
AttributeError: can't set attribute

Photos of discord-users not showing in HA-app

I don't know if this is caused by this integration or by HA itself, so please feel free to close this if you think it's HA's fault ;)

When displaying the discord-user-entities in lovelace, I can see the users profilepictures just fine. When i'm loading the same dashboard in the HA-app, the pictures are gone.

Browser:
image

App:
image

Get users muted status?

Hi,

I would love to automate a light to show red (on air) or green (muted) based on my discord muted state.

Is it possible to query this and add as sensor in HA?

Thanks a lot!

Bastian

[discord.gateway] Shard ID None has stopped responding to the gateway. Closing and restarting.

Hi there!

I've been using this component with no issue for the last 2 months with no issues and must say that it is pretty great.

Although, since 3 days, the bot keeps disconnecting and stop reporting from my Discord server.

This is the message that I've seen in the logs:

[discord.gateway] Shard ID None has stopped responding to the gateway. Closing and restarting.

Rebooting the server sometimes manages to bring it back, but it is very shortlived.

Any idea what this could be?

Thanks!

Attributes as sensor values

I'd like to do some filtering based on the attributes values. Like knowing when the game field is not empty so that I can flash my lights or turn them a certain color when a certain friend is playing a game. Is it possible to make it so that the attributes show up as sensors? Unfortunately at this time I don't know enough about what that would take for setup to get done.

Requirements conflict with Home Assistant Discord notification integration

Applies to:

  • discord_game v. 3.0.2
  • Home Assistant v. 104.2 (and previous releases)

If you are using the Home Assistant Discord integration for notifications, discord.py v. 1.2.5 gets loaded, even though discord_game requires a newer version of discord.py.

Until the new version is officially released and the Home Assistant integration is updated, the following workaround can be applied:

Create a folder discord under custom_components and copy the files from https://github.com/home-assistant/home-assistant/tree/dev/homeassistant/components/discord in that folder. Update the manifest.json to use the newer version of discord.py, so that the file looks like this:

{
  "domain": "discord",
  "name": "Discord",
  "documentation": "https://www.home-assistant.io/integrations/discord",
  "requirements": ["git+https://github.com/Rapptz/discord.py@23f16618fdf5fcbeeefed7acb56b579e74bc88d8#discord.py==1.6.0"],
  "dependencies": [],
  "codeowners": []
}

Restart Home Assistant and both Discord integrations should be working as intended.

HA Restarts with Errors

As soon as i insert the discord_game in config. i get randomly "crashes" of HA and ends in auto. restarts. :(

also it had problems with status etc. a friend was online but showed offline in HA.
online friends showed offline as soon as i got into the edit mode of a button card.

Latest release, installed a fresh HA.

Any suggestions ?
Thanks!

Integration 'discord_game' not found

After updating home assistant to version 2022.3, and updating integration to version 4.2.4/5.0.0.alpha1 this error appears:
Failed to call service homeassistant/restart. The system cannot restart because the configuration is not valid: Platform error sensor.discord_game - Integration 'discord_game' not found.. I was already trying first update integration and after that add sensor - but it turns out that's not the problem here

rebooted last night, now everyone is "unknown"

I've tried updating the token, changing to user IDs, deleting the component and reinstalling, and rolling back to previous versions. Nothing works. When I rebooted, I wasn't even editing any ymal for discord, it just stopped updating. Not sure what else to try.

~Ben

avatar/buddy icon

Many thanks for making this component,

I am in the process of moving away from my current ( very slow )discord rest sensor implementation over to your component - much more streamlined config.

Is there any way of making your component use the discord avatar/buddy icon as entity_picture or store it as attribute?

here is a snapshot of my rest sensor....
Capture

Idea: Let me use IDs because this one friend always renames himself

Hello,
Basicly the title. There is this one guy and I don't wanna edit my configuration everytime.
This should be easy to implement but I currently don't have time for it.
Maybe you could add the id as sensor attribute although I don't know where you would need it...

Requirements not found: calendar

Hi,
just installed via HACS and configured like in described in the readme but after restarting HA I get
the following message in the logs

Platform error sensor.discord_game - Requirements for discord_game not found: ['calendar'].

System Health

version core-2021.7.3
installation_type Home Assistant Container
dev false
hassio false
docker true
virtualenv false
python_version 3.8.10
os_name Linux
os_version 5.11.0-22-generic
arch x86_64
timezone Europe/Berlin
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 4689
Installed Version 1.13.2
Stage running
Available Repositories 912
Installed Repositories 48
Lovelace
dashboards 3
resources 31
views 9
mode storage

Discord integration stopped working on the 1st of September

I use Discord integration to show status of certain users, and it's been running very good for months. Last night the status stopped updating and was stuck on the last status, and when I restarted HA server this morning to try to resolve it, it shows as "unknown" status. Nothing has been changed in my configuration, nor in the bot setup on the Discord developer page.

I have checked my setup, the users I am monitoring is stored in my sensor.yaml file like before, and there is nothing wrong with the setup.

I have checked the logs and there is an error repeating which I have put in here below.

PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.

I do notice that the Discord bot is "offline" on my server, I do think it used to be online before.

Anyone else have any issues with this, or would be able to offer any advice? I have grown very accustomed to have the status updating regularly.

Game Values Null

Hello,

I just set this up and it does gather some information, but I am receiving some null values for game details. I have all privileged gateway intents checked. The bot is on the server and in the general channel.

Values that work:

game:

Values that are always null:

game_state: null
game_details: null
game_image_small: null
game_image_large: null
game_image_small_text: null
game_image_large_text: null
game_image_capsule_231x87: null
game_image_capsule_467x181: null
game_image_capsule_616x353: null
game_image_header: null
game_image_hero_capsule: null
game_image_library_600x900: null
game_image_library_hero: null
game_image_logo: null
game_image_page_bg_raw: null

Any insight as to why this may be would be appreciated. Thank you!

Invalid Form Body

Hi, I had this plugin working for a while but then it stopped. It is not the permissions issue from 2020, it was working after that. I also updated to the latest version via HACS and kicked and re-added the bot to the Discord Server. It is showing as online in Discord. The status in Home Assistant is showing as "unknown".

2021-07-21 11:02:05 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration discord_game which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-07-21 11:02:14 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up discord_game platform for sensor
  File "/config/custom_components/discord_game/sensor.py", line 326, in async_setup_platform
  File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 1375, in fetch_user
  File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 245, in request
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body

Config

sensor:
  - platform: discord_game
    token: !secret discord_game_token
    image_format: png
    members:
      - maciekish#1045

Idea - Use Activities rather than Activity

In the api you have

discord_member.activity.name
or
discord_member.activities

The problem I have with the default behaviour of activity.name is that it shows you the most current activity. So if I fire up a game my and then decide to listen to spotify while in game my activity will display Spotify not the game I'm playing.

image

I have modified the component to also include the activities feed, as you can see the response is a bit messy, I don't know a thing about python and how to tidy it up, so at the moment Im just using another home assistant sensor..

image

If this could be incorporated into the component, I could remove all my redundant template sensors, and I could see the true game activity for my friends.

From what I can tell in the responses a game can come in different formats depending on whether its a Discord 'RICH PRESENCE GAME', A discord automatically recognised game or a manually added game.

Manually format Sensor Naming?

Is there a way to manually add a prefix to each sensor created? Since all are in the format "sensor.username_1234" it is difficult for an autofill plugin to put all discord members in a card. Something like "sensor.discord_username_1234" would be great ...

Status updates not working

Status updates are not pushed to Home Assistant. They are loaded correctly on restart, but are not updated on a running system.

device_state_attributes Warning message in logs

Since HomeAssistant 2021.12.0 I get the following message in the logs

Entity sensor.discord_user_1234 (<class 'custom_components.discord_game.sensor.DiscordAsyncMemberState'>) implements device_state_attributes. Please report it to the custom component author.

`Logger: homeassistant.helpers.entity
Source: helpers/entity.py:549
First occurred: 1:30:34 AM (4 occurrences)
Last logged: 1:30:34 AM

Entity sensor.discord_user_1234 (<class 'custom_components.discord_game.sensor.DiscordAsyncMemberState'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.discord_user_1235 (<class 'custom_components.discord_game.sensor.DiscordAsyncMemberState'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.discord_user_1236 (<class 'custom_components.discord_game.sensor.DiscordAsyncMemberState'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.discord_user_1237 (<class 'custom_components.discord_game.sensor.DiscordAsyncMemberState'>) implements device_state_attributes. Please report it to the custom component author.`

Reporting it with this issue here.

Update 4.2.4 still asks for discord.py==1.5.1

Update 4.2.4 still asks for discord.py==1.5.1 so HA doesn't want to restart.
Platform error sensor.discord_game - Requirements for discord_game not found: ['discord.py==1.5.1'].
EDIT: I force rebooted and no I have a platform: discord_game not found in the logs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.