This is a custom integration for Home Assistant. It provides a sensor for a slack user by a given token.
ha-slack-user
is available through HACS. Open HACS -> Integrations -> Exlpore & Add repositories and search for "Slack User".
Or, install manually by downloading the custom_components/slack_user
folder from this repo and placing it in your config/custom_components/
folder.
ha-slack-user
is set up with Config Flow. After installing the integration, go to Configuration -> Integrations, click
the + button at the bottom right, and search for "Slack User".
The component requires a Slack Member ID (User ID), and API Token.
If you are using the deprecated Legacy Tokens, this should work out of the box.
If you are using a token from a Slack App, it'll need to have access to the following scopes:
users.profile:read
- to get general profile information - title, profile, status, etcusers.profile:write
- to set user statususers:read
- to get presence informationusers:write
- to be able to set presencednd:read
- to get DND informationdnd:write
to set DND status
After setting up a Slack User sensor, you'll have a sensor.name
(with the name you specified during config) with the following attributes:
title: string
real_name: string
display_name: string
status_text: string
status_expiration_ts: number
status_emoji: string
status_emoji_display_info:
emoji_name: string
display_url: string
unicode: string
entity_picture: string
huddle_state: string
huddle_state_expiration_ts: number
# Presence Info
presence: "online" or "away"
online: boolean
auto_away: boolean
manual_away: boolean
connection_count: number
last_activity: timestamp
# DND Info
dnd_enabled: boolean
next_dnd_start_ts: timestamp
next_dnd_end_ts: timestamp
snooze_enabled: boolean
Here's an example:
Required API scope: users.profile:write API Method: users.profle.set
Sets the user's slack status.
Field | Value | Necessity | Description |
---|---|---|---|
entity_id | sensor.slack_user |
Required | Name(s) of the sensor entities |
status_text | Commuting |
Optional | New status. Pass empty string ("" ) to clear. Don't pass anything to keep current status. |
status_emoji | :car: |
Optional | New status emoji. Pass empty string ("" ) to clear. Don't pass anything to keep current emoji. Will throw an error if emoji doesn't exist. |
expiration | 2021-06-12 15:00:001 |
Optional | Expiration date. Must be in format yyyy-mm-dd hh:mm:ss |
Required API scope: users.profile:write API Method: users.profle.set
Clears the user's slack status.
Field | Value | Necessity | Description |
---|---|---|---|
entity_id | sensor.slack_user |
Required | Name(s) of the sensor entities |
Required API scope: users:write API Method: users.setPresence
Updates the user's presence.
Field | Value | Necessity | Description |
---|---|---|---|
entity_id | sensor.slack_user |
Required | Name(s) of the sensor entities |
presence | auto or away |
Required | New presence |
Required API scope: dnd:write API Method: dnd.setSnooze
Enables DND for the user.
Field | Value | Necessity | Description |
---|---|---|---|
entity_id | sensor.slack_user |
Required | Name(s) of the sensor entities |
num_minutes | number | Required | Number of minutes to be in DND |
Required API scope: dnd:write API Method: dnd.endSnooze
Disables DND for the user.
Field | Value | Necessity | Description |
---|---|---|---|
entity_id | sensor.slack_user |
Required | Name(s) of the sensor entities |
Georgi Gardev